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:
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 "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
63 -re ".* call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+ .*$prompt $" {}
64 -re "$prompt $" { fail "run to call0a" ; return }
65 timeout { fail "(timeout) run to call0a" ; return }
68 # Print each arg as a double check to see if we can print
69 # them here as well as with backtrace.
73 -re ".* = 97 'a'\r\n$prompt $" {}
74 -re "$prompt $" { fail "print c" ; return }
75 timeout { fail "(timeout) print c" ; return }
79 -re ".* = 1\r\n$prompt $" {}
80 -re "$prompt $" { fail "print s" ; return }
81 timeout { fail "(timeout) print s" ; return }
85 -re ".* = 2\r\n$prompt $" {}
86 -re "$prompt $" { fail "print i" ; return }
87 timeout { fail "(timeout) print i" ; return }
91 -re ".* = 3\r\n$prompt $" {}
92 -re "$prompt $" { fail "print l" ; return }
93 timeout { fail "(timeout) print l" ; return }
96 # Continue; should stop at call0b and print actual arguments.
100 -re ".* call0b \[(\]+s=1, i=2, l=3, c=97 'a'\[)\]+ .*$prompt $" {}
101 -re "$prompt $" { fail "continue to call0b" ; return }
102 timeout { fail "(timeout) continue to call0b" ; return }
105 # Continue; should stop at call0c and print actual arguments.
109 -re ".* call0c \[(\]+i=2, l=3, c=97 'a', s=1\[)\]+ .*$prompt $" {}
110 -re "$prompt $" { fail "continue to call0c" ; return }
111 timeout { fail "(timeout) continue to call0c" ; return }
114 # Continue; should stop at call0d and print actual arguments.
118 -re ".* call0d \[(\]+l=3, c=97 'a', s=1, i=2\[)\]+ .*$prompt $" {}
119 -re "$prompt $" { fail "continue to call0d" ; return }
120 timeout { fail "(timeout) continue to call0d" ; return }
123 # Continue; should stop at call0e and print actual arguments.
127 -re ".* call0e \[(\]+c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\[)\]+ .*$prompt $" {}
128 -re "$prompt $" { fail "continue to call0e" ; return }
129 timeout { fail "(timeout) continue to call0e" ; return }
132 pass "locate actual args, signed integral types"
136 # Locate actual args; unsigned integral types.
139 proc unsigned_integral_args {} {
145 send "break call1a\n" ; expect -re ".*$prompt $"
146 send "break call1b\n" ; expect -re ".*$prompt $"
147 send "break call1c\n" ; expect -re ".*$prompt $"
148 send "break call1d\n" ; expect -re ".*$prompt $"
149 send "break call1e\n" ; expect -re ".*$prompt $"
151 # Run; should stop at call1a and print actual arguments.
152 # The a29k fails all of these tests, perhaps because the prologue
154 setup_xfail "a29k-*-udi"
157 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
161 -re ".* call1a \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*$prompt $" {}
162 -re "$prompt $" { fail "run to call1a" ; return }
163 timeout { fail "(timeout) run to call1a" ; return }
166 # Print each arg as a double check to see if we can print
167 # them here as well as with backtrace.
171 -re ".* = 98 'b'\r\n$prompt $" {}
172 -re "$prompt $" { fail "print uc" ; return }
173 timeout { fail "(timeout) print uc" ; return }
177 -re ".* = 6\r\n$prompt $" {}
178 -re "$prompt $" { fail "print us" ; return }
179 timeout { fail "(timeout) print us" ; return }
183 -re ".* = 7\r\n$prompt $" {}
184 -re "$prompt $" { fail "print ui" ; return }
185 timeout { fail "(timeout) print ui" ; return }
189 -re ".* = 8\r\n$prompt $" {}
190 -re "$prompt $" { fail "print ul" ; return }
191 timeout { fail "(timeout) print ul" ; return }
194 # Continue; should stop at call1b and print actual arguments.
198 -re ".* call1b \[(\]+us=6, ui=7, ul=8, uc=98 'b'\[)\]+ .*$prompt $" {}
199 -re "$prompt $" { fail "continue to call1b" ; return }
200 timeout { fail "(timeout) continue to call1b" ; return }
203 # Continue; should stop at call1c and print actual arguments.
207 -re ".* call1c \[(\]+ui=7, ul=8, uc=98 'b', us=6\[)\]+ .*$prompt $" {}
208 -re "$prompt $" { fail "continue to call1c" ; return }
209 timeout { fail "(timeout) continue to call1c" ; return }
212 # Continue; should stop at call1d and print actual arguments.
216 -re ".* call1d \[(\]+ul=8, uc=98 'b', us=6, ui=7\[)\]+ .*$prompt $" {}
217 -re "$prompt $" { fail "continue to call1d" ; return }
218 timeout { fail "(timeout) continue to call1d" ; return }
221 # Continue; should stop at call1e and print actual arguments.
225 -re ".* call1e \[(\]+uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\[)\]+ .*$prompt $" {}
226 -re "$prompt $" { fail "continue to call1e" ; return }
227 timeout { fail "(timeout) continue to call1e" ; return }
230 pass "locate actual args, unsigned integral types"
234 # Locate actual args; integrals mixed with floating point.
237 proc float_and_integral_args {} {
243 send "break call2a\n" ; expect -re ".*$prompt $"
244 send "break call2b\n" ; expect -re ".*$prompt $"
245 send "break call2c\n" ; expect -re ".*$prompt $"
246 send "break call2d\n" ; expect -re ".*$prompt $"
247 send "break call2e\n" ; expect -re ".*$prompt $"
248 send "break call2f\n" ; expect -re ".*$prompt $"
249 send "break call2g\n" ; expect -re ".*$prompt $"
250 send "break call2h\n" ; expect -re ".*$prompt $"
251 send "break call2i\n" ; expect -re ".*$prompt $"
253 # Run; should stop at call2a and print actual arguments.
255 setup_xfail "i960-*-*" 1813
256 # The a29k fails all of these tests, perhaps because the prologue
258 setup_xfail "a29k-*-udi"
261 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
265 -re ".* call2a \[(\]+c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\[)\]+ .*$prompt $" {}
266 -re "$prompt $" { fail "run to call2a" ; return }
267 timeout { fail "(timeout) run to call2a" ; return }
270 # Print each arg as a double check to see if we can print
274 -re ".* = 97 'a'\r\n$prompt $" {}
275 -re "$prompt $" { fail "print c" ; return }
276 timeout { fail "(timeout) print c" ; return }
280 -re ".* = 4\r\n$prompt $" {}
281 -re "$prompt $" { fail "print f1" ; return }
282 timeout { fail "(timeout) print f1" ; return }
286 -re ".* = 1\r\n$prompt $" {}
287 -re "$prompt $" { fail "print s" ; return }
288 timeout { fail "(timeout) print s" ; return }
292 -re ".* = 5\r\n$prompt $" {}
293 -re "$prompt $" { fail "print d1" ; return }
294 timeout { fail "(timeout) print d1" ; return }
298 -re ".* = 2\r\n$prompt $" {}
299 -re "$prompt $" { fail "print i" ; return }
300 timeout { fail "(timeout) print i" ; return }
304 -re ".* = 4\r\n$prompt $" {}
305 -re "$prompt $" { fail "print f2" ; return }
306 timeout { fail "(timeout) print f2" ; return }
310 -re ".* = 3\r\n$prompt $" {}
311 -re "$prompt $" { fail "print l" ; return }
312 timeout { fail "(timeout) print l" ; return }
316 -re ".* = 5\r\n$prompt $" {}
317 -re "$prompt $" { fail "print d2" ; return }
318 timeout { fail "(timeout) print d2" ; return }
321 # Continue; should stop at call2b and print actual arguments.
325 -re ".* call2b \[(\]+f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\[)\]+ .*$prompt $" {}
326 -re "$prompt $" { fail "continue to call2b" ; return }
327 timeout { fail "(timeout) continue to call2b" ; return }
330 # Continue; should stop at call2c and print actual arguments.
334 -re ".* call2c \[(\]+s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\[)\]+ .*$prompt $" {}
335 -re "$prompt $" { fail "continue to call2c" ; return }
336 timeout { fail "(timeout) continue to call2c" ; return }
339 # Continue; should stop at call2d and print actual arguments.
343 -re ".* call2d \[(\]+d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\[)\]+ .*$prompt $" {}
344 -re "$prompt $" { fail "continue to call2d" ; return }
345 timeout { fail "(timeout) continue to call2d" ; return }
348 # Continue; should stop at call2e and print actual arguments.
352 -re ".* call2e \[(\]+i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\[)\]+ .*$prompt $" {}
353 -re "$prompt $" { fail "continue to call2e" ; return }
354 timeout { fail "(timeout) continue to call2e" ; return }
357 # Continue; should stop at call2f and print actual arguments.
361 -re ".* call2f \[(\]+f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\[)\]+ .*$prompt $" {}
362 -re "$prompt $" { fail "continue to call2f" ; return }
363 timeout { fail "(timeout) continue to call2f" ; return }
366 # Continue; should stop at call2g and print actual arguments.
370 -re ".* call2g \[(\]+l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\[)\]+ .*$prompt $" {}
371 -re "$prompt $" { fail "continue to call2g" ; return }
372 timeout { fail "(timeout) continue to call2g" ; return }
375 # Continue; should stop at call2h and print actual arguments.
379 -re ".* call2h \[(\]+d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\[)\]+ .*$prompt $" {}
380 -re "$prompt $" { fail "continue to call2h" ; return }
381 timeout { fail "(timeout) continue to call2h" ; return }
384 # Continue; should stop at call2i and print actual arguments.
388 -re ".* 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\[)\]+ .*$prompt $" {}
389 -re "$prompt $" { fail "continue to call2i" ; return }
390 timeout { fail "(timeout) continue to call2i" ; return }
393 pass "locate actual args, mixed integral and float types"
397 # Locate actual args; dereference pointers to ints and floats.
400 proc pointer_args {} {
407 send "break call3a\n" ; expect -re ".*$prompt $"
408 send "break call3b\n" ; expect -re ".*$prompt $"
409 send "break call3c\n" ; expect -re ".*$prompt $"
411 # Run; should stop at call3a and print actual arguments.
412 # Try dereferencing the arguments.
415 # The a29k fails all of these tests, perhaps because the prologue
417 setup_xfail "a29k-*-udi"
419 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
423 -re ".* call3a \[(\]+cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\[)\]+ .*$prompt $" {}
424 -re "$prompt $" { fail "run to call3a" ; return }
425 timeout { fail "(timeout) run to call3a" ; return }
430 -re ".* = 97 'a'\r\n$prompt $" {}
431 -re "$prompt $" { fail "print *cp" ; return }
432 timeout { fail "(timeout) print *cp" ; return }
436 -re ".* = 1\r\n$prompt $" {}
437 -re "$prompt $" { fail "print *sp" ; return }
438 timeout { fail "(timeout) print *sp" ; return }
442 -re ".* = 2\r\n$prompt $" {}
443 -re "$prompt $" { fail "print *ip" ; return }
444 timeout { fail "(timeout) print *ip" ; return }
448 -re ".* = 3\r\n$prompt $" {}
449 -re "$prompt $" { fail "print *lp" ; return }
450 timeout { fail "(timeout) print *lp" ; return }
453 # Continue; should stop at call3b and print actual arguments.
454 # Try dereferencing the arguments.
458 -re ".* call3b \[(\]+ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\[)\]+ .*$prompt $" {}
459 -re "$prompt $" { fail "continue to call3b" ; return }
460 timeout { fail "(timeout) continue to call3b" ; return }
465 -re ".* = 98 'b'\r\n$prompt $" {}
466 -re "$prompt $" { fail "print *ucp" ; return }
467 timeout { fail "(timeout) print *ucp" ; return }
471 -re ".* = 6\r\n$prompt $" {}
472 -re "$prompt $" { fail "print *usp" ; return }
473 timeout { fail "(timeout) print *usp" ; return }
477 -re ".* = 7\r\n$prompt $" {}
478 -re "$prompt $" { fail "print *uip" ; return }
479 timeout { fail "(timeout) print *uip" ; return }
483 -re ".* = 8\r\n$prompt $" {}
484 -re "$prompt $" { fail "print *ulp" ; return }
485 timeout { fail "(timeout) print *ulp" ; return }
488 # Continue; should stop at call3c and print actual arguments.
489 # Try dereferencing the arguments.
493 -re ".* call3c \[(\]+fp=$hex, dp=$hex\[)\]+ .*$prompt $" {}
494 -re "$prompt $" { fail "continue to call3c" ; return }
495 timeout { fail "(timeout) continue to call3c" ; return }
500 -re ".* = 4\r\n$prompt $" {}
501 -re "$prompt $" { fail "print *fp" ; return }
502 timeout { fail "(timeout) print *fp" ; return }
506 -re ".* = 5\r\n$prompt $" {}
507 -re "$prompt $" { fail "print *dp" ; return }
508 timeout { fail "(timeout) print *dp" ; return }
511 pass "locate actual args, pointer types"
515 # Locate actual args; structures and unions passed by reference.
518 proc structs_by_reference {} {
525 send "break call4a\n" ; expect -re ".*$prompt $"
526 send "break call4b\n" ; expect -re ".*$prompt $"
528 # Run; should stop at call4a and print actual arguments.
529 # Try dereferencing the arguments.
531 # The a29k fails all of these tests, perhaps because the prologue
533 setup_xfail "a29k-*-udi"
536 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
540 -re ".* call4a \[(\]+stp=$hex\[)\]+ .*$prompt $" {}
541 -re "$prompt $" { fail "run to call4a" ; return }
542 timeout { fail "(timeout) run to call4a" ; return }
547 -re ".* = \{s1 = 101, s2 = 102\}\r\n$prompt $" {}
548 -re "$prompt $" { fail "print *stp" ; return }
549 timeout { fail "(timeout) print *stp" ; return }
552 # Continue; should stop at call4b and print actual arguments.
553 # Try dereferencing the arguments.
557 -re ".* call4b \[(\]+unp=$hex\[)\]+ .*$prompt $" {}
558 -re "$prompt $" { fail "continue to call4b" ; return }
559 timeout { fail "(timeout) continue to call4b" ; return }
564 -re ".* = \{u1 = 1, u2 = 1\}\r\n$prompt $" {}
565 -re "$prompt $" { fail "print *unp" ; return }
566 timeout { fail "(timeout) print *unp" ; return }
569 pass "locate actual args, structs/unions passed by reference"
573 # Locate actual args; structures and unions passed by value.
576 proc structs_by_value {} {
583 send "break call5a\n" ; expect -re ".*$prompt $"
584 send "break call5b\n" ; expect -re ".*$prompt $"
586 # Run; should stop at call5a and print actual arguments.
587 # Try dereferencing the arguments.
589 # The a29k fails all of these tests, perhaps because the prologue
591 setup_xfail "a29k-*-udi"
594 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
598 -re ".* call5a \[(\]+st=\{s1 = 101, s2 = 102\}\[)\]+ .*$prompt $" {}
599 -re "$prompt $" { fail "run to call5a" ; return }
600 timeout { fail "(timeout) run to call5a" ; return }
605 -re ".* = \{s1 = 101, s2 = 102\}\r\n$prompt $" {}
606 -re "$prompt $" { fail "print st" ; return }
607 timeout { fail "(timeout) print st" ; return }
610 # Continue; should stop at call5b and print actual arguments.
611 # Try dereferencing the arguments.
615 -re ".* call5b \[(\]+un=\{u1 = 2, u2 = 2\}\[)\]+ .*$prompt $" {}
616 -re "$prompt $" { fail "continue to call5b" ; return }
617 timeout { fail "(timeout) continue to call5b" ; return }
622 -re ".* = \{u1 = 2, u2 = 2\}\r\n$prompt $" {}
623 -re "$prompt $" { fail "print un" ; return }
624 timeout { fail "(timeout) print un" ; return }
627 pass "locate actual args, structs/unions passed by value"
631 # Locate actual args; discard, shuffle, and call
634 proc discard_and_shuffle {} {
642 send "break call6a\n" ; expect -re ".*$prompt $"
643 send "break call6b\n" ; expect -re ".*$prompt $"
644 send "break call6c\n" ; expect -re ".*$prompt $"
645 send "break call6d\n" ; expect -re ".*$prompt $"
646 send "break call6e\n" ; expect -re ".*$prompt $"
647 send "break call6f\n" ; expect -re ".*$prompt $"
648 send "break call6g\n" ; expect -re ".*$prompt $"
649 send "break call6h\n" ; expect -re ".*$prompt $"
650 send "break call6i\n" ; expect -re ".*$prompt $"
651 send "break call6j\n" ; expect -re ".*$prompt $"
652 send "break call6k\n" ; expect -re ".*$prompt $"
654 # Run; should stop at call6a and print actual arguments.
657 # The a29k fails all of these tests, perhaps because the prologue
659 setup_xfail "a29k-*-udi"
662 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
666 -re ".*Breakpoint $decimal, call6a .*$prompt $" {}
667 -re "$prompt $" { fail "run to call6a" ; return }
668 timeout { fail "(timeout) run to call6a" ; return }
671 send "backtrace 100\n"
674 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
675 .* main \[(\]+.*\[)\]+ .*\r
677 -re "$prompt $" { fail "backtrace from call6a" ; return }
678 timeout { fail "(timeout) backtrace from call6a" ; return }
681 # Continue; should stop at call6b and print actual arguments.
686 -re ".*Breakpoint $decimal, call6b .*$prompt $" {}
687 -re "$prompt $" { fail "continue to call6b" ; return }
688 timeout { fail "(timeout) continue to call6b" ; return }
691 send "backtrace 100\n"
694 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
695 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
696 .* main \[(\]+.*\[)\]+ .*\r
698 -re "$prompt $" { fail "backtrace from call6b" ; return }
699 timeout { fail "(timeout) backtrace from call6b" ; return }
702 # Continue; should stop at call6c and print actual arguments.
707 -re ".*Breakpoint $decimal, call6c .*$prompt $" {}
708 -re "$prompt $" { fail "continue to call6c" ; return }
709 timeout { fail "(timeout) continue to call6c" ; return }
712 send "backtrace 100\n"
715 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
716 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
717 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
718 .* main \[(\]+.*\[)\]+ .*\r
720 -re "$prompt $" { fail "backtrace from call6c" ; return }
721 timeout { fail "(timeout) backtrace from call6c" ; return }
724 # Continue; should stop at call6d and print actual arguments.
729 -re ".*Breakpoint $decimal, call6d .*$prompt $" {}
730 -re "$prompt $" { fail "continue to call6d" ; return }
731 timeout { fail "(timeout) continue to call6d" ; return }
734 send "backtrace 100\n"
737 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
738 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
739 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
740 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
741 .* main \[(\]+.*\[)\]+ .*\r
743 -re "$prompt $" { fail "backtrace from call6d" ; return }
744 timeout { fail "(timeout) backtrace from call6d" ; return }
747 # Continue; should stop at call6e and print actual arguments.
752 -re ".*Breakpoint $decimal, call6e .*$prompt $" {}
753 -re "$prompt $" { fail "continue to call6e" ; return }
754 timeout { fail "(timeout) continue to call6e" ; return }
757 send "backtrace 100\n"
760 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
761 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
762 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
763 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
764 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
765 .* main \[(\]+.*\[)\]+ .*\r
767 -re "$prompt $" { fail "backtrace from call6e" ; return }
768 timeout { fail "(timeout) backtrace from call6e" ; return }
771 # Continue; should stop at call6f and print actual arguments.
776 -re ".*Breakpoint $decimal, call6f .*$prompt $" {}
777 -re "$prompt $" { fail "continue to call6f" ; return }
778 timeout { fail "(timeout) continue to call6f" ; return }
781 send "backtrace 100\n"
784 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
785 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
786 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
787 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
788 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
789 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
790 .* main \[(\]+.*\[)\]+ .*\r
792 -re "$prompt $" { fail "backtrace from call6f" ; return }
793 timeout { fail "(timeout) backtrace from call6f" ; return }
796 # Continue; should stop at call6g and print actual arguments.
801 -re ".*Breakpoint $decimal, call6g .*$prompt $" {}
802 -re "$prompt $" { fail "continue to call6g" ; return }
803 timeout { fail "(timeout) continue to call6g" ; return }
806 send "backtrace 100\n"
809 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
810 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
811 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
812 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
813 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
814 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
815 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
816 .* main \[(\]+.*\[)\]+ .*\r
818 -re "$prompt $" { fail "backtrace from call6g" ; return }
819 timeout { fail "(timeout) backtrace from call6g" ; return }
822 # Continue; should stop at call6h and print actual arguments.
827 -re ".*Breakpoint $decimal, call6h .*$prompt $" {}
828 -re "$prompt $" { fail "continue to call6h" ; return }
829 timeout { fail "(timeout) continue to call6h" ; return }
832 send "backtrace 100\n"
835 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
836 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
837 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
838 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
839 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
840 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
841 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
842 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
843 .* main \[(\]+.*\[)\]+ .*\r
845 -re "$prompt $" { fail "backtrace from call6h" ; return }
846 timeout { fail "(timeout) backtrace from call6h" ; return }
849 # Continue; should stop at call6i and print actual arguments.
854 -re ".*Breakpoint $decimal, call6i .*$prompt $" {}
855 -re "$prompt $" { fail "continue to call6i" ; return }
856 timeout { fail "(timeout) continue to call6i" ; return }
859 send "backtrace 100\n"
862 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
863 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
864 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
865 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
866 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
867 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
868 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
869 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
870 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
871 .* main \[(\]+.*\[)\]+ .*\r
873 -re "$prompt $" { fail "backtrace from call6i" ; return }
874 timeout { fail "(timeout) backtrace from call6i" ; return }
877 # Continue; should stop at call6j and print actual arguments.
882 -re ".*Breakpoint $decimal, call6j .*$prompt $" {}
883 -re "$prompt $" { fail "continue to call6j" ; return }
884 timeout { fail "(timeout) continue to call6j" ; return }
887 send "backtrace 100\n"
890 .* call6j \[(\]+ul=8\[)\]+ .*\r
891 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
892 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
893 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
894 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
895 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
896 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
897 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
898 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
899 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
900 .* main \[(\]+.*\[)\]+ .*\r
902 -re "$prompt $" { fail "backtrace from call6j" ; return }
903 timeout { fail "(timeout) backtrace from call6j" ; return }
906 # Continue; should stop at call6k and print actual arguments.
908 # This fails on i960-*-vxworks because gdb gets confused by
909 # breakpoints on adjacent instructions.
910 setup_xfail "i960-*-vxworks" 1786
913 -re ".*Breakpoint $decimal, call6k .*$prompt $" {}
914 -re "$prompt $" { fail "continue to call6k"; return }
915 timeout { fail "(timeout) continue to call6k"; return }
918 send "backtrace 100\n"
921 .* call6k \[(\]+\[)\]+ .*\r
922 .* call6j \[(\]+ul=8\[)\]+ .*\r
923 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
924 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
925 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
926 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
927 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
928 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
929 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
930 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
931 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
932 .* main \[(\]+.*\[)\]+ .*\r
934 -re "$prompt $" { fail "backtrace from call6k" ; return }
935 timeout { fail "(timeout) backtrace from call6k" ; return }
938 pass "locate actual args, discard, shuffle, and call"
942 # Locate actual args; shuffle round robin and call
945 proc shuffle_round_robin {} {
953 send "break call7a\n" ; expect -re ".*$prompt $"
954 send "break call7b\n" ; expect -re ".*$prompt $"
955 send "break call7c\n" ; expect -re ".*$prompt $"
956 send "break call7d\n" ; expect -re ".*$prompt $"
957 send "break call7e\n" ; expect -re ".*$prompt $"
958 send "break call7f\n" ; expect -re ".*$prompt $"
959 send "break call7g\n" ; expect -re ".*$prompt $"
960 send "break call7h\n" ; expect -re ".*$prompt $"
961 send "break call7i\n" ; expect -re ".*$prompt $"
962 send "break call7j\n" ; expect -re ".*$prompt $"
963 send "break call7k\n" ; expect -re ".*$prompt $"
965 # Run; should stop at call7a and print actual arguments.
968 # The a29k fails all of these tests, perhaps because the prologue
970 setup_xfail "a29k-*-udi"
973 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
977 -re ".*Breakpoint $decimal, call7a .*$prompt $" {}
978 -re "$prompt $" { fail "run to call7a" ; return }
979 timeout { fail "(timeout) run to call7a" ; return }
982 setup_xfail "i960-*-*" 1813
983 send "backtrace 100\n"
986 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
987 .* main \[(\]+.*\[)\]+ .*\r
989 -re "$prompt $" { fail "backtrace from call7a" ; return }
990 timeout { fail "(timeout) backtrace from call7a" ; return }
993 # Continue; should stop at call7b and print actual arguments.
998 -re ".*Breakpoint $decimal, call7b .*$prompt $" {}
999 -re "$prompt $" { fail "continue to call7b" ; return }
1000 timeout { fail "(timeout) continue to call7b" ; return }
1003 send "backtrace 100\n"
1005 -re "backtrace 100\r
1006 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1007 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1008 .* main \[(\]+.*\[)\]+ .*\r
1010 -re "$prompt $" { fail "backtrace from call7b" ; return }
1011 timeout { fail "(timeout) backtrace from call7b" ; return }
1014 # Continue; should stop at call7c and print actual arguments.
1019 -re ".*Breakpoint $decimal, call7c .*$prompt $" {}
1020 -re "$prompt $" { fail "continue to call7c" ; return }
1021 timeout { fail "(timeout) continue to call7c" ; return }
1024 send "backtrace 100\n"
1026 -re "backtrace 100\r
1027 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1028 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1029 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1030 .* main \[(\]+.*\[)\]+ .*\r
1032 -re "$prompt $" { fail "backtrace from call7c" ; return }
1033 timeout { fail "(timeout) backtrace from call7c" ; return }
1036 # Continue; should stop at call7d and print actual arguments.
1041 -re ".*Breakpoint $decimal, call7d .*$prompt $" {}
1042 -re "$prompt $" { fail "continue to call7d" ; return }
1043 timeout { fail "(timeout) continue to call7d" ; return }
1046 send "backtrace 100\n"
1048 -re "backtrace 100\r
1049 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1050 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1051 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1052 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1053 .* main \[(\]+.*\[)\]+ .*\r
1055 -re "$prompt $" { fail "backtrace from call7d" ; return }
1056 timeout { fail "(timeout) backtrace from call7d" ; return }
1059 # Continue; should stop at call7e and print actual arguments.
1064 -re "Breakpoint $decimal, call7e .*$prompt $" {}
1065 -re "$prompt $" { fail "continue to call7e" ; return }
1066 timeout { fail "(timeout) continue to call7e" ; return }
1069 send "backtrace 100\n"
1071 -re "backtrace 100\r
1072 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1073 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1074 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1075 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1076 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1077 .* main \[(\]+.*\[)\]+ .*\r
1079 -re "$prompt $" { fail "backtrace from call7e" ; return }
1080 timeout { fail "(timeout) backtrace from call7e" ; return }
1083 # Continue; should stop at call7f and print actual arguments.
1088 -re ".*Breakpoint $decimal, call7f .*$prompt $" {}
1089 -re "$prompt $" { fail "continue to call7f" ; return }
1090 timeout { fail "(timeout) continue to call7f" ; return }
1093 send "backtrace 100\n"
1095 -re "backtrace 100\r
1096 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1097 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1098 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1099 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1100 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1101 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1102 .* main \[(\]+.*\[)\]+ .*\r
1104 -re "$prompt $" { fail "backtrace from call7f" ; return }
1105 timeout { fail "(timeout) backtrace from call7f" ; return }
1108 # Continue; should stop at call7g and print actual arguments.
1113 -re ".*Breakpoint $decimal, call7g .*$prompt $" {}
1114 -re "$prompt $" { fail "continue to call7g" ; return }
1115 timeout { fail "(timeout) continue to call7g" ; return }
1118 send "backtrace 100\n"
1120 -re "backtrace 100\r
1121 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1122 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1123 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1124 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1125 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1126 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1127 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1128 .* main \[(\]+.*\[)\]+ .*\r
1130 -re "$prompt $" { fail "backtrace from call7g" ; return }
1131 timeout { fail "(timeout) backtrace from call7g" ; return }
1134 # Continue; should stop at call7h and print actual arguments.
1139 -re ".*Breakpoint $decimal, call7h .*$prompt $" {}
1140 -re "$prompt $" { fail "continue to call7h" ; return }
1141 timeout { fail "(timeout) continue to call7h" ; return }
1144 send "backtrace 100\n"
1146 -re "backtrace 100\r
1147 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1148 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1149 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1150 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1151 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1152 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1153 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1154 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1155 .* main \[(\]+.*\[)\]+ .*\r
1157 -re "$prompt $" { fail "backtrace from call7h" ; return }
1158 timeout { fail "(timeout) backtrace from call7h" ; return }
1161 # Continue; should stop at call7i and print actual arguments.
1166 -re ".*Breakpoint $decimal, call7i .*$prompt $" {}
1167 -re "$prompt $" { fail "continue to call7i" ; return }
1168 timeout { fail "(timeout) continue to call7i" ; return }
1171 send "backtrace 100\n"
1173 -re "backtrace 100\r
1174 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1175 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1176 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1177 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1178 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1179 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1180 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1181 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1182 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1183 .* main \[(\]+.*\[)\]+ .*\r
1185 -re "$prompt $" { fail "backtrace from call7i" ; return }
1186 timeout { fail "(timeout) backtrace from call7i" ; return }
1189 # Continue; should stop at call7j and print actual arguments.
1194 -re ".*Breakpoint $decimal, call7j .*$prompt $" {}
1195 -re "$prompt $" { fail "continue to call7j" ; return }
1196 timeout { fail "(timeout) continue to call7j" ; return }
1199 send "backtrace 100\n"
1201 -re "backtrace 100\r
1202 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1203 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1204 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1205 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1206 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1207 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1208 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1209 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1210 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1211 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1212 .* main \[(\]+.*\[)\]+ .*\r
1214 -re "$prompt $" { fail "backtrace from call7j" ; return }
1215 timeout { fail "(timeout) backtrace from call7j" ; return }
1218 # Continue; should stop at call7k and print actual arguments.
1223 -re ".*Breakpoint $decimal, call7k .*$prompt $" {}
1224 -re "$prompt $" { fail "continue to call7k" ; return }
1225 timeout { fail "(timeout) continue to call7k" ; return }
1228 send "backtrace 100\n"
1230 -re "backtrace 100\r
1231 .* call7k \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1232 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1233 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1234 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1235 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1236 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1237 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1238 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1239 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1240 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1241 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1242 .* main \[(\]+.*\[)\]+ .*\r
1244 -re "$prompt $" { fail "backtrace from call7k" ; return }
1245 timeout { fail "(timeout) backtrace from call7k" ; return }
1248 pass "locate actual args, shuffle round robin and call"
1252 # Locate actual args; recursive passing of structs by value
1255 proc recursive_structs_by_value {} {
1263 send "break hitbottom\n" ; expect -re ".*$prompt $"
1265 # Run; should stop at hitbottom and print actual arguments.
1270 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
1274 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" {}
1275 -re "$prompt $" { fail "run to hitbottom" ; return }
1276 timeout { fail "(timeout) run to hitbottom" ; return }
1279 # The a29k fails all of these tests, perhaps because the prologue
1281 setup_xfail "a29k-*-udi"
1282 send "backtrace 100\n"
1284 -re "backtrace 100\r
1285 .* hitbottom \[(\]+\[)\]+ .*\r
1286 .* recurse \[(\]+a=\{s = 0, i = 0, l = 0\}, depth=0\[)\]+ .*\r
1287 .* recurse \[(\]+a=\{s = 1, i = 1, l = 1\}, depth=1\[)\]+ .*\r
1288 .* recurse \[(\]+a=\{s = 2, i = 2, l = 2\}, depth=2\[)\]+ .*\r
1289 .* recurse \[(\]+a=\{s = 3, i = 3, l = 3\}, depth=3\[)\]+ .*\r
1290 .* recurse \[(\]+a=\{s = 4, i = 4, l = 4\}, depth=4\[)\]+ .*\r
1291 .* test_struct_args \[(\]+\[)\]+ .*\r
1292 .* main \[(\]+.*\[)\]+ .*\r
1294 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1295 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1298 pass "locate actual args, recursive structs by value"
1301 proc funcargs_reload { } {
1307 if [istarget "mips-idt-*"] then {
1308 # Restart because IDT/SIM runs out of file descriptors.
1311 gdb_reinitialize_dir $srcdir/$subdir
1312 gdb_load $objdir/$subdir/$binfile
1317 # Test for accessing local stack variables in functions which call alloca
1319 proc localvars_after_alloca { } {
1324 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1326 # Print each arg as a double check to see if we can print
1327 # them here as well as with backtrace.
1329 gdb_test "print c" " = 97 'a'"
1330 gdb_test "print s" " = 1"
1331 gdb_test "print i" " = 2"
1332 gdb_test "print l" " = 3"
1336 -re ".*$prompt $" {}
1337 timeout { fail "next in localvars_after_alloca()" ; return }
1340 # Print each arg as a double check to see if we can print
1341 # them here as well as with backtrace.
1343 gdb_test "print c" " = 97 'a'"
1344 gdb_test "print s" " = 1"
1345 gdb_test "print i" " = 2"
1346 gdb_test "print l" " = 3"
1348 gdb_test "backtrace 8" "#0.*localvars_after_alloca \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace after alloca"
1352 # Test for accessing local stack variables, backtraces, finish,
1353 # and finally stepping into indirect calls. The point is that on the PA
1354 # these use a funky `dyncall' mechanism which GDB needs to know about.
1356 proc localvars_in_indirect_call { } {
1361 # Can not use "runto call0a" as call0a is called several times
1362 # during single run. Instead stop in a marker function and
1363 # take control from there.
1364 if { ! [ runto marker_indirect_call ] } then { return 0 }
1366 # break on the next call to call0a, then delete all the breakpoints
1367 # and start testing.
1368 gdb_test "break call0a" "Breakpoint .*"
1369 gdb_test "continue" "call0a .*"
1372 # Print each arg as a double check to see if we can print
1373 # them here as well as with backtrace.
1375 gdb_test "print c" " = 97 'a'"
1376 gdb_test "print s" " = 1"
1377 gdb_test "print i" " = 2"
1378 gdb_test "print l" " = 3"
1380 gdb_test "backtrace 8" "#0.*call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace in indirectly called function"
1383 # "finish" brings us back to main. We then will try to step through
1384 # the second indirect call.
1385 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1386 # of the first indirect call. This is due to stack adjustment instructions
1387 # after the indirect call. In these cases we will step till we hit the
1388 # second indirect call.
1393 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*First.*$prompt $" {
1397 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*Second.*$prompt $" {
1398 pass "finish from indirectly called function"
1400 default { fail "finish from indirectly called function" ; return }
1403 gdb_test "step" "call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+" \
1404 "stepping into indirectly called function"
1407 # Start with a fresh gdb.
1409 # Test for stepping into indirect calls which may have trampolines (possibly
1410 # cascaded) on both the call path and the return path.
1411 # to handle trampolines.
1413 proc test_stepping_over_trampolines { } {
1418 # Stop in a marker function and take control from there.
1419 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1421 # Cater for gdb stopping in midline, see comment for finish above.
1424 -re "marker_call_with_trampolines ..;.*$prompt $" {
1428 -re "pointer_to_call_with_trampolines.*$prompt $" {
1429 pass "finish from marker_call_with_trampolines"
1432 fail "finish from marker_call_with_trampolines"
1434 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1437 # Try to step into the target function.
1438 gdb_test "step" "call_with_trampolines \[(\]+d1=5\[)\]+" \
1439 "stepping into function called with trampolines"
1441 # Make we can backtrace and the argument looks correct. */
1442 gdb_test "backtrace 8" "#0.*call_with_trampolines \[(\]+d1=5\[)\]+.*1.*main" "backtrace through call with trampolines"
1444 # Make sure we can get back to main.
1445 # Stepping back to main might stop again after the return statement
1446 # or immediately transfer control back to main if optimizations
1450 -re "main .* at.*$prompt $" {
1451 pass "stepping back to main from function called with trampolines" ;
1454 -re "\}.*End of call_with_trampolines.*$prompt $" {
1459 fail "stepping back to main from function called with trampolines"
1461 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1465 # Start with a fresh gdb.
1469 gdb_reinitialize_dir $srcdir/$subdir
1470 gdb_load $objdir/$subdir/$binfile
1472 set oldtimeout $timeout
1477 unsigned_integral_args
1479 float_and_integral_args
1483 structs_by_reference
1491 recursive_structs_by_value
1493 localvars_after_alloca
1495 localvars_in_indirect_call
1497 test_stepping_over_trampolines
1499 catch "set timeout $oldtimeout"