1 # Copyright (C) 1992, 1994, 1995 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 {} {
48 send "break call0a\n" ; expect -re ".*$prompt $"
49 send "break call0b\n" ; expect -re ".*$prompt $"
50 send "break call0c\n" ; expect -re ".*$prompt $"
51 send "break call0d\n" ; expect -re ".*$prompt $"
52 send "break call0e\n" ; expect -re ".*$prompt $"
54 # Run; should stop at call0a and print actual arguments.
55 # The a29k fails all of these tests, perhaps because the prologue
57 setup_xfail "a29k-*-udi"
58 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
61 -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.
70 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
71 gdb_test "print s" ".* = 1" "print s after run to call0a"
72 gdb_test "print i" ".* = 2" "print i after run to call0a"
73 gdb_test "print l " ".* = 3" "print l after run to call0a"
75 # Continue; should stop at call0b and print actual arguments.
76 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
80 # Continue; should stop at call0c and print actual arguments.
81 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
85 # Continue; should stop at call0d and print actual arguments.
86 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
90 # Continue; should stop at call0e and print actual arguments.
91 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'\\) .*" "continue to call0e" ] {
97 # Locate actual args; unsigned integral types.
100 proc unsigned_integral_args {} {
107 send "break call1a\n" ; expect -re ".*$prompt $"
108 send "break call1b\n" ; expect -re ".*$prompt $"
109 send "break call1c\n" ; expect -re ".*$prompt $"
110 send "break call1d\n" ; expect -re ".*$prompt $"
111 send "break call1e\n" ; expect -re ".*$prompt $"
113 # Run; should stop at call1a and print actual arguments.
114 # The a29k fails all of these tests, perhaps because the prologue
116 setup_xfail "a29k-*-udi"
117 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
120 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" {
123 -re "$prompt $" { fail "run to call1a" ; return }
124 timeout { fail "(timeout) run to call1a" ; return }
127 # Print each arg as a double check to see if we can print
128 # them here as well as with backtrace.
129 gdb_test "print uc" ".* = 98 'b'"
130 gdb_test "print us" ".* = 6"
131 gdb_test "print ui" ".* = 7"
132 gdb_test "print ul" ".* = 8"
134 # Continue; should stop at call1b and print actual arguments.
135 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
139 # Continue; should stop at call1c and print actual arguments.
140 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
144 # Continue; should stop at call1d and print actual arguments.
145 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
149 # Continue; should stop at call1e and print actual arguments.
150 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'\\) .*" "continue to call1e"] {
156 # Locate actual args; integrals mixed with floating point.
159 proc float_and_integral_args {} {
166 send "break call2a\n" ; expect -re ".*$prompt $"
167 send "break call2b\n" ; expect -re ".*$prompt $"
168 send "break call2c\n" ; expect -re ".*$prompt $"
169 send "break call2d\n" ; expect -re ".*$prompt $"
170 send "break call2e\n" ; expect -re ".*$prompt $"
171 send "break call2f\n" ; expect -re ".*$prompt $"
172 send "break call2g\n" ; expect -re ".*$prompt $"
173 send "break call2h\n" ; expect -re ".*$prompt $"
175 # Run; should stop at call2a and print actual arguments.
177 setup_xfail "i960-*-*" 1813
178 # The a29k fails all of these tests, perhaps because the prologue
180 setup_xfail "a29k-*-udi"
181 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
184 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
185 -re "$prompt $" { fail "run to call2a" ; return }
186 timeout { fail "(timeout) run to call2a" ; return }
189 # Print each arg as a double check to see if we can print
190 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
191 setup_xfail "sparc-sun-solaris2*"
192 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
193 gdb_test "print s" ".* = 1" "print s after run to call2a"
194 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
195 gdb_test "print i" ".* = 2" "print i after run to call2a"
196 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
197 gdb_test "print l" ".* = 3" "print l after run to call2a"
198 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
200 setup_xfail "rs6000-*-*"
201 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
202 # Continue; should stop at call2b and print actual arguments.
203 if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] {
207 # Continue; should stop at call2c and print actual arguments.
208 if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] {
212 # Continue; should stop at call2d and print actual arguments.
213 if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] {
217 # Continue; should stop at call2e and print actual arguments.
218 if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] {
222 # Continue; should stop at call2f and print actual arguments.
223 if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] {
227 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
228 # Continue; should stop at call2g and print actual arguments.
229 if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] {
233 # Continue; should stop at call2h and print actual arguments.
234 if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] {
238 # monitor only allows 8 breakpoints; w89k board allows 10, so
239 # break them up into two groups.
241 send "break call2i\n" ; expect -re ".*$prompt $"
243 # Continue; should stop at call2i and print actual arguments.
244 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\\) .*" "continue to call2i"] {
250 # Locate actual args; dereference pointers to ints and floats.
253 proc pointer_args {} {
260 send "break call3a\n" ; expect -re ".*$prompt $"
261 send "break call3b\n" ; expect -re ".*$prompt $"
262 send "break call3c\n" ; expect -re ".*$prompt $"
264 # Run; should stop at call3a and print actual arguments.
265 # Try dereferencing the arguments.
267 # The a29k fails all of these tests, perhaps because the prologue
269 setup_xfail "a29k-*-udi"
272 -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
273 -re "$prompt $" { fail "run to call3a" ; return }
274 timeout { fail "(timeout) run to call3a" ; return }
277 gdb_test "print *cp" ".* = 97 'a'"
278 gdb_test "print *sp" ".* = 1"
279 gdb_test "print *ip" ".* = 2"
280 gdb_test "print *lp" ".* = 3"
282 # Continue; should stop at call3b and print actual arguments.
283 # Try dereferencing the arguments.
284 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
288 gdb_test "print *ucp" ".* = 98 'b'"
289 gdb_test "print *usp" ".* = 6"
290 gdb_test "print *uip" ".* = 7"
291 gdb_test "print *ulp" ".* = 8"
293 # Continue; should stop at call3c and print actual arguments.
294 # Try dereferencing the arguments.
295 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
299 gdb_test "print *fp" ".* = 4"
300 gdb_test "print *dp" ".* = 5"
302 pass "locate actual args, pointer types"
306 # Locate actual args; structures and unions passed by reference.
309 proc structs_by_reference {} {
316 send "break call4a\n" ; expect -re ".*$prompt $"
317 send "break call4b\n" ; expect -re ".*$prompt $"
319 # Run; should stop at call4a and print actual arguments.
320 # Try dereferencing the arguments.
322 # The a29k fails all of these tests, perhaps because the prologue
324 setup_xfail "a29k-*-udi"
327 -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
330 -re "$prompt $" { fail "run to call4a" ; return }
331 timeout { fail "(timeout) run to call4a" ; return }
334 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
336 # Continue; should stop at call4b and print actual arguments.
337 # Try dereferencing the arguments.
339 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
341 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
343 pass "locate actual args, structs/unions passed by reference"
347 # Locate actual args; structures and unions passed by value.
350 proc structs_by_value {} {
357 send "break call5a\n" ; expect -re ".*$prompt $"
358 send "break call5b\n" ; expect -re ".*$prompt $"
360 # Run; should stop at call5a and print actual arguments.
361 # Try dereferencing the arguments.
363 # The a29k fails all of these tests, perhaps because the prologue
365 setup_xfail "a29k-*-udi"
368 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
371 -re "$prompt $" { fail "run to call5a" ; return }
372 timeout { fail "(timeout) run to call5a" ; return }
375 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
377 # Continue; should stop at call5b and print actual arguments.
378 # Try dereferencing the arguments.
379 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
382 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
386 # Locate actual args; discard, shuffle, and call
389 proc discard_and_shuffle {} {
398 send "break call6a\n" ; expect -re ".*$prompt $"
399 send "break call6b\n" ; expect -re ".*$prompt $"
400 send "break call6c\n" ; expect -re ".*$prompt $"
401 send "break call6d\n" ; expect -re ".*$prompt $"
402 send "break call6e\n" ; expect -re ".*$prompt $"
403 send "break call6f\n" ; expect -re ".*$prompt $"
404 send "break call6g\n" ; expect -re ".*$prompt $"
405 send "break call6h\n" ; expect -re ".*$prompt $"
407 # Run; should stop at call6a and print actual arguments.
410 # The a29k fails all of these tests, perhaps because the prologue
412 setup_xfail "a29k-*-udi"
415 -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
416 -re "$prompt $" { fail "run to call6a" ; return }
417 timeout { fail "(timeout) run to call6a" ; return }
420 setup_xfail "rs6000-*-*"
421 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
422 send "backtrace 100\n"
424 -re "backtrace 100\[\r\n\]+
425 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
426 .* main \\(.*\\) .*\r
427 $prompt $" { pass "backtrace from call6a" }
428 -re "$prompt $" { fail "backtrace from call6a" ; return }
429 timeout { fail "(timeout) backtrace from call6a" ; return }
432 # Continue; should stop at call6b and print actual arguments.
437 -re ".*Breakpoint $decimal, call6b .*$prompt $" { pass "continue to call6b" }
438 -re "$prompt $" { fail "continue to call6b" ; return }
439 timeout { fail "(timeout) continue to call6b" ; return }
442 send "backtrace 100\n"
444 -re "backtrace 100\[\r\n]+
445 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
446 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
447 .* main \\(.*\\) .*\r
448 $prompt $" { pass "backtrace from call6b" }
449 -re "$prompt $" { fail "backtrace from call6b" ; return }
450 timeout { fail "(timeout) backtrace from call6b" ; return }
453 # Continue; should stop at call6c and print actual arguments.
458 -re ".*Breakpoint $decimal, call6c .*$prompt $" { pass "continue to call6c" }
459 -re "$prompt $" { fail "continue to call6c" ; return }
460 timeout { fail "(timeout) continue to call6c" ; return }
463 send "backtrace 100\n"
465 -re "backtrace 100\[\r\n\]+
466 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
467 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
468 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
469 .* main \\(.*\\) .*\r
470 $prompt $" { pass "backtrace from call6c" }
471 -re "$prompt $" { fail "backtrace from call6c" ; return }
472 timeout { fail "(timeout) backtrace from call6c" ; return }
475 # Continue; should stop at call6d and print actual arguments.
480 -re ".*Breakpoint $decimal, call6d .*$prompt $" { pass "continue to call6d" }
481 -re "$prompt $" { fail "continue to call6d" ; return }
482 timeout { fail "(timeout) continue to call6d" ; return }
485 send "backtrace 100\n"
487 -re "backtrace 100\[\r\n\]+
488 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
489 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
490 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
491 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
492 .* main \\(.*\\) .*\r
493 $prompt $" { pass "backtrace from call6d" }
494 -re "$prompt $" { fail "backtrace from call6d" ; return }
495 timeout { fail "(timeout) backtrace from call6d" ; return }
498 # Continue; should stop at call6e and print actual arguments.
503 -re ".*Breakpoint $decimal, call6e .*$prompt $" { pass "continue to call6e" }
504 -re "$prompt $" { fail "continue to call6e" ; return }
505 timeout { fail "(timeout) continue to call6e" ; return }
508 send "backtrace 100\n"
510 -re "backtrace 100\[\r\n\]+
511 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
512 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
513 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
514 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
515 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
516 .* main \\(.*\\) .*\r
517 $prompt $" { pass "backtrace from call6e" }
518 -re "$prompt $" { fail "backtrace from call6e" ; return }
519 timeout { fail "(timeout) backtrace from call6e" ; return }
522 # Continue; should stop at call6f and print actual arguments.
527 -re ".*Breakpoint $decimal, call6f .*$prompt $" { pass "continue to call6f" }
528 -re "$prompt $" { fail "continue to call6f" ; return }
529 timeout { fail "(timeout) continue to call6f" ; return }
532 send "backtrace 100\n"
534 -re "backtrace 100\[\r\n\]+
535 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
536 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
537 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
538 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
539 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
540 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
541 .* main \\(.*\\) .*\r
542 $prompt $" { pass "backtrace from call6f" }
543 -re "$prompt $" { fail "backtrace from call6f" ; return }
544 timeout { fail "(timeout) backtrace from call6f" ; return }
547 # Continue; should stop at call6g and print actual arguments.
552 -re ".*Breakpoint $decimal, call6g .*$prompt $" { pass "continue to call6g" }
553 -re "$prompt $" { fail "continue to call6g" ; return }
554 timeout { fail "(timeout) continue to call6g" ; return }
557 send "backtrace 100\n"
559 -re "backtrace 100\[\r\n\]+
560 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
561 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
562 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
563 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
564 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
565 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
566 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
567 .* main \\(.*\\) .*\r
568 $prompt $" { pass "backtrace from call6g" }
569 -re "$prompt $" { fail "backtrace from call6g" ; return }
570 timeout { fail "(timeout) backtrace from call6g" ; return }
573 # Continue; should stop at call6h and print actual arguments.
578 -re ".*Breakpoint $decimal, call6h .*$prompt $" { pass "continue to call6h" }
579 -re "$prompt $" { fail "continue to call6h" ; return }
580 timeout { fail "(timeout) continue to call6h" ; return }
583 send "backtrace 100\n"
585 -re "backtrace 100\[\r\n\]+
586 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
587 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
588 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
589 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
590 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
591 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
592 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
593 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
594 .* main \\(.*\\) .*\r
595 $prompt $" { pass "backtrace from call6h" }
596 -re "$prompt $" { fail "backtrace from call6h" ; return }
597 timeout { fail "(timeout) backtrace from call6h" ; return }
600 # monitor only allows 8 breakpoints; w89k board allows 10, so
601 # break them up into two groups.
603 send "break call6i\n" ; expect -re ".*$prompt $"
604 send "break call6j\n" ; expect -re ".*$prompt $"
605 send "break call6k\n" ; expect -re ".*$prompt $"
607 # Continue; should stop at call6i and print actual arguments.
612 -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
613 -re "$prompt $" { fail "continue to call6i" ; return }
614 timeout { fail "(timeout) continue to call6i" ; return }
617 send "backtrace 100\n"
619 -re "backtrace 100\[\r\n\]+
620 .* call6i \\(ui=7, ul=8\\) .*\r
621 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
622 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
623 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
624 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
625 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
626 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
627 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
628 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
629 .* main \\(.*\\) .*\r
630 $prompt $" { pass "backtrace from call6i" }
631 -re "$prompt $" { fail "backtrace from call6i" ; return }
632 timeout { fail "(timeout) backtrace from call6i" ; return }
635 # Continue; should stop at call6j and print actual arguments.
640 -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
641 -re "$prompt $" { fail "continue to call6j" ; return }
642 timeout { fail "(timeout) continue to call6j" ; return }
645 send "backtrace 100\n"
647 -re "backtrace 100\[\r\n\]+
648 .* call6j \\(ul=8\\) .*\r
649 .* call6i \\(ui=7, ul=8\\) .*\r
650 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
651 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
652 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
653 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
654 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
655 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
656 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
657 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
658 .* main \\(.*\\) .*\r
659 $prompt $" { pass "backtrace from call6j" }
660 -re "$prompt $" { fail "backtrace from call6j" ; return }
661 timeout { fail "(timeout) backtrace from call6j" ; return }
664 # Continue; should stop at call6k and print actual arguments.
666 # This fails on i960-*-vxworks because gdb gets confused by
667 # breakpoints on adjacent instructions.
668 setup_xfail "i960-*-vxworks" 1786
671 -re ".*Breakpoint $decimal, call6k .*$prompt $" {
672 pass "continue to call6k"
674 -re "$prompt $" { fail "continue to call6k"; return }
675 timeout { fail "(timeout) continue to call6k"; return }
678 send "backtrace 100\n"
680 -re "backtrace 100\[\r\n\]+
681 .* call6k \\(\\) .*\r
682 .* call6j \\(ul=8\\) .*\r
683 .* call6i \\(ui=7, ul=8\\) .*\r
684 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
685 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
686 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
687 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
688 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
689 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
690 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
691 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
692 .* main \\(.*\\) .*\r
693 $prompt $" { pass "backtrace from call6k" }
694 -re "$prompt $" { fail "backtrace from call6k" ; return }
695 timeout { fail "(timeout) backtrace from call6k" ; return }
700 # Locate actual args; shuffle round robin and call
703 proc shuffle_round_robin {} {
712 send "break call7a\n" ; expect -re ".*$prompt $"
713 send "break call7b\n" ; expect -re ".*$prompt $"
714 send "break call7c\n" ; expect -re ".*$prompt $"
715 send "break call7d\n" ; expect -re ".*$prompt $"
716 send "break call7e\n" ; expect -re ".*$prompt $"
717 send "break call7f\n" ; expect -re ".*$prompt $"
718 send "break call7g\n" ; expect -re ".*$prompt $"
719 send "break call7h\n" ; expect -re ".*$prompt $"
721 # Run; should stop at call7a and print actual arguments.
724 # The a29k fails all of these tests, perhaps because the prologue
726 setup_xfail "a29k-*-udi"
729 -re ".*Breakpoint $decimal, call7a .*$prompt $" {
732 -re "$prompt $" { fail "run to call7a" ; return }
733 timeout { fail "(timeout) run to call7a" ; return }
736 setup_xfail "i960-*-*" 1813
737 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
738 send "backtrace 100\n"
740 -re "backtrace 100\[\r\n\]+
741 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
742 .* main \\(.*\\) .*\r
743 $prompt $" { pass "backtrace from call7a" }
744 -re "$prompt $" { fail "backtrace from call7a" ; return }
745 timeout { fail "(timeout) backtrace from call7a" ; return }
748 # Continue; should stop at call7b and print actual arguments.
753 -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
754 -re "$prompt $" { fail "continue to call7b" ; return }
755 timeout { fail "(timeout) continue to call7b" ; return }
758 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
759 send "backtrace 100\n"
761 -re "backtrace 100\[\r\n\]+
762 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
763 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
764 .* main \\(.*\\) .*\r
765 $prompt $" { pass "backtrace from call7b" }
766 -re "$prompt $" { fail "backtrace from call7b" ; return }
767 timeout { fail "(timeout) backtrace from call7b" ; return }
770 # Continue; should stop at call7c and print actual arguments.
775 -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
776 -re "$prompt $" { fail "continue to call7c" ; return }
777 timeout { fail "(timeout) continue to call7c" ; return }
780 send "backtrace 100\n"
782 -re "backtrace 100\[\r\n\]+
783 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
784 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
785 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
786 .* main \\(.*\\) .*\r
787 $prompt $" { pass "backtrace from call7c" }
788 -re "$prompt $" { fail "backtrace from call7c" ; return }
789 timeout { fail "(timeout) backtrace from call7c" ; return }
792 # Continue; should stop at call7d and print actual arguments.
797 -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
798 -re "$prompt $" { fail "continue to call7d" ; return }
799 timeout { fail "(timeout) continue to call7d" ; return }
802 send "backtrace 100\n"
804 -re "backtrace 100\[\r\n\]+
805 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
806 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
807 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
808 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
809 .* main \\(.*\\) .*\r
810 $prompt $" { pass "backtrace from call7d" }
811 -re "$prompt $" { fail "backtrace from call7d" ; return }
812 timeout { fail "(timeout) backtrace from call7d" ; return }
815 # Continue; should stop at call7e and print actual arguments.
820 -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
821 -re "$prompt $" { fail "continue to call7e" ; return }
822 timeout { fail "(timeout) continue to call7e" ; return }
825 send "backtrace 100\n"
827 -re "backtrace 100\[\r\n\]+
828 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
829 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
830 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
831 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
832 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
833 .* main \\(.*\\) .*\r
834 $prompt $" { pass "backtrace from call7e" }
835 -re "$prompt $" { fail "backtrace from call7e" ; return }
836 timeout { fail "(timeout) backtrace from call7e" ; return }
839 # Continue; should stop at call7f and print actual arguments.
844 -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
845 -re "$prompt $" { fail "continue to call7f" ; return }
846 timeout { fail "(timeout) continue to call7f" ; return }
849 send "backtrace 100\n"
851 -re "backtrace 100\[\r\n\]+
852 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
853 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
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
859 $prompt $" { pass "backtrace from call7f" }
860 -re "$prompt $" { fail "backtrace from call7f" ; return }
861 timeout { fail "(timeout) backtrace from call7f" ; return }
864 # Continue; should stop at call7g and print actual arguments.
869 -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
870 -re "$prompt $" { fail "continue to call7g" ; return }
871 timeout { fail "(timeout) continue to call7g" ; return }
874 send "backtrace 100\n"
876 -re "backtrace 100\[\r\n\]+
877 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
878 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
879 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
880 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
881 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
882 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
883 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
884 .* main \\(.*\\) .*\r
885 $prompt $" { pass "backtrace from call7g" }
886 -re "$prompt $" { fail "backtrace from call7g" ; return }
887 timeout { fail "(timeout) backtrace from call7g" ; return }
890 # Continue; should stop at call7h and print actual arguments.
895 -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
896 -re "$prompt $" { fail "continue to call7h" ; return }
897 timeout { fail "(timeout) continue to call7h" ; return }
900 send "backtrace 100\n"
902 -re "backtrace 100\[\r\n\]+
903 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
904 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
905 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
906 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
907 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
908 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
909 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
910 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
911 .* main \\(.*\\) .*\r
912 $prompt $" { pass "backtrace from call7h" }
913 -re "$prompt $" { fail "backtrace from call7h" ; return }
914 timeout { fail "(timeout) backtrace from call7h" ; return }
917 # monitor only allows 8 breakpoints; w89k board allows 10, so
918 # break them up into two groups.
920 send "break call7i\n" ; expect -re ".*$prompt $"
921 send "break call7j\n" ; expect -re ".*$prompt $"
922 send "break call7k\n" ; expect -re ".*$prompt $"
924 # Continue; should stop at call7i and print actual arguments.
929 -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
930 -re "$prompt $" { fail "continue to call7i" ; return }
931 timeout { fail "(timeout) continue to call7i" ; return }
934 send "backtrace 100\n"
936 -re "backtrace 100\[\r\n\]+
937 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
938 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
939 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
940 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
941 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
942 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
943 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
944 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
945 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
946 .* main \\(.*\\) .*\r
947 $prompt $" { pass "backtrace from call7i" }
948 -re "$prompt $" { fail "backtrace from call7i" ; return }
949 timeout { fail "(timeout) backtrace from call7i" ; return }
952 # Continue; should stop at call7j and print actual arguments.
957 -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
958 -re "$prompt $" { fail "continue to call7j" ; return }
959 timeout { fail "(timeout) continue to call7j" ; return }
962 send "backtrace 100\n"
964 -re "backtrace 100\[\r\n\]+
965 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
966 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
967 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
968 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
969 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
970 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
971 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
972 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
973 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
974 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
975 .* main \\(.*\\) .*\r
976 $prompt $" { pass "backtrace from call7j" }
977 -re "$prompt $" { fail "backtrace from call7j" ; return }
978 timeout { fail "(timeout) backtrace from call7j" ; return }
981 # Continue; should stop at call7k and print actual arguments.
986 -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
987 -re "$prompt $" { fail "continue to call7k" ; return }
988 timeout { fail "(timeout) continue to call7k" ; return }
991 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
992 send "backtrace 100\n"
994 -re "backtrace 100\[\r\n\]+
995 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
996 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
997 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
998 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
999 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
1000 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
1001 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
1002 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
1003 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
1004 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
1005 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
1006 .* main \\(.*\\) .*\r
1007 $prompt $" { pass "backtrace from call7k" }
1008 -re "$prompt $" { fail "backtrace from call7k" ; return }
1009 timeout { fail "(timeout) backtrace from call7k" ; return }
1014 # Locate actual args; recursive passing of structs by value
1017 proc recursive_structs_by_value {} {
1025 send "break hitbottom\n" ; expect -re ".*$prompt $"
1027 # Run; should stop at hitbottom and print actual arguments.
1031 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
1032 -re "$prompt $" { fail "run to hitbottom" ; return }
1033 timeout { fail "(timeout) run to hitbottom" ; return }
1036 # The a29k fails all of these tests, perhaps because the prologue
1038 setup_xfail "a29k-*-udi"
1039 send "backtrace 100\n"
1041 -re "backtrace 100\[\r\n\]+
1042 .* hitbottom \\(\\) .*\r
1043 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
1044 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
1045 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
1046 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
1047 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
1048 .* test_struct_args \\(\\) .*\r
1049 .* main \\(.*\\) .*\r
1050 $prompt $" { pass "recursive passing of structs by value" }
1051 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1052 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1056 proc funcargs_reload { } {
1062 if [istarget "mips-idt-*"] then {
1063 # Restart because IDT/SIM runs out of file descriptors.
1066 gdb_reinitialize_dir $srcdir/$subdir
1067 gdb_load $objdir/$subdir/$binfile
1072 # Test for accessing local stack variables in functions which call alloca
1074 proc localvars_after_alloca { } {
1080 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1082 # Print each arg as a double check to see if we can print
1083 # them here as well as with backtrace.
1085 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1086 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1087 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1088 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1089 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1090 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1094 -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
1095 timeout { fail "next in localvars_after_alloca()" ; return }
1098 # Print each arg as a double check to see if we can print
1099 # them here as well as with backtrace.
1101 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1102 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1103 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1104 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1106 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1109 proc call_after_alloca { } {
1115 if { ! [ runto call_after_alloca_subr ] } then { return 0 }
1117 # Print each arg as a double check to see if we can print
1118 # them here as well as with backtrace.
1120 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1121 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1122 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1123 gdb_test "print s" " = 1" "print s in call_after_alloca"
1124 gdb_test "print i" " = 2" "print i in call_after_alloca"
1125 gdb_test "print l" " = 3" "print l in call_after_alloca"
1127 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1128 gdb_test "backtrace 8" "#0.*call_after_alloca_subr \\(c=97 'a', s=1, i=2, l=3, uc=98 'b', us=11, ui=12, ul=13\\).*#1.*call_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#2.*main.*" "backtrace from call_after_alloca_subr"
1132 # Test for accessing local stack variables, backtraces, finish,
1133 # and finally stepping into indirect calls. The point is that on the PA
1134 # these use a funky `dyncall' mechanism which GDB needs to know about.
1136 proc localvars_in_indirect_call { } {
1142 # Can not use "runto call0a" as call0a is called several times
1143 # during single run. Instead stop in a marker function and
1144 # take control from there.
1145 if { ! [ runto marker_indirect_call ] } then { return 0 }
1147 # break on the next call to call0a, then delete all the breakpoints
1148 # and start testing.
1149 gdb_test "break call0a" "Breakpoint .*" \
1150 "break call0a in localvars_in_indirect_call"
1151 gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
1154 # Print each arg as a double check to see if we can print
1155 # them here as well as with backtrace.
1157 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1158 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1159 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1160 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1161 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1162 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1164 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1165 gdb_test "backtrace 8" \
1166 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1167 "backtrace in indirectly called function"
1170 # "finish" brings us back to main. We then will try to step through
1171 # the second indirect call.
1172 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1173 # of the first indirect call. This is due to stack adjustment instructions
1174 # after the indirect call. In these cases we will step till we hit the
1175 # second indirect call.
1180 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
1184 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
1185 pass "finish from indirectly called function"
1188 fail "finish from indirectly called function"
1191 default { fail "finish from indirectly called function" ; return }
1194 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1195 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1196 "stepping into indirectly called function"
1199 # Start with a fresh gdb.
1201 # Test for stepping into indirect calls which may have trampolines (possibly
1202 # cascaded) on both the call path and the return path.
1203 # to handle trampolines.
1205 proc test_stepping_over_trampolines { } {
1210 # Stop in a marker function and take control from there.
1211 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1213 # Cater for gdb stopping in midline, see comment for finish above.
1216 -re "marker_call_with_trampolines ..;.*$prompt $" {
1220 -re "pointer_to_call_with_trampolines.*$prompt $" {
1221 pass "finish from marker_call_with_trampolines"
1224 fail "finish from marker_call_with_trampolines"
1226 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1229 # Try to step into the target function.
1230 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1231 "stepping into function called with trampolines"
1233 # Make we can backtrace and the argument looks correct. */
1234 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1235 "backtrace through call with trampolines"
1237 # Make sure we can get back to main.
1238 # Stepping back to main might stop again after the return statement
1239 # or immediately transfer control back to main if optimizations
1243 -re "main .* at.*$prompt $" {
1244 pass "stepping back to main from function called with trampolines" ;
1247 -re "\}.*End of call_with_trampolines.*$prompt $" {
1252 fail "stepping back to main from function called with trampolines"
1254 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1258 # Start with a fresh gdb.
1262 gdb_reinitialize_dir $srcdir/$subdir
1263 gdb_load $objdir/$subdir/$binfile
1265 source gdb.base/funcargs.ci
1269 unsigned_integral_args
1271 float_and_integral_args
1275 structs_by_reference
1283 recursive_structs_by_value
1285 localvars_after_alloca
1289 localvars_in_indirect_call
1291 test_stepping_over_trampolines