parameters2.exp revision 307b90b158b79ba3aae61d5c6612b4769b10be5f
1# This file is part of ltrace.
2# Copyright (C) 2012 Petr Machata, Red Hat Inc.
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License as
6# published by the Free Software Foundation; either version 2 of the
7# License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17# 02110-1301 USA
18
19ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
20    typedef aa = int;
21    typedef aaa = int;
22    typedef bbb = struct(aa);
23}] -- true] "error" == 0
24
25ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
26    typedef aa = int;
27    typedef aa = int;
28}] -- true] "error" != 0
29
30ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
31    typedef aa = struct;
32    typedef aa = int;
33}] -- true] "error" != 0
34
35ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
36    typedef aa = struct;
37    typedef aa = struct(int);
38    typedef aa = struct(int);
39}] -- true] "error" != 0
40
41ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
42    typedef aa = struct;
43    typedef aa = struct();
44    typedef aa = struct();
45}] -- true] "error" != 0
46
47ltraceMatch1 [ltraceRun -L -F [ltraceSource conf {
48    typedef aa = struct(int, struct;);
49}] -- true] "error" != 0
50
51set libll [ltraceCompile libll.so [ltraceSource c {
52    struct xxx;
53    void ll(struct xxx *xxx) {}
54}]]
55
56set bin [ltraceCompile ll $libll [ltraceSource c {
57    struct xxx {
58	int i;
59	struct xxx *next;
60    };
61
62    void ll (struct xxx *xxx);
63    int main (int argc, char *argv[])
64    {
65	struct xxx a = { 1, 0 };
66	struct xxx b = { 2, &a };
67	struct xxx c = { 3, &b };
68	struct xxx d = { 4, &c };
69	ll (&d);
70
71	struct xxx e = { 1, 0 };
72	struct xxx f = { 2, &e };
73	e.next = &f;
74	ll (&f);
75
76	struct xxx g = { 1, &g };
77	ll (&g);
78
79	return 0;
80    }
81}]]
82
83set conf [ltraceSource conf {
84    typedef xxx = struct;
85    typedef xxx = struct(int, xxx*);
86    void ll(xxx*);
87}]
88
89ltraceMatch [ltraceRun -F $conf -e ll -- $bin] {
90    {{ll->ll\({ 4, { 3, { 2, { 1, nil } } } }\) *= <void>} == 1}
91    {{ll->ll\({ 2, { 1, recurse\^ } }\) *= <void>} == 1}
92    {{ll->ll\({ 1, recurse }\) *= <void>} == 1}
93}
94
95ltraceDone
96