parameters2.exp revision 6248a0ac394b2aa3b2267eaa1220a90b609b6f86
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 conf [ltraceSource conf { 57 typedef xxx = struct; 58 typedef xxx = struct(int, xxx*); 59 void ll(xxx*); 60}] 61 62ltraceMatch [ltraceRun -F $conf -e ll [ltraceCompile {} $libll [ltraceSource c { 63 struct xxx { 64 int i; 65 struct xxx *next; 66 }; 67 68 void ll (struct xxx *xxx); 69 int main (int argc, char *argv[]) 70 { 71 struct xxx a = { 1, 0 }; 72 struct xxx b = { 2, &a }; 73 struct xxx c = { 3, &b }; 74 struct xxx d = { 4, &c }; 75 ll (&d); 76 77 struct xxx e = { 1, 0 }; 78 struct xxx f = { 2, &e }; 79 e.next = &f; 80 ll (&f); 81 82 struct xxx g = { 1, &g }; 83 ll (&g); 84 85 return 0; 86 } 87}]]] { 88 {{->ll\({ 4, { 3, { 2, { 1, nil } } } }\) *= <void>} == 1} 89 {{->ll\({ 2, { 1, recurse\^ } }\) *= <void>} == 1} 90 {{->ll\({ 1, recurse }\) *= <void>} == 1} 91} 92 93ltraceMatch1 [ltraceRun -F $conf -e ll -A 5 \ 94-- [ltraceCompile ll $libll [ltraceSource c { 95 #include <stdlib.h> 96 struct ble { 97 int i; 98 struct ble *next; 99 }; 100 101 void ll (struct ble *ble); 102 int main (int argc, char *argv[]) 103 { 104 struct ble *b = NULL; 105 int i; 106 for (i = 0; i < 10; ++i) { 107 struct ble *n = malloc(sizeof(*n)); 108 n->i = i; 109 n->next = b; 110 b = n; 111 } 112 ll (b); 113 114 return 0; 115 } 116}]]] {->ll\({ 9, { 8, { 7, { 6, { 5, \.\.\. } } } } }\) *= <void>} == 1 117 118 119ltraceDone 120