1 # Copyright (C) 1992, 1994 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
29 set binfile "funcargs"
30 set srcfile $binfile.c
32 if ![file exists $objdir/$subdir/$binfile] then {
33 perror "$objdir/$subdir/$binfile does not exist."
38 # Locate actual args; integral types.
41 proc integral_args {} {
47 send "break call0a\n" ; expect -re ".*$prompt $"
48 send "break call0b\n" ; expect -re ".*$prompt $"
49 send "break call0c\n" ; expect -re ".*$prompt $"
50 send "break call0d\n" ; expect -re ".*$prompt $"
51 send "break call0e\n" ; expect -re ".*$prompt $"
53 # Run; should stop at call0a and print actual arguments.
54 # The a29k fails all of these tests, perhaps because the prologue
56 setup_xfail "a29k-*-udi"
59 -re ".* call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+ .*$prompt $" {}
60 -re "$prompt $" { fail "run to call0a" ; return }
61 timeout { fail "(timeout) run to call0a" ; return }
66 # Print each arg as a double check to see if we can print
67 # them here as well as with backtrace.
68 if [gdb_test "print c" ".* = 97 'a'" ""] {
69 fail "print c"; return
71 if [gdb_test "print s" ".* = 1" ""] {
72 fail "print s"; return
74 if [gdb_test "print i" ".* = 2" ""] {
75 fail "print i"; return
77 if [gdb_test "print l" ".* = 3" ""] {
78 fail "print l"; return
81 # Continue; should stop at call0b and print actual arguments.
82 if [gdb_test "cont" ".* call0b \[(\]+s=1, i=2, l=3, c=97 'a'\[)\]+ " ""] {
83 fail "continue to call0b"; return
86 # Continue; should stop at call0c and print actual arguments.
87 if [gdb_test "cont" ".* call0c \[(\]+i=2, l=3, c=97 'a', s=1\[)\]+ " ""] {
88 fail "continue to call0c"; return
91 # Continue; should stop at call0d and print actual arguments.
92 if [gdb_test "cont" ".* call0d \[(\]+l=3, c=97 'a', s=1, i=2\[)\]+ " ""] {
93 fail "continue to call0d"; return
96 # Continue; should stop at call0e and print actual arguments.
97 if [gdb_test "cont" ".* call0e \[(\]+c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\[)\]+ " "" ] {
98 fail "continue to call0e"; return
101 pass "locate actual args, signed integral types"
105 # Locate actual args; unsigned integral types.
108 proc unsigned_integral_args {} {
114 send "break call1a\n" ; expect -re ".*$prompt $"
115 send "break call1b\n" ; expect -re ".*$prompt $"
116 send "break call1c\n" ; expect -re ".*$prompt $"
117 send "break call1d\n" ; expect -re ".*$prompt $"
118 send "break call1e\n" ; expect -re ".*$prompt $"
120 # Run; should stop at call1a and print actual arguments.
121 # The a29k fails all of these tests, perhaps because the prologue
123 setup_xfail "a29k-*-udi"
125 -re ".* call1a \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*$prompt $" {}
126 -re "$prompt $" { fail "run to call1a" ; return }
127 timeout { fail "(timeout) run to call1a" ; return }
132 # Print each arg as a double check to see if we can print
133 # them here as well as with backtrace.
134 if [gdb_test "print uc" ".* = 98 'b'" ""] {
135 fail "print uc"; return
137 if [gdb_test "print us" ".* = 6" ""] {
138 fail "print us"; return
140 if [gdb_test "print ui" ".* = 7" ""] {
141 fail "print ui"; return
143 if [gdb_test "print ul" ".* = 8" ""] {
144 fail "print ul"; return
147 # Continue; should stop at call1b and print actual arguments.
148 if [gdb_test "cont" ".* call1b \[(\]+us=6, ui=7, ul=8, uc=98 'b'\[)\]+ " ""] {
149 fail "continue to call1b"; return
152 # Continue; should stop at call1c and print actual arguments.
153 if [gdb_test "cont" ".* call1c \[(\]+ui=7, ul=8, uc=98 'b', us=6\[)\]+ " ""] {
154 fail "continue to call1c"; return
157 # Continue; should stop at call1d and print actual arguments.
158 if [gdb_test "cont" ".* call1d \[(\]+ul=8, uc=98 'b', us=6, ui=7\[)\]+ " ""] {
159 fail "continue to call1d"; return
162 # Continue; should stop at call1e and print actual arguments.
163 if [gdb_test "cont" ".* call1e \[(\]+uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\[)\]+ " ""] {
164 fail "continue to call1e"; return
167 pass "locate actual args, unsigned integral types"
171 # Locate actual args; integrals mixed with floating point.
174 proc float_and_integral_args {} {
180 send "break call2a\n" ; expect -re ".*$prompt $"
181 send "break call2b\n" ; expect -re ".*$prompt $"
182 send "break call2c\n" ; expect -re ".*$prompt $"
183 send "break call2d\n" ; expect -re ".*$prompt $"
184 send "break call2e\n" ; expect -re ".*$prompt $"
185 send "break call2f\n" ; expect -re ".*$prompt $"
186 send "break call2g\n" ; expect -re ".*$prompt $"
187 send "break call2h\n" ; expect -re ".*$prompt $"
188 send "break call2i\n" ; expect -re ".*$prompt $"
190 # Run; should stop at call2a and print actual arguments.
192 setup_xfail "i960-*-*" 1813
193 # The a29k fails all of these tests, perhaps because the prologue
195 setup_xfail "a29k-*-udi"
197 -re ".* call2a \[(\]+c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\[)\]+ .*$prompt $" {}
198 -re "$prompt $" { fail "run to call2a" ; return }
199 timeout { fail "(timeout) run to call2a" ; return }
204 # Print each arg as a double check to see if we can print
205 if [gdb_test "print c" ".* = 97 'a'" ""] {
206 fail "print c"; return
208 if [gdb_test "print f1" ".* = 4" ""] {
209 fail "print f1"; return
211 if [gdb_test "print s" ".* = 1" ""] {
212 fail "print s"; return
214 if [gdb_test "print d1" ".* = 5" ""] {
215 fail "print d1"; return
217 if [gdb_test "print i" ".* = 2" ""] {
218 fail "print i"; return
220 if [gdb_test "print f2" ".* = 4" ""] {
221 fail "print f2"; return
223 if [gdb_test "print l" ".* = 3" ""] {
224 fail "print l"; return
226 if [gdb_test "print d2" ".* = 5" ""] {
227 fail "print d2"; return
230 # Continue; should stop at call2b and print actual arguments.
231 if [gdb_test "cont" ".* call2b \[(\]+f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\[)\]+ " ""] {
232 fail "continue to call2b"; return
235 # Continue; should stop at call2c and print actual arguments.
236 if [gdb_test "cont" ".* call2c \[(\]+s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\[)\]+ " ""] {
237 fail "continue to call2c"; return
240 # Continue; should stop at call2d and print actual arguments.
241 if [gdb_test "cont" ".* call2d \[(\]+d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\[)\]+ " ""] {
242 fail "continue to call2d"; return
245 # Continue; should stop at call2e and print actual arguments.
246 if [gdb_test "cont" ".* call2e \[(\]+i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\[)\]+ " ""] {
247 fail "continue to call2e"; return
250 # Continue; should stop at call2f and print actual arguments.
251 if [gdb_test "cont" ".* call2f \[(\]+f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\[)\]+ " ""] {
252 fail "continue to call2f"; return
255 # Continue; should stop at call2g and print actual arguments.
256 if [gdb_test "cont" ".* call2g \[(\]+l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\[)\]+ " ""] {
257 fail "continue to call2g"; return
260 # Continue; should stop at call2h and print actual arguments.
261 if [gdb_test "cont" ".* call2h \[(\]+d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\[)\]+ " ""] {
262 fail "continue to call2h"; return
265 # Continue; should stop at call2i and print actual arguments.
266 if [gdb_test "cont" ".* call2i \[(\]+c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\[)\]+ " ""] {
267 fail "continue to call2i"; return
270 pass "locate actual args, mixed integral and float types"
274 # Locate actual args; dereference pointers to ints and floats.
277 proc pointer_args {} {
284 send "break call3a\n" ; expect -re ".*$prompt $"
285 send "break call3b\n" ; expect -re ".*$prompt $"
286 send "break call3c\n" ; expect -re ".*$prompt $"
288 # Run; should stop at call3a and print actual arguments.
289 # Try dereferencing the arguments.
291 # The a29k fails all of these tests, perhaps because the prologue
293 setup_xfail "a29k-*-udi"
295 -re ".* call3a \[(\]+cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\[)\]+ .*$prompt $" {}
296 -re "$prompt $" { fail "run to call3a" ; return }
297 timeout { fail "(timeout) run to call3a" ; return }
302 if [gdb_test "print *cp" ".* = 97 'a'" ""] {
303 fail "print *cp"; return
305 if [gdb_test "print *sp" ".* = 1" ""] {
306 fail "print *sp"; return
308 if [gdb_test "print *ip" ".* = 2" ""] {
309 fail "print *ip"; return
311 if [gdb_test "print *lp" ".* = 3" ""] {
312 fail "print *lp"; return
315 # Continue; should stop at call3b and print actual arguments.
316 # Try dereferencing the arguments.
317 if [gdb_test "cont" ".* call3b \[(\]+ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\[)\]+ " ""] {
318 fail "continue to call3b"; return
321 if [gdb_test "print *ucp" ".* = 98 'b'" ""] {
322 fail "print *ucp"; return
324 if [gdb_test "print *usp" ".* = 6" ""] {
325 fail "print *usp"; return
327 if [gdb_test "print *uip" ".* = 7" ""] {
328 fail "print *uip"; return
330 if [gdb_test "print *ulp" ".* = 8" ""] {
331 fail "print *ulp"; return
334 # Continue; should stop at call3c and print actual arguments.
335 # Try dereferencing the arguments.
336 if [gdb_test "cont" ".* call3c \[(\]+fp=$hex, dp=$hex\[)\]+ " ""] {
337 fail "continue to call3c"; return
340 if [gdb_test "print *fp" ".* = 4" ""] {
341 fail "print *fp"; return
343 if [gdb_test "print *dp" ".* = 5" ""] {
344 fail "print *dp"; return
347 pass "locate actual args, pointer types"
351 # Locate actual args; structures and unions passed by reference.
354 proc structs_by_reference {} {
361 send "break call4a\n" ; expect -re ".*$prompt $"
362 send "break call4b\n" ; expect -re ".*$prompt $"
364 # Run; should stop at call4a and print actual arguments.
365 # Try dereferencing the arguments.
367 # The a29k fails all of these tests, perhaps because the prologue
369 setup_xfail "a29k-*-udi"
371 -re ".* call4a \[(\]+stp=$hex\[)\]+ .*$prompt $" {}
372 -re "$prompt $" { fail "run to call4a" ; return }
373 timeout { fail "(timeout) run to call4a" ; return }
378 if [gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}" ""] {
379 fail "print *stp"; return
382 # Continue; should stop at call4b and print actual arguments.
383 # Try dereferencing the arguments.
385 if [gdb_test "cont" ".* call4b \[(\]+unp=$hex\[)\]+ " ""] {
386 fail "continue to call4b"; return
389 if [gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" ""] {
390 fail "print *unp"; return
393 pass "locate actual args, structs/unions passed by reference"
397 # Locate actual args; structures and unions passed by value.
400 proc structs_by_value {} {
407 send "break call5a\n" ; expect -re ".*$prompt $"
408 send "break call5b\n" ; expect -re ".*$prompt $"
410 # Run; should stop at call5a and print actual arguments.
411 # Try dereferencing the arguments.
413 # The a29k fails all of these tests, perhaps because the prologue
415 setup_xfail "a29k-*-udi"
417 -re ".* call5a \[(\]+st=\{s1 = 101, s2 = 102\}\[)\]+ .*$prompt $" {}
418 -re "$prompt $" { fail "run to call5a" ; return }
419 timeout { fail "(timeout) run to call5a" ; return }
424 if [gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}" ""] {
425 fail "print st"; return
428 # Continue; should stop at call5b and print actual arguments.
429 # Try dereferencing the arguments.
430 if [gdb_test "cont" ".* call5b \[(\]+un=\{u1 = 2, u2 = 2\}\[)\]+ " ""] {
431 fail "continue to call5b"; return
434 if [gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" ""] {
435 fail "print un"; return
438 pass "locate actual args, structs/unions passed by value"
442 # Locate actual args; discard, shuffle, and call
445 proc discard_and_shuffle {} {
453 send "break call6a\n" ; expect -re ".*$prompt $"
454 send "break call6b\n" ; expect -re ".*$prompt $"
455 send "break call6c\n" ; expect -re ".*$prompt $"
456 send "break call6d\n" ; expect -re ".*$prompt $"
457 send "break call6e\n" ; expect -re ".*$prompt $"
458 send "break call6f\n" ; expect -re ".*$prompt $"
459 send "break call6g\n" ; expect -re ".*$prompt $"
460 send "break call6h\n" ; expect -re ".*$prompt $"
461 send "break call6i\n" ; expect -re ".*$prompt $"
462 send "break call6j\n" ; expect -re ".*$prompt $"
463 send "break call6k\n" ; expect -re ".*$prompt $"
465 # Run; should stop at call6a and print actual arguments.
468 # The a29k fails all of these tests, perhaps because the prologue
470 setup_xfail "a29k-*-udi"
472 -re ".*Breakpoint $decimal, call6a .*$prompt $" {}
473 -re "$prompt $" { fail "run to call6a" ; return }
474 timeout { fail "(timeout) run to call6a" ; return }
479 send "backtrace 100\n"
482 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
483 .* main \[(\]+.*\[)\]+ .*\r
485 -re "$prompt $" { fail "backtrace from call6a" ; return }
486 timeout { fail "(timeout) backtrace from call6a" ; return }
489 # Continue; should stop at call6b and print actual arguments.
494 -re ".*Breakpoint $decimal, call6b .*$prompt $" {}
495 -re "$prompt $" { fail "continue to call6b" ; return }
496 timeout { fail "(timeout) continue to call6b" ; return }
499 send "backtrace 100\n"
502 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
503 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
504 .* main \[(\]+.*\[)\]+ .*\r
506 -re "$prompt $" { fail "backtrace from call6b" ; return }
507 timeout { fail "(timeout) backtrace from call6b" ; return }
510 # Continue; should stop at call6c and print actual arguments.
515 -re ".*Breakpoint $decimal, call6c .*$prompt $" {}
516 -re "$prompt $" { fail "continue to call6c" ; return }
517 timeout { fail "(timeout) continue to call6c" ; return }
520 send "backtrace 100\n"
523 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
524 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
525 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
526 .* main \[(\]+.*\[)\]+ .*\r
528 -re "$prompt $" { fail "backtrace from call6c" ; return }
529 timeout { fail "(timeout) backtrace from call6c" ; return }
532 # Continue; should stop at call6d and print actual arguments.
537 -re ".*Breakpoint $decimal, call6d .*$prompt $" {}
538 -re "$prompt $" { fail "continue to call6d" ; return }
539 timeout { fail "(timeout) continue to call6d" ; return }
542 send "backtrace 100\n"
545 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
546 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
547 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
548 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
549 .* main \[(\]+.*\[)\]+ .*\r
551 -re "$prompt $" { fail "backtrace from call6d" ; return }
552 timeout { fail "(timeout) backtrace from call6d" ; return }
555 # Continue; should stop at call6e and print actual arguments.
560 -re ".*Breakpoint $decimal, call6e .*$prompt $" {}
561 -re "$prompt $" { fail "continue to call6e" ; return }
562 timeout { fail "(timeout) continue to call6e" ; return }
565 send "backtrace 100\n"
568 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
569 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
570 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
571 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
572 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
573 .* main \[(\]+.*\[)\]+ .*\r
575 -re "$prompt $" { fail "backtrace from call6e" ; return }
576 timeout { fail "(timeout) backtrace from call6e" ; return }
579 # Continue; should stop at call6f and print actual arguments.
584 -re ".*Breakpoint $decimal, call6f .*$prompt $" {}
585 -re "$prompt $" { fail "continue to call6f" ; return }
586 timeout { fail "(timeout) continue to call6f" ; return }
589 send "backtrace 100\n"
592 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
593 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
594 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
595 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
596 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
597 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
598 .* main \[(\]+.*\[)\]+ .*\r
600 -re "$prompt $" { fail "backtrace from call6f" ; return }
601 timeout { fail "(timeout) backtrace from call6f" ; return }
604 # Continue; should stop at call6g and print actual arguments.
609 -re ".*Breakpoint $decimal, call6g .*$prompt $" {}
610 -re "$prompt $" { fail "continue to call6g" ; return }
611 timeout { fail "(timeout) continue to call6g" ; return }
614 send "backtrace 100\n"
617 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
618 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
619 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
620 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
621 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
622 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
623 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
624 .* main \[(\]+.*\[)\]+ .*\r
626 -re "$prompt $" { fail "backtrace from call6g" ; return }
627 timeout { fail "(timeout) backtrace from call6g" ; return }
630 # Continue; should stop at call6h and print actual arguments.
635 -re ".*Breakpoint $decimal, call6h .*$prompt $" {}
636 -re "$prompt $" { fail "continue to call6h" ; return }
637 timeout { fail "(timeout) continue to call6h" ; return }
640 send "backtrace 100\n"
643 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
644 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
645 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
646 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
647 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
648 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
649 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
650 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
651 .* main \[(\]+.*\[)\]+ .*\r
653 -re "$prompt $" { fail "backtrace from call6h" ; return }
654 timeout { fail "(timeout) backtrace from call6h" ; return }
657 # Continue; should stop at call6i and print actual arguments.
662 -re ".*Breakpoint $decimal, call6i .*$prompt $" {}
663 -re "$prompt $" { fail "continue to call6i" ; return }
664 timeout { fail "(timeout) continue to call6i" ; return }
667 send "backtrace 100\n"
670 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
671 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
672 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
673 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
674 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
675 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
676 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
677 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
678 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
679 .* main \[(\]+.*\[)\]+ .*\r
681 -re "$prompt $" { fail "backtrace from call6i" ; return }
682 timeout { fail "(timeout) backtrace from call6i" ; return }
685 # Continue; should stop at call6j and print actual arguments.
690 -re ".*Breakpoint $decimal, call6j .*$prompt $" {}
691 -re "$prompt $" { fail "continue to call6j" ; return }
692 timeout { fail "(timeout) continue to call6j" ; return }
695 send "backtrace 100\n"
698 .* call6j \[(\]+ul=8\[)\]+ .*\r
699 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
700 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
701 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
702 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
703 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
704 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
705 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
706 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
707 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
708 .* main \[(\]+.*\[)\]+ .*\r
710 -re "$prompt $" { fail "backtrace from call6j" ; return }
711 timeout { fail "(timeout) backtrace from call6j" ; return }
714 # Continue; should stop at call6k and print actual arguments.
716 # This fails on i960-*-vxworks because gdb gets confused by
717 # breakpoints on adjacent instructions.
718 setup_xfail "i960-*-vxworks" 1786
721 -re ".*Breakpoint $decimal, call6k .*$prompt $" {}
722 -re "$prompt $" { fail "continue to call6k"; return }
723 timeout { fail "(timeout) continue to call6k"; return }
726 send "backtrace 100\n"
729 .* call6k \[(\]+\[)\]+ .*\r
730 .* call6j \[(\]+ul=8\[)\]+ .*\r
731 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
732 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
733 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
734 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
735 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
736 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
737 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
738 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
739 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
740 .* main \[(\]+.*\[)\]+ .*\r
742 -re "$prompt $" { fail "backtrace from call6k" ; return }
743 timeout { fail "(timeout) backtrace from call6k" ; return }
746 pass "locate actual args, discard, shuffle, and call"
750 # Locate actual args; shuffle round robin and call
753 proc shuffle_round_robin {} {
761 send "break call7a\n" ; expect -re ".*$prompt $"
762 send "break call7b\n" ; expect -re ".*$prompt $"
763 send "break call7c\n" ; expect -re ".*$prompt $"
764 send "break call7d\n" ; expect -re ".*$prompt $"
765 send "break call7e\n" ; expect -re ".*$prompt $"
766 send "break call7f\n" ; expect -re ".*$prompt $"
767 send "break call7g\n" ; expect -re ".*$prompt $"
768 send "break call7h\n" ; expect -re ".*$prompt $"
769 send "break call7i\n" ; expect -re ".*$prompt $"
770 send "break call7j\n" ; expect -re ".*$prompt $"
771 send "break call7k\n" ; expect -re ".*$prompt $"
773 # Run; should stop at call7a and print actual arguments.
776 # The a29k fails all of these tests, perhaps because the prologue
778 setup_xfail "a29k-*-udi"
780 -re ".*Breakpoint $decimal, call7a .*$prompt $" {}
781 -re "$prompt $" { fail "run to call7a" ; return }
782 timeout { fail "(timeout) run to call7a" ; return }
787 setup_xfail "i960-*-*" 1813
788 send "backtrace 100\n"
791 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
792 .* main \[(\]+.*\[)\]+ .*\r
794 -re "$prompt $" { fail "backtrace from call7a" ; return }
795 timeout { fail "(timeout) backtrace from call7a" ; return }
798 # Continue; should stop at call7b and print actual arguments.
803 -re ".*Breakpoint $decimal, call7b .*$prompt $" {}
804 -re "$prompt $" { fail "continue to call7b" ; return }
805 timeout { fail "(timeout) continue to call7b" ; return }
808 send "backtrace 100\n"
811 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
812 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
813 .* main \[(\]+.*\[)\]+ .*\r
815 -re "$prompt $" { fail "backtrace from call7b" ; return }
816 timeout { fail "(timeout) backtrace from call7b" ; return }
819 # Continue; should stop at call7c and print actual arguments.
824 -re ".*Breakpoint $decimal, call7c .*$prompt $" {}
825 -re "$prompt $" { fail "continue to call7c" ; return }
826 timeout { fail "(timeout) continue to call7c" ; return }
829 send "backtrace 100\n"
832 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
833 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
834 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
835 .* main \[(\]+.*\[)\]+ .*\r
837 -re "$prompt $" { fail "backtrace from call7c" ; return }
838 timeout { fail "(timeout) backtrace from call7c" ; return }
841 # Continue; should stop at call7d and print actual arguments.
846 -re ".*Breakpoint $decimal, call7d .*$prompt $" {}
847 -re "$prompt $" { fail "continue to call7d" ; return }
848 timeout { fail "(timeout) continue to call7d" ; return }
851 send "backtrace 100\n"
854 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
855 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
856 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
857 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
858 .* main \[(\]+.*\[)\]+ .*\r
860 -re "$prompt $" { fail "backtrace from call7d" ; return }
861 timeout { fail "(timeout) backtrace from call7d" ; return }
864 # Continue; should stop at call7e and print actual arguments.
869 -re "Breakpoint $decimal, call7e .*$prompt $" {}
870 -re "$prompt $" { fail "continue to call7e" ; return }
871 timeout { fail "(timeout) continue to call7e" ; return }
874 send "backtrace 100\n"
877 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
878 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
879 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
880 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
881 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
882 .* main \[(\]+.*\[)\]+ .*\r
884 -re "$prompt $" { fail "backtrace from call7e" ; return }
885 timeout { fail "(timeout) backtrace from call7e" ; return }
888 # Continue; should stop at call7f and print actual arguments.
893 -re ".*Breakpoint $decimal, call7f .*$prompt $" {}
894 -re "$prompt $" { fail "continue to call7f" ; return }
895 timeout { fail "(timeout) continue to call7f" ; return }
898 send "backtrace 100\n"
901 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
902 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
903 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
904 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
905 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
906 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
907 .* main \[(\]+.*\[)\]+ .*\r
909 -re "$prompt $" { fail "backtrace from call7f" ; return }
910 timeout { fail "(timeout) backtrace from call7f" ; return }
913 # Continue; should stop at call7g and print actual arguments.
918 -re ".*Breakpoint $decimal, call7g .*$prompt $" {}
919 -re "$prompt $" { fail "continue to call7g" ; return }
920 timeout { fail "(timeout) continue to call7g" ; return }
923 send "backtrace 100\n"
926 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
927 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
928 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
929 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
930 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
931 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
932 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
933 .* main \[(\]+.*\[)\]+ .*\r
935 -re "$prompt $" { fail "backtrace from call7g" ; return }
936 timeout { fail "(timeout) backtrace from call7g" ; return }
939 # Continue; should stop at call7h and print actual arguments.
944 -re ".*Breakpoint $decimal, call7h .*$prompt $" {}
945 -re "$prompt $" { fail "continue to call7h" ; return }
946 timeout { fail "(timeout) continue to call7h" ; return }
949 send "backtrace 100\n"
952 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
953 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
954 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
955 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
956 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
957 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
958 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
959 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
960 .* main \[(\]+.*\[)\]+ .*\r
962 -re "$prompt $" { fail "backtrace from call7h" ; return }
963 timeout { fail "(timeout) backtrace from call7h" ; return }
966 # Continue; should stop at call7i and print actual arguments.
971 -re ".*Breakpoint $decimal, call7i .*$prompt $" {}
972 -re "$prompt $" { fail "continue to call7i" ; return }
973 timeout { fail "(timeout) continue to call7i" ; return }
976 send "backtrace 100\n"
979 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
980 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
981 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
982 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
983 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
984 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
985 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
986 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
987 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
988 .* main \[(\]+.*\[)\]+ .*\r
990 -re "$prompt $" { fail "backtrace from call7i" ; return }
991 timeout { fail "(timeout) backtrace from call7i" ; return }
994 # Continue; should stop at call7j and print actual arguments.
999 -re ".*Breakpoint $decimal, call7j .*$prompt $" {}
1000 -re "$prompt $" { fail "continue to call7j" ; return }
1001 timeout { fail "(timeout) continue to call7j" ; return }
1004 send "backtrace 100\n"
1006 -re "backtrace 100\r
1007 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1008 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1009 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1010 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1011 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1012 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1013 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1014 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1015 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1016 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1017 .* main \[(\]+.*\[)\]+ .*\r
1019 -re "$prompt $" { fail "backtrace from call7j" ; return }
1020 timeout { fail "(timeout) backtrace from call7j" ; return }
1023 # Continue; should stop at call7k and print actual arguments.
1028 -re ".*Breakpoint $decimal, call7k .*$prompt $" {}
1029 -re "$prompt $" { fail "continue to call7k" ; return }
1030 timeout { fail "(timeout) continue to call7k" ; return }
1033 send "backtrace 100\n"
1035 -re "backtrace 100\r
1036 .* call7k \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1037 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1038 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1039 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1040 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1041 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1042 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1043 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1044 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1045 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1046 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1047 .* main \[(\]+.*\[)\]+ .*\r
1049 -re "$prompt $" { fail "backtrace from call7k" ; return }
1050 timeout { fail "(timeout) backtrace from call7k" ; return }
1053 pass "locate actual args, shuffle round robin and call"
1057 # Locate actual args; recursive passing of structs by value
1060 proc recursive_structs_by_value {} {
1068 send "break hitbottom\n" ; expect -re ".*$prompt $"
1070 # Run; should stop at hitbottom and print actual arguments.
1073 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" {}
1074 -re "$prompt $" { fail "run to hitbottom" ; return }
1075 timeout { fail "(timeout) run to hitbottom" ; return }
1080 # The a29k fails all of these tests, perhaps because the prologue
1082 setup_xfail "a29k-*-udi"
1083 send "backtrace 100\n"
1085 -re "backtrace 100\r
1086 .* hitbottom \[(\]+\[)\]+ .*\r
1087 .* recurse \[(\]+a=\{s = 0, i = 0, l = 0\}, depth=0\[)\]+ .*\r
1088 .* recurse \[(\]+a=\{s = 1, i = 1, l = 1\}, depth=1\[)\]+ .*\r
1089 .* recurse \[(\]+a=\{s = 2, i = 2, l = 2\}, depth=2\[)\]+ .*\r
1090 .* recurse \[(\]+a=\{s = 3, i = 3, l = 3\}, depth=3\[)\]+ .*\r
1091 .* recurse \[(\]+a=\{s = 4, i = 4, l = 4\}, depth=4\[)\]+ .*\r
1092 .* test_struct_args \[(\]+\[)\]+ .*\r
1093 .* main \[(\]+.*\[)\]+ .*\r
1095 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1096 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1099 pass "locate actual args, recursive structs by value"
1102 proc funcargs_reload { } {
1108 if [istarget "mips-idt-*"] then {
1109 # Restart because IDT/SIM runs out of file descriptors.
1112 gdb_reinitialize_dir $srcdir/$subdir
1113 gdb_load $objdir/$subdir/$binfile
1118 # Test for accessing local stack variables in functions which call alloca
1120 proc localvars_after_alloca { } {
1125 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1127 # Print each arg as a double check to see if we can print
1128 # them here as well as with backtrace.
1130 gdb_test "print c" " = 97 'a'"
1131 gdb_test "print s" " = 1"
1132 gdb_test "print i" " = 2"
1133 gdb_test "print l" " = 3"
1137 -re ".*$prompt $" {}
1138 timeout { fail "next in localvars_after_alloca()" ; return }
1141 # Print each arg as a double check to see if we can print
1142 # them here as well as with backtrace.
1144 gdb_test "print c" " = 97 'a'"
1145 gdb_test "print s" " = 1"
1146 gdb_test "print i" " = 2"
1147 gdb_test "print l" " = 3"
1149 gdb_test "backtrace 8" "#0.*localvars_after_alloca \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace after alloca"
1153 # Test for accessing local stack variables, backtraces, finish,
1154 # and finally stepping into indirect calls. The point is that on the PA
1155 # these use a funky `dyncall' mechanism which GDB needs to know about.
1157 proc localvars_in_indirect_call { } {
1162 # Can not use "runto call0a" as call0a is called several times
1163 # during single run. Instead stop in a marker function and
1164 # take control from there.
1165 if { ! [ runto marker_indirect_call ] } then { return 0 }
1167 # break on the next call to call0a, then delete all the breakpoints
1168 # and start testing.
1169 gdb_test "break call0a" "Breakpoint .*"
1170 gdb_test "continue" "call0a .*"
1173 # Print each arg as a double check to see if we can print
1174 # them here as well as with backtrace.
1176 gdb_test "print c" " = 97 'a'"
1177 gdb_test "print s" " = 1"
1178 gdb_test "print i" " = 2"
1179 gdb_test "print l" " = 3"
1181 gdb_test "backtrace 8" "#0.*call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace in indirectly called function"
1184 # "finish" brings us back to main. We then will try to step through
1185 # the second indirect call.
1186 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1187 # of the first indirect call. This is due to stack adjustment instructions
1188 # after the indirect call. In these cases we will step till we hit the
1189 # second indirect call.
1194 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*First.*$prompt $" {
1198 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*Second.*$prompt $" {
1199 pass "finish from indirectly called function"
1201 default { fail "finish from indirectly called function" ; return }
1204 gdb_test "step" "call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+" \
1205 "stepping into indirectly called function"
1208 # Start with a fresh gdb.
1210 # Test for stepping into indirect calls which may have trampolines (possibly
1211 # cascaded) on both the call path and the return path.
1212 # to handle trampolines.
1214 proc test_stepping_over_trampolines { } {
1219 # Stop in a marker function and take control from there.
1220 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1222 # Cater for gdb stopping in midline, see comment for finish above.
1225 -re "marker_call_with_trampolines ..;.*$prompt $" {
1229 -re "pointer_to_call_with_trampolines.*$prompt $" {
1230 pass "finish from marker_call_with_trampolines"
1233 fail "finish from marker_call_with_trampolines"
1235 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1238 # Try to step into the target function.
1239 gdb_test "step" "call_with_trampolines \[(\]+d1=5\[)\]+" \
1240 "stepping into function called with trampolines"
1242 # Make we can backtrace and the argument looks correct. */
1243 gdb_test "backtrace 8" "#0.*call_with_trampolines \[(\]+d1=5\[)\]+.*1.*main" "backtrace through call with trampolines"
1245 # Make sure we can get back to main.
1246 # Stepping back to main might stop again after the return statement
1247 # or immediately transfer control back to main if optimizations
1251 -re "main .* at.*$prompt $" {
1252 pass "stepping back to main from function called with trampolines" ;
1255 -re "\}.*End of call_with_trampolines.*$prompt $" {
1260 fail "stepping back to main from function called with trampolines"
1262 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1266 # Start with a fresh gdb.
1270 gdb_reinitialize_dir $srcdir/$subdir
1271 gdb_load $objdir/$subdir/$binfile
1273 set oldtimeout $timeout
1278 unsigned_integral_args
1280 float_and_integral_args
1284 structs_by_reference
1292 recursive_structs_by_value
1294 localvars_after_alloca
1296 localvars_in_indirect_call
1298 test_stepping_over_trampolines
1300 catch "set timeout $oldtimeout"