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 testfile "funcargs"
30 set srcfile ${srcdir}/$subdir/${testfile}.c
31 set binfile ${objdir}/${subdir}/${testfile}
32 if { [compile "${srcfile} -g -o ${binfile}"] != "" } {
33 perror "Couldn't compile ${srcfile}"
37 execute_anywhere "rm -f ${binfile}.ci"
38 if { [compile "-E ${srcdir}/${subdir}/compiler.c > ${binfile}.ci"] != "" } {
39 perror "Couldn't make ${testfile}.ci file"
44 # Locate actual args; integral types.
47 proc integral_args {} {
54 send "break call0a\n" ; expect -re ".*$prompt $"
55 send "break call0b\n" ; expect -re ".*$prompt $"
56 send "break call0c\n" ; expect -re ".*$prompt $"
57 send "break call0d\n" ; expect -re ".*$prompt $"
58 send "break call0e\n" ; expect -re ".*$prompt $"
60 # Run; should stop at call0a and print actual arguments.
61 # The a29k fails all of these tests, perhaps because the prologue
63 setup_xfail "a29k-*-udi"
64 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
67 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$prompt $" {
70 -re "$prompt $" { fail "run to call0a" ; return }
71 timeout { fail "(timeout) run to call0a" ; return }
74 # Print each arg as a double check to see if we can print
75 # them here as well as with backtrace.
76 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
77 gdb_test "print s" ".* = 1" "print s after run to call0a"
78 gdb_test "print i" ".* = 2" "print i after run to call0a"
79 gdb_test "print l " ".* = 3" "print l after run to call0a"
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'\\) .*" "continue to call0b"] {
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\\) .*" "continue to call0c"] {
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\\) .*" "continue to call0d";] {
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'\\) .*" "continue to call0e" ] {
103 # Locate actual args; unsigned integral types.
106 proc unsigned_integral_args {} {
113 send "break call1a\n" ; expect -re ".*$prompt $"
114 send "break call1b\n" ; expect -re ".*$prompt $"
115 send "break call1c\n" ; expect -re ".*$prompt $"
116 send "break call1d\n" ; expect -re ".*$prompt $"
117 send "break call1e\n" ; expect -re ".*$prompt $"
119 # Run; should stop at call1a and print actual arguments.
120 # The a29k fails all of these tests, perhaps because the prologue
122 setup_xfail "a29k-*-udi"
123 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
126 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" {
129 -re "$prompt $" { fail "run to call1a" ; return }
130 timeout { fail "(timeout) run to call1a" ; return }
133 # Print each arg as a double check to see if we can print
134 # them here as well as with backtrace.
135 gdb_test "print uc" ".* = 98 'b'"
136 gdb_test "print us" ".* = 6"
137 gdb_test "print ui" ".* = 7"
138 gdb_test "print ul" ".* = 8"
140 # Continue; should stop at call1b and print actual arguments.
141 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
145 # Continue; should stop at call1c and print actual arguments.
146 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
150 # Continue; should stop at call1d and print actual arguments.
151 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
155 # Continue; should stop at call1e and print actual arguments.
156 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"] {
162 # Locate actual args; integrals mixed with floating point.
165 proc float_and_integral_args {} {
172 send "break call2a\n" ; expect -re ".*$prompt $"
173 send "break call2b\n" ; expect -re ".*$prompt $"
174 send "break call2c\n" ; expect -re ".*$prompt $"
175 send "break call2d\n" ; expect -re ".*$prompt $"
176 send "break call2e\n" ; expect -re ".*$prompt $"
177 send "break call2f\n" ; expect -re ".*$prompt $"
178 send "break call2g\n" ; expect -re ".*$prompt $"
179 send "break call2h\n" ; expect -re ".*$prompt $"
181 # Run; should stop at call2a and print actual arguments.
183 setup_xfail "i960-*-*" 1813
184 # The a29k fails all of these tests, perhaps because the prologue
186 setup_xfail "a29k-*-udi"
187 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
190 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
191 -re "$prompt $" { fail "run to call2a" ; return }
192 timeout { fail "(timeout) run to call2a" ; return }
195 # Print each arg as a double check to see if we can print
196 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
197 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
198 gdb_test "print s" ".* = 1" "print s after run to call2a"
199 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
200 gdb_test "print i" ".* = 2" "print i after run to call2a"
201 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
202 gdb_test "print l" ".* = 3" "print l after run to call2a"
203 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
205 setup_xfail "rs6000-*-*"
206 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
207 # Continue; should stop at call2b and print actual arguments.
208 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"] {
212 # Continue; should stop at call2c and print actual arguments.
213 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"] {
217 # Continue; should stop at call2d and print actual arguments.
218 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"] {
222 # Continue; should stop at call2e and print actual arguments.
223 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"] {
227 # Continue; should stop at call2f and print actual arguments.
228 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"] {
232 if {$gcc_compiled} then { setup_xfail "mips-sgi-irix4*" }
233 # Continue; should stop at call2g and print actual arguments.
234 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"] {
238 # Continue; should stop at call2h and print actual arguments.
239 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"] {
243 # monitor only allows 8 breakpoints; w89k board allows 10, so
244 # break them up into two groups.
246 send "break call2i\n" ; expect -re ".*$prompt $"
248 # Continue; should stop at call2i and print actual arguments.
249 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"] {
255 # Locate actual args; dereference pointers to ints and floats.
258 proc pointer_args {} {
265 send "break call3a\n" ; expect -re ".*$prompt $"
266 send "break call3b\n" ; expect -re ".*$prompt $"
267 send "break call3c\n" ; expect -re ".*$prompt $"
269 # Run; should stop at call3a and print actual arguments.
270 # Try dereferencing the arguments.
272 # The a29k fails all of these tests, perhaps because the prologue
274 setup_xfail "a29k-*-udi"
277 -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
278 -re "$prompt $" { fail "run to call3a" ; return }
279 timeout { fail "(timeout) run to call3a" ; return }
282 gdb_test "print *cp" ".* = 97 'a'"
283 gdb_test "print *sp" ".* = 1"
284 gdb_test "print *ip" ".* = 2"
285 gdb_test "print *lp" ".* = 3"
287 # Continue; should stop at call3b and print actual arguments.
288 # Try dereferencing the arguments.
289 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
293 gdb_test "print *ucp" ".* = 98 'b'"
294 gdb_test "print *usp" ".* = 6"
295 gdb_test "print *uip" ".* = 7"
296 gdb_test "print *ulp" ".* = 8"
298 # Continue; should stop at call3c and print actual arguments.
299 # Try dereferencing the arguments.
300 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
304 gdb_test "print *fp" ".* = 4"
305 gdb_test "print *dp" ".* = 5"
307 pass "locate actual args, pointer types"
311 # Locate actual args; structures and unions passed by reference.
314 proc structs_by_reference {} {
321 send "break call4a\n" ; expect -re ".*$prompt $"
322 send "break call4b\n" ; expect -re ".*$prompt $"
324 # Run; should stop at call4a and print actual arguments.
325 # Try dereferencing the arguments.
327 # The a29k fails all of these tests, perhaps because the prologue
329 setup_xfail "a29k-*-udi"
332 -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
335 -re "$prompt $" { fail "run to call4a" ; return }
336 timeout { fail "(timeout) run to call4a" ; return }
339 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
341 # Continue; should stop at call4b and print actual arguments.
342 # Try dereferencing the arguments.
344 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
346 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
348 pass "locate actual args, structs/unions passed by reference"
352 # Locate actual args; structures and unions passed by value.
355 proc structs_by_value {} {
362 send "break call5a\n" ; expect -re ".*$prompt $"
363 send "break call5b\n" ; expect -re ".*$prompt $"
365 # Run; should stop at call5a and print actual arguments.
366 # Try dereferencing the arguments.
368 # The a29k fails all of these tests, perhaps because the prologue
370 setup_xfail "a29k-*-udi"
373 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
376 -re "$prompt $" { fail "run to call5a" ; return }
377 timeout { fail "(timeout) run to call5a" ; return }
380 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
382 # Continue; should stop at call5b and print actual arguments.
383 # Try dereferencing the arguments.
384 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
387 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
391 # Locate actual args; discard, shuffle, and call
394 proc discard_and_shuffle {} {
403 send "break call6a\n" ; expect -re ".*$prompt $"
404 send "break call6b\n" ; expect -re ".*$prompt $"
405 send "break call6c\n" ; expect -re ".*$prompt $"
406 send "break call6d\n" ; expect -re ".*$prompt $"
407 send "break call6e\n" ; expect -re ".*$prompt $"
408 send "break call6f\n" ; expect -re ".*$prompt $"
409 send "break call6g\n" ; expect -re ".*$prompt $"
410 send "break call6h\n" ; expect -re ".*$prompt $"
412 # Run; should stop at call6a and print actual arguments.
415 # The a29k fails all of these tests, perhaps because the prologue
417 setup_xfail "a29k-*-udi"
420 -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
421 -re "$prompt $" { fail "run to call6a" ; return }
422 timeout { fail "(timeout) run to call6a" ; return }
425 setup_xfail "rs6000-*-*"
426 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" }
427 send "backtrace 100\n"
429 -re "backtrace 100\[\r\n\]+
430 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
431 .* main \\(.*\\) .*\r
432 $prompt $" { pass "backtrace from call6a" }
433 -re "$prompt $" { fail "backtrace from call6a" ; return }
434 timeout { fail "(timeout) backtrace from call6a" ; return }
437 # Continue; should stop at call6b and print actual arguments.
442 -re ".*Breakpoint $decimal, call6b .*$prompt $" { pass "continue to call6b" }
443 -re "$prompt $" { fail "continue to call6b" ; return }
444 timeout { fail "(timeout) continue to call6b" ; return }
447 send "backtrace 100\n"
449 -re "backtrace 100\[\r\n]+
450 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
451 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
452 .* main \\(.*\\) .*\r
453 $prompt $" { pass "backtrace from call6b" }
454 -re "$prompt $" { fail "backtrace from call6b" ; return }
455 timeout { fail "(timeout) backtrace from call6b" ; return }
458 # Continue; should stop at call6c and print actual arguments.
463 -re ".*Breakpoint $decimal, call6c .*$prompt $" { pass "continue to call6c" }
464 -re "$prompt $" { fail "continue to call6c" ; return }
465 timeout { fail "(timeout) continue to call6c" ; return }
468 send "backtrace 100\n"
470 -re "backtrace 100\[\r\n\]+
471 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
472 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
473 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
474 .* main \\(.*\\) .*\r
475 $prompt $" { pass "backtrace from call6c" }
476 -re "$prompt $" { fail "backtrace from call6c" ; return }
477 timeout { fail "(timeout) backtrace from call6c" ; return }
480 # Continue; should stop at call6d and print actual arguments.
485 -re ".*Breakpoint $decimal, call6d .*$prompt $" { pass "continue to call6d" }
486 -re "$prompt $" { fail "continue to call6d" ; return }
487 timeout { fail "(timeout) continue to call6d" ; return }
490 send "backtrace 100\n"
492 -re "backtrace 100\[\r\n\]+
493 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
494 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
495 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
496 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
497 .* main \\(.*\\) .*\r
498 $prompt $" { pass "backtrace from call6d" }
499 -re "$prompt $" { fail "backtrace from call6d" ; return }
500 timeout { fail "(timeout) backtrace from call6d" ; return }
503 # Continue; should stop at call6e and print actual arguments.
508 -re ".*Breakpoint $decimal, call6e .*$prompt $" { pass "continue to call6e" }
509 -re "$prompt $" { fail "continue to call6e" ; return }
510 timeout { fail "(timeout) continue to call6e" ; return }
513 send "backtrace 100\n"
515 -re "backtrace 100\[\r\n\]+
516 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
517 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
518 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
519 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
520 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
521 .* main \\(.*\\) .*\r
522 $prompt $" { pass "backtrace from call6e" }
523 -re "$prompt $" { fail "backtrace from call6e" ; return }
524 timeout { fail "(timeout) backtrace from call6e" ; return }
527 # Continue; should stop at call6f and print actual arguments.
532 -re ".*Breakpoint $decimal, call6f .*$prompt $" { pass "continue to call6f" }
533 -re "$prompt $" { fail "continue to call6f" ; return }
534 timeout { fail "(timeout) continue to call6f" ; return }
537 send "backtrace 100\n"
539 -re "backtrace 100\[\r\n\]+
540 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
541 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
542 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
543 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
544 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
545 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
546 .* main \\(.*\\) .*\r
547 $prompt $" { pass "backtrace from call6f" }
548 -re "$prompt $" { fail "backtrace from call6f" ; return }
549 timeout { fail "(timeout) backtrace from call6f" ; return }
552 # Continue; should stop at call6g and print actual arguments.
557 -re ".*Breakpoint $decimal, call6g .*$prompt $" { pass "continue to call6g" }
558 -re "$prompt $" { fail "continue to call6g" ; return }
559 timeout { fail "(timeout) continue to call6g" ; return }
562 send "backtrace 100\n"
564 -re "backtrace 100\[\r\n\]+
565 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
566 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
567 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
568 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
569 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
570 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
571 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
572 .* main \\(.*\\) .*\r
573 $prompt $" { pass "backtrace from call6g" }
574 -re "$prompt $" { fail "backtrace from call6g" ; return }
575 timeout { fail "(timeout) backtrace from call6g" ; return }
578 # Continue; should stop at call6h and print actual arguments.
583 -re ".*Breakpoint $decimal, call6h .*$prompt $" { pass "continue to call6h" }
584 -re "$prompt $" { fail "continue to call6h" ; return }
585 timeout { fail "(timeout) continue to call6h" ; return }
588 send "backtrace 100\n"
590 -re "backtrace 100\[\r\n\]+
591 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
592 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
593 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
594 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
595 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
596 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
597 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
598 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
599 .* main \\(.*\\) .*\r
600 $prompt $" { pass "backtrace from call6h" }
601 -re "$prompt $" { fail "backtrace from call6h" ; return }
602 timeout { fail "(timeout) backtrace from call6h" ; return }
605 # monitor only allows 8 breakpoints; w89k board allows 10, so
606 # break them up into two groups.
608 send "break call6i\n" ; expect -re ".*$prompt $"
609 send "break call6j\n" ; expect -re ".*$prompt $"
610 send "break call6k\n" ; expect -re ".*$prompt $"
612 # Continue; should stop at call6i and print actual arguments.
617 -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
618 -re "$prompt $" { fail "continue to call6i" ; return }
619 timeout { fail "(timeout) continue to call6i" ; return }
622 send "backtrace 100\n"
624 -re "backtrace 100\[\r\n\]+
625 .* call6i \\(ui=7, ul=8\\) .*\r
626 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
627 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
628 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
629 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
630 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
631 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
632 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
633 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
634 .* main \\(.*\\) .*\r
635 $prompt $" { pass "backtrace from call6i" }
636 -re "$prompt $" { fail "backtrace from call6i" ; return }
637 timeout { fail "(timeout) backtrace from call6i" ; return }
640 # Continue; should stop at call6j and print actual arguments.
645 -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
646 -re "$prompt $" { fail "continue to call6j" ; return }
647 timeout { fail "(timeout) continue to call6j" ; return }
650 send "backtrace 100\n"
652 -re "backtrace 100\[\r\n\]+
653 .* call6j \\(ul=8\\) .*\r
654 .* call6i \\(ui=7, ul=8\\) .*\r
655 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
656 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
657 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
658 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
659 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
660 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
661 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
662 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
663 .* main \\(.*\\) .*\r
664 $prompt $" { pass "backtrace from call6j" }
665 -re "$prompt $" { fail "backtrace from call6j" ; return }
666 timeout { fail "(timeout) backtrace from call6j" ; return }
669 # Continue; should stop at call6k and print actual arguments.
671 # This fails on i960-*-vxworks because gdb gets confused by
672 # breakpoints on adjacent instructions.
673 setup_xfail "i960-*-vxworks" 1786
676 -re ".*Breakpoint $decimal, call6k .*$prompt $" {
677 pass "continue to call6k"
679 -re "$prompt $" { fail "continue to call6k"; return }
680 timeout { fail "(timeout) continue to call6k"; return }
683 send "backtrace 100\n"
685 -re "backtrace 100\[\r\n\]+
686 .* call6k \\(\\) .*\r
687 .* call6j \\(ul=8\\) .*\r
688 .* call6i \\(ui=7, ul=8\\) .*\r
689 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
690 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
691 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
692 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
693 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
694 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
695 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
696 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
697 .* main \\(.*\\) .*\r
698 $prompt $" { pass "backtrace from call6k" }
699 -re "$prompt $" { fail "backtrace from call6k" ; return }
700 timeout { fail "(timeout) backtrace from call6k" ; return }
705 # Locate actual args; shuffle round robin and call
708 proc shuffle_round_robin {} {
717 send "break call7a\n" ; expect -re ".*$prompt $"
718 send "break call7b\n" ; expect -re ".*$prompt $"
719 send "break call7c\n" ; expect -re ".*$prompt $"
720 send "break call7d\n" ; expect -re ".*$prompt $"
721 send "break call7e\n" ; expect -re ".*$prompt $"
722 send "break call7f\n" ; expect -re ".*$prompt $"
723 send "break call7g\n" ; expect -re ".*$prompt $"
724 send "break call7h\n" ; expect -re ".*$prompt $"
726 # Run; should stop at call7a and print actual arguments.
729 # The a29k fails all of these tests, perhaps because the prologue
731 setup_xfail "a29k-*-udi"
734 -re ".*Breakpoint $decimal, call7a .*$prompt $" {
737 -re "$prompt $" { fail "run to call7a" ; return }
738 timeout { fail "(timeout) run to call7a" ; return }
741 setup_xfail "i960-*-*" 1813
742 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
743 send "backtrace 100\n"
745 -re "backtrace 100\[\r\n\]+
746 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
747 .* main \\(.*\\) .*\r
748 $prompt $" { pass "backtrace from call7a" }
749 -re "$prompt $" { fail "backtrace from call7a" ; return }
750 timeout { fail "(timeout) backtrace from call7a" ; return }
753 # Continue; should stop at call7b and print actual arguments.
758 -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
759 -re "$prompt $" { fail "continue to call7b" ; return }
760 timeout { fail "(timeout) continue to call7b" ; return }
763 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
764 send "backtrace 100\n"
766 -re "backtrace 100\[\r\n\]+
767 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
768 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
769 .* main \\(.*\\) .*\r
770 $prompt $" { pass "backtrace from call7b" }
771 -re "$prompt $" { fail "backtrace from call7b" ; return }
772 timeout { fail "(timeout) backtrace from call7b" ; return }
775 # Continue; should stop at call7c and print actual arguments.
780 -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
781 -re "$prompt $" { fail "continue to call7c" ; return }
782 timeout { fail "(timeout) continue to call7c" ; return }
785 send "backtrace 100\n"
787 -re "backtrace 100\[\r\n\]+
788 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
789 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
790 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
791 .* main \\(.*\\) .*\r
792 $prompt $" { pass "backtrace from call7c" }
793 -re "$prompt $" { fail "backtrace from call7c" ; return }
794 timeout { fail "(timeout) backtrace from call7c" ; return }
797 # Continue; should stop at call7d and print actual arguments.
802 -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
803 -re "$prompt $" { fail "continue to call7d" ; return }
804 timeout { fail "(timeout) continue to call7d" ; return }
807 send "backtrace 100\n"
809 -re "backtrace 100\[\r\n\]+
810 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
811 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
812 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
813 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
814 .* main \\(.*\\) .*\r
815 $prompt $" { pass "backtrace from call7d" }
816 -re "$prompt $" { fail "backtrace from call7d" ; return }
817 timeout { fail "(timeout) backtrace from call7d" ; return }
820 # Continue; should stop at call7e and print actual arguments.
825 -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
826 -re "$prompt $" { fail "continue to call7e" ; return }
827 timeout { fail "(timeout) continue to call7e" ; return }
830 send "backtrace 100\n"
832 -re "backtrace 100\[\r\n\]+
833 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
834 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
835 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
836 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
837 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
838 .* main \\(.*\\) .*\r
839 $prompt $" { pass "backtrace from call7e" }
840 -re "$prompt $" { fail "backtrace from call7e" ; return }
841 timeout { fail "(timeout) backtrace from call7e" ; return }
844 # Continue; should stop at call7f and print actual arguments.
849 -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
850 -re "$prompt $" { fail "continue to call7f" ; return }
851 timeout { fail "(timeout) continue to call7f" ; return }
854 send "backtrace 100\n"
856 -re "backtrace 100\[\r\n\]+
857 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
858 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
859 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
860 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
861 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
862 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
863 .* main \\(.*\\) .*\r
864 $prompt $" { pass "backtrace from call7f" }
865 -re "$prompt $" { fail "backtrace from call7f" ; return }
866 timeout { fail "(timeout) backtrace from call7f" ; return }
869 # Continue; should stop at call7g and print actual arguments.
874 -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
875 -re "$prompt $" { fail "continue to call7g" ; return }
876 timeout { fail "(timeout) continue to call7g" ; return }
879 send "backtrace 100\n"
881 -re "backtrace 100\[\r\n\]+
882 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
883 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
884 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
885 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
886 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
887 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
888 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
889 .* main \\(.*\\) .*\r
890 $prompt $" { pass "backtrace from call7g" }
891 -re "$prompt $" { fail "backtrace from call7g" ; return }
892 timeout { fail "(timeout) backtrace from call7g" ; return }
895 # Continue; should stop at call7h and print actual arguments.
900 -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
901 -re "$prompt $" { fail "continue to call7h" ; return }
902 timeout { fail "(timeout) continue to call7h" ; return }
905 send "backtrace 100\n"
907 -re "backtrace 100\[\r\n\]+
908 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
909 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
910 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
911 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
912 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
913 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
914 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
915 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
916 .* main \\(.*\\) .*\r
917 $prompt $" { pass "backtrace from call7h" }
918 -re "$prompt $" { fail "backtrace from call7h" ; return }
919 timeout { fail "(timeout) backtrace from call7h" ; return }
922 # monitor only allows 8 breakpoints; w89k board allows 10, so
923 # break them up into two groups.
925 send "break call7i\n" ; expect -re ".*$prompt $"
926 send "break call7j\n" ; expect -re ".*$prompt $"
927 send "break call7k\n" ; expect -re ".*$prompt $"
929 # Continue; should stop at call7i and print actual arguments.
934 -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
935 -re "$prompt $" { fail "continue to call7i" ; return }
936 timeout { fail "(timeout) continue to call7i" ; return }
939 send "backtrace 100\n"
941 -re "backtrace 100\[\r\n\]+
942 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
943 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
944 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
945 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
946 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
947 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
948 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
949 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
950 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
951 .* main \\(.*\\) .*\r
952 $prompt $" { pass "backtrace from call7i" }
953 -re "$prompt $" { fail "backtrace from call7i" ; return }
954 timeout { fail "(timeout) backtrace from call7i" ; return }
957 # Continue; should stop at call7j and print actual arguments.
962 -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
963 -re "$prompt $" { fail "continue to call7j" ; return }
964 timeout { fail "(timeout) continue to call7j" ; return }
967 send "backtrace 100\n"
969 -re "backtrace 100\[\r\n\]+
970 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
971 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
972 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
973 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
974 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
975 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
976 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
977 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
978 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
979 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
980 .* main \\(.*\\) .*\r
981 $prompt $" { pass "backtrace from call7j" }
982 -re "$prompt $" { fail "backtrace from call7j" ; return }
983 timeout { fail "(timeout) backtrace from call7j" ; return }
986 # Continue; should stop at call7k and print actual arguments.
991 -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
992 -re "$prompt $" { fail "continue to call7k" ; return }
993 timeout { fail "(timeout) continue to call7k" ; return }
996 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
997 send "backtrace 100\n"
999 -re "backtrace 100\[\r\n\]+
1000 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
1001 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
1002 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
1003 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
1004 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
1005 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
1006 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
1007 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
1008 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
1009 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
1010 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
1011 .* main \\(.*\\) .*\r
1012 $prompt $" { pass "backtrace from call7k" }
1013 -re "$prompt $" { fail "backtrace from call7k" ; return }
1014 timeout { fail "(timeout) backtrace from call7k" ; return }
1019 # Locate actual args; recursive passing of structs by value
1022 proc recursive_structs_by_value {} {
1030 send "break hitbottom\n" ; expect -re ".*$prompt $"
1032 # Run; should stop at hitbottom and print actual arguments.
1036 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
1037 -re "$prompt $" { fail "run to hitbottom" ; return }
1038 timeout { fail "(timeout) run to hitbottom" ; return }
1041 # The a29k fails all of these tests, perhaps because the prologue
1043 setup_xfail "a29k-*-udi"
1044 send "backtrace 100\n"
1046 -re "backtrace 100\[\r\n\]+
1047 .* hitbottom \\(\\) .*\r
1048 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
1049 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
1050 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
1051 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
1052 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
1053 .* test_struct_args \\(\\) .*\r
1054 .* main \\(.*\\) .*\r
1055 $prompt $" { pass "recursive passing of structs by value" }
1056 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1057 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1061 proc funcargs_reload { } {
1067 if [istarget "mips-idt-*"] then {
1068 # Restart because IDT/SIM runs out of file descriptors.
1071 gdb_reinitialize_dir $srcdir/$subdir
1077 # Test for accessing local stack variables in functions which call alloca
1079 proc localvars_after_alloca { } {
1085 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1087 # Print each arg as a double check to see if we can print
1088 # them here as well as with backtrace.
1090 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1091 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1092 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1093 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1094 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1095 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1099 -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
1100 timeout { fail "next in localvars_after_alloca()" ; return }
1103 # Print each arg as a double check to see if we can print
1104 # them here as well as with backtrace.
1106 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1107 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1108 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1109 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1111 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1114 proc call_after_alloca { } {
1120 if { ! [ runto call_after_alloca_subr ] } then { return 0 }
1122 # Print each arg as a double check to see if we can print
1123 # them here as well as with backtrace.
1125 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1126 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1127 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1128 gdb_test "print s" " = 1" "print s in call_after_alloca"
1129 gdb_test "print i" " = 2" "print i in call_after_alloca"
1130 gdb_test "print l" " = 3" "print l in call_after_alloca"
1132 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1133 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"
1137 # Test for accessing local stack variables, backtraces, finish,
1138 # and finally stepping into indirect calls. The point is that on the PA
1139 # these use a funky `dyncall' mechanism which GDB needs to know about.
1141 proc localvars_in_indirect_call { } {
1147 # Can not use "runto call0a" as call0a is called several times
1148 # during single run. Instead stop in a marker function and
1149 # take control from there.
1150 if { ! [ runto marker_indirect_call ] } then { return 0 }
1152 # break on the next call to call0a, then delete all the breakpoints
1153 # and start testing.
1154 gdb_test "break call0a" "Breakpoint .*" \
1155 "break call0a in localvars_in_indirect_call"
1156 gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
1159 # Print each arg as a double check to see if we can print
1160 # them here as well as with backtrace.
1162 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1163 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1164 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1165 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1166 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1167 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1169 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1170 gdb_test "backtrace 8" \
1171 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1172 "backtrace in indirectly called function"
1175 # "finish" brings us back to main. We then will try to step through
1176 # the second indirect call.
1177 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1178 # of the first indirect call. This is due to stack adjustment instructions
1179 # after the indirect call. In these cases we will step till we hit the
1180 # second indirect call.
1185 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
1189 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
1190 pass "finish from indirectly called function"
1193 fail "finish from indirectly called function"
1196 default { fail "finish from indirectly called function" ; return }
1199 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1200 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1201 "stepping into indirectly called function"
1204 # Start with a fresh gdb.
1206 # Test for stepping into indirect calls which may have trampolines (possibly
1207 # cascaded) on both the call path and the return path.
1208 # to handle trampolines.
1210 proc test_stepping_over_trampolines { } {
1215 # Stop in a marker function and take control from there.
1216 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1218 # Cater for gdb stopping in midline, see comment for finish above.
1221 -re "marker_call_with_trampolines ..;.*$prompt $" {
1225 -re "pointer_to_call_with_trampolines.*$prompt $" {
1226 pass "finish from marker_call_with_trampolines"
1229 fail "finish from marker_call_with_trampolines"
1231 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1234 # Try to step into the target function.
1235 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1236 "stepping into function called with trampolines"
1238 # Make we can backtrace and the argument looks correct. */
1239 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1240 "backtrace through call with trampolines"
1242 # Make sure we can get back to main.
1243 # Stepping back to main might stop again after the return statement
1244 # or immediately transfer control back to main if optimizations
1248 -re "main .* at.*$prompt $" {
1249 pass "stepping back to main from function called with trampolines" ;
1252 -re "\}.*End of call_with_trampolines.*$prompt $" {
1257 fail "stepping back to main from function called with trampolines"
1259 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1263 # Start with a fresh gdb.
1267 gdb_reinitialize_dir $srcdir/$subdir
1270 source ${binfile}.ci
1274 unsigned_integral_args
1276 float_and_integral_args
1280 structs_by_reference
1288 recursive_structs_by_value
1290 localvars_after_alloca
1294 localvars_in_indirect_call
1296 test_stepping_over_trampolines