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 $"
174 send "break call2i\n" ; expect -re ".*$prompt $"
176 # Run; should stop at call2a and print actual arguments.
178 setup_xfail "i960-*-*" 1813
179 # The a29k fails all of these tests, perhaps because the prologue
181 setup_xfail "a29k-*-udi"
182 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
185 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
186 -re "$prompt $" { fail "run to call2a" ; return }
187 timeout { fail "(timeout) run to call2a" ; return }
190 # Print each arg as a double check to see if we can print
191 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
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 # Continue; should stop at call2b and print actual arguments.
202 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"] {
206 # Continue; should stop at call2c and print actual arguments.
207 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"] {
211 # Continue; should stop at call2d and print actual arguments.
212 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"] {
216 # Continue; should stop at call2e and print actual arguments.
217 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"] {
221 # Continue; should stop at call2f and print actual arguments.
222 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"] {
226 # Continue; should stop at call2g and print actual arguments.
227 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"] {
231 # Continue; should stop at call2h and print actual arguments.
232 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"] {
236 # Continue; should stop at call2i and print actual arguments.
237 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"] {
243 # Locate actual args; dereference pointers to ints and floats.
246 proc pointer_args {} {
253 send "break call3a\n" ; expect -re ".*$prompt $"
254 send "break call3b\n" ; expect -re ".*$prompt $"
255 send "break call3c\n" ; expect -re ".*$prompt $"
257 # Run; should stop at call3a and print actual arguments.
258 # Try dereferencing the arguments.
260 # The a29k fails all of these tests, perhaps because the prologue
262 setup_xfail "a29k-*-udi"
265 -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
266 -re "$prompt $" { fail "run to call3a" ; return }
267 timeout { fail "(timeout) run to call3a" ; return }
270 gdb_test "print *cp" ".* = 97 'a'"
271 gdb_test "print *sp" ".* = 1"
272 gdb_test "print *ip" ".* = 2"
273 gdb_test "print *lp" ".* = 3"
275 # Continue; should stop at call3b and print actual arguments.
276 # Try dereferencing the arguments.
277 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
281 gdb_test "print *ucp" ".* = 98 'b'"
282 gdb_test "print *usp" ".* = 6"
283 gdb_test "print *uip" ".* = 7"
284 gdb_test "print *ulp" ".* = 8"
286 # Continue; should stop at call3c and print actual arguments.
287 # Try dereferencing the arguments.
288 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
292 gdb_test "print *fp" ".* = 4"
293 gdb_test "print *dp" ".* = 5"
295 pass "locate actual args, pointer types"
299 # Locate actual args; structures and unions passed by reference.
302 proc structs_by_reference {} {
309 send "break call4a\n" ; expect -re ".*$prompt $"
310 send "break call4b\n" ; expect -re ".*$prompt $"
312 # Run; should stop at call4a and print actual arguments.
313 # Try dereferencing the arguments.
315 # The a29k fails all of these tests, perhaps because the prologue
317 setup_xfail "a29k-*-udi"
320 -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
323 -re "$prompt $" { fail "run to call4a" ; return }
324 timeout { fail "(timeout) run to call4a" ; return }
327 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
329 # Continue; should stop at call4b and print actual arguments.
330 # Try dereferencing the arguments.
332 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
334 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
336 pass "locate actual args, structs/unions passed by reference"
340 # Locate actual args; structures and unions passed by value.
343 proc structs_by_value {} {
350 send "break call5a\n" ; expect -re ".*$prompt $"
351 send "break call5b\n" ; expect -re ".*$prompt $"
353 # Run; should stop at call5a and print actual arguments.
354 # Try dereferencing the arguments.
356 # The a29k fails all of these tests, perhaps because the prologue
358 setup_xfail "a29k-*-udi"
361 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
364 -re "$prompt $" { fail "run to call5a" ; return }
365 timeout { fail "(timeout) run to call5a" ; return }
368 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
370 # Continue; should stop at call5b and print actual arguments.
371 # Try dereferencing the arguments.
372 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
375 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
379 # Locate actual args; discard, shuffle, and call
382 proc discard_and_shuffle {} {
390 send "break call6a\n" ; expect -re ".*$prompt $"
391 send "break call6b\n" ; expect -re ".*$prompt $"
392 send "break call6c\n" ; expect -re ".*$prompt $"
393 send "break call6d\n" ; expect -re ".*$prompt $"
394 send "break call6e\n" ; expect -re ".*$prompt $"
395 send "break call6f\n" ; expect -re ".*$prompt $"
396 send "break call6g\n" ; expect -re ".*$prompt $"
397 send "break call6h\n" ; expect -re ".*$prompt $"
398 send "break call6i\n" ; expect -re ".*$prompt $"
399 send "break call6j\n" ; expect -re ".*$prompt $"
400 send "break call6k\n" ; expect -re ".*$prompt $"
402 # Run; should stop at call6a and print actual arguments.
405 # The a29k fails all of these tests, perhaps because the prologue
407 setup_xfail "a29k-*-udi"
410 -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
411 -re "$prompt $" { fail "run to call6a" ; return }
412 timeout { fail "(timeout) run to call6a" ; return }
415 setup_xfail "rs6000-*-*"
416 send "backtrace 100\n"
418 -re "backtrace 100\[\r\n\]+
419 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
420 .* main \\(.*\\) .*\r
421 $prompt $" { pass "backtrace from call6a" }
422 -re "$prompt $" { fail "backtrace from call6a" ; return }
423 timeout { fail "(timeout) backtrace from call6a" ; return }
426 # Continue; should stop at call6b and print actual arguments.
431 -re ".*Breakpoint $decimal, call6b .*$prompt $" { pass "continue to call6b" }
432 -re "$prompt $" { fail "continue to call6b" ; return }
433 timeout { fail "(timeout) continue to call6b" ; return }
436 send "backtrace 100\n"
438 -re "backtrace 100\[\r\n]+
439 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
440 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
441 .* main \\(.*\\) .*\r
442 $prompt $" { pass "backtrace from call6b" }
443 -re "$prompt $" { fail "backtrace from call6b" ; return }
444 timeout { fail "(timeout) backtrace from call6b" ; return }
447 # Continue; should stop at call6c and print actual arguments.
452 -re ".*Breakpoint $decimal, call6c .*$prompt $" { pass "continue to call6c" }
453 -re "$prompt $" { fail "continue to call6c" ; return }
454 timeout { fail "(timeout) continue to call6c" ; return }
457 send "backtrace 100\n"
459 -re "backtrace 100\[\r\n\]+
460 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
461 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
462 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
463 .* main \\(.*\\) .*\r
464 $prompt $" { pass "backtrace from call6c" }
465 -re "$prompt $" { fail "backtrace from call6c" ; return }
466 timeout { fail "(timeout) backtrace from call6c" ; return }
469 # Continue; should stop at call6d and print actual arguments.
474 -re ".*Breakpoint $decimal, call6d .*$prompt $" { pass "continue to call6d" }
475 -re "$prompt $" { fail "continue to call6d" ; return }
476 timeout { fail "(timeout) continue to call6d" ; return }
479 send "backtrace 100\n"
481 -re "backtrace 100\[\r\n\]+
482 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
483 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
484 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
485 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
486 .* main \\(.*\\) .*\r
487 $prompt $" { pass "backtrace from call6d" }
488 -re "$prompt $" { fail "backtrace from call6d" ; return }
489 timeout { fail "(timeout) backtrace from call6d" ; return }
492 # Continue; should stop at call6e and print actual arguments.
497 -re ".*Breakpoint $decimal, call6e .*$prompt $" { pass "continue to call6e" }
498 -re "$prompt $" { fail "continue to call6e" ; return }
499 timeout { fail "(timeout) continue to call6e" ; return }
502 send "backtrace 100\n"
504 -re "backtrace 100\[\r\n\]+
505 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
506 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
507 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
508 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
509 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
510 .* main \\(.*\\) .*\r
511 $prompt $" { pass "backtrace from call6e" }
512 -re "$prompt $" { fail "backtrace from call6e" ; return }
513 timeout { fail "(timeout) backtrace from call6e" ; return }
516 # Continue; should stop at call6f and print actual arguments.
521 -re ".*Breakpoint $decimal, call6f .*$prompt $" { pass "continue to call6f" }
522 -re "$prompt $" { fail "continue to call6f" ; return }
523 timeout { fail "(timeout) continue to call6f" ; return }
526 send "backtrace 100\n"
528 -re "backtrace 100\[\r\n\]+
529 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
530 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
531 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
532 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
533 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
534 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
535 .* main \\(.*\\) .*\r
536 $prompt $" { pass "backtrace from call6f" }
537 -re "$prompt $" { fail "backtrace from call6f" ; return }
538 timeout { fail "(timeout) backtrace from call6f" ; return }
541 # Continue; should stop at call6g and print actual arguments.
546 -re ".*Breakpoint $decimal, call6g .*$prompt $" { pass "continue to call6g" }
547 -re "$prompt $" { fail "continue to call6g" ; return }
548 timeout { fail "(timeout) continue to call6g" ; return }
551 send "backtrace 100\n"
553 -re "backtrace 100\[\r\n\]+
554 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
555 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
556 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
557 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
558 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
559 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
560 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
561 .* main \\(.*\\) .*\r
562 $prompt $" { pass "backtrace from call6g" }
563 -re "$prompt $" { fail "backtrace from call6g" ; return }
564 timeout { fail "(timeout) backtrace from call6g" ; return }
567 # Continue; should stop at call6h and print actual arguments.
572 -re ".*Breakpoint $decimal, call6h .*$prompt $" { pass "continue to call6h" }
573 -re "$prompt $" { fail "continue to call6h" ; return }
574 timeout { fail "(timeout) continue to call6h" ; return }
577 send "backtrace 100\n"
579 -re "backtrace 100\[\r\n\]+
580 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
581 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
582 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
583 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
584 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
585 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
586 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
587 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
588 .* main \\(.*\\) .*\r
589 $prompt $" { pass "backtrace from call6h" }
590 -re "$prompt $" { fail "backtrace from call6h" ; return }
591 timeout { fail "(timeout) backtrace from call6h" ; return }
594 # Continue; should stop at call6i and print actual arguments.
599 -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
600 -re "$prompt $" { fail "continue to call6i" ; return }
601 timeout { fail "(timeout) continue to call6i" ; return }
604 send "backtrace 100\n"
606 -re "backtrace 100\[\r\n\]+
607 .* call6i \\(ui=7, ul=8\\) .*\r
608 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
609 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
610 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
611 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
612 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
613 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
614 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
615 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
616 .* main \\(.*\\) .*\r
617 $prompt $" { pass "backtrace from call6i" }
618 -re "$prompt $" { fail "backtrace from call6i" ; return }
619 timeout { fail "(timeout) backtrace from call6i" ; return }
622 # Continue; should stop at call6j and print actual arguments.
627 -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
628 -re "$prompt $" { fail "continue to call6j" ; return }
629 timeout { fail "(timeout) continue to call6j" ; return }
632 send "backtrace 100\n"
634 -re "backtrace 100\[\r\n\]+
635 .* call6j \\(ul=8\\) .*\r
636 .* call6i \\(ui=7, ul=8\\) .*\r
637 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
638 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
639 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
640 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
641 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
642 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
643 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
644 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
645 .* main \\(.*\\) .*\r
646 $prompt $" { pass "backtrace from call6j" }
647 -re "$prompt $" { fail "backtrace from call6j" ; return }
648 timeout { fail "(timeout) backtrace from call6j" ; return }
651 # Continue; should stop at call6k and print actual arguments.
653 # This fails on i960-*-vxworks because gdb gets confused by
654 # breakpoints on adjacent instructions.
655 setup_xfail "i960-*-vxworks" 1786
658 -re ".*Breakpoint $decimal, call6k .*$prompt $" {
659 pass "continue to call6k"
661 -re "$prompt $" { fail "continue to call6k"; return }
662 timeout { fail "(timeout) continue to call6k"; return }
665 send "backtrace 100\n"
667 -re "backtrace 100\[\r\n\]+
668 .* call6k \\(\\) .*\r
669 .* call6j \\(ul=8\\) .*\r
670 .* call6i \\(ui=7, ul=8\\) .*\r
671 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
672 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
673 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
674 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
675 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
676 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
677 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
678 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
679 .* main \\(.*\\) .*\r
680 $prompt $" { pass "backtrace from call6k" }
681 -re "$prompt $" { fail "backtrace from call6k" ; return }
682 timeout { fail "(timeout) backtrace from call6k" ; return }
687 # Locate actual args; shuffle round robin and call
690 proc shuffle_round_robin {} {
699 send "break call7a\n" ; expect -re ".*$prompt $"
700 send "break call7b\n" ; expect -re ".*$prompt $"
701 send "break call7c\n" ; expect -re ".*$prompt $"
702 send "break call7d\n" ; expect -re ".*$prompt $"
703 send "break call7e\n" ; expect -re ".*$prompt $"
704 send "break call7f\n" ; expect -re ".*$prompt $"
705 send "break call7g\n" ; expect -re ".*$prompt $"
706 send "break call7h\n" ; expect -re ".*$prompt $"
707 send "break call7i\n" ; expect -re ".*$prompt $"
708 send "break call7j\n" ; expect -re ".*$prompt $"
709 send "break call7k\n" ; expect -re ".*$prompt $"
711 # Run; should stop at call7a and print actual arguments.
714 # The a29k fails all of these tests, perhaps because the prologue
716 setup_xfail "a29k-*-udi"
719 -re ".*Breakpoint $decimal, call7a .*$prompt $" {
722 -re "$prompt $" { fail "run to call7a" ; return }
723 timeout { fail "(timeout) run to call7a" ; return }
726 setup_xfail "i960-*-*" 1813
727 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
728 send "backtrace 100\n"
730 -re "backtrace 100\[\r\n\]+
731 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
732 .* main \\(.*\\) .*\r
733 $prompt $" { pass "backtrace from call7a" }
734 -re "$prompt $" { fail "backtrace from call7a" ; return }
735 timeout { fail "(timeout) backtrace from call7a" ; return }
738 # Continue; should stop at call7b and print actual arguments.
743 -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
744 -re "$prompt $" { fail "continue to call7b" ; return }
745 timeout { fail "(timeout) continue to call7b" ; return }
748 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
749 send "backtrace 100\n"
751 -re "backtrace 100\[\r\n\]+
752 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
753 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
754 .* main \\(.*\\) .*\r
755 $prompt $" { pass "backtrace from call7b" }
756 -re "$prompt $" { fail "backtrace from call7b" ; return }
757 timeout { fail "(timeout) backtrace from call7b" ; return }
760 # Continue; should stop at call7c and print actual arguments.
765 -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
766 -re "$prompt $" { fail "continue to call7c" ; return }
767 timeout { fail "(timeout) continue to call7c" ; return }
770 send "backtrace 100\n"
772 -re "backtrace 100\[\r\n\]+
773 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
774 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
775 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
776 .* main \\(.*\\) .*\r
777 $prompt $" { pass "backtrace from call7c" }
778 -re "$prompt $" { fail "backtrace from call7c" ; return }
779 timeout { fail "(timeout) backtrace from call7c" ; return }
782 # Continue; should stop at call7d and print actual arguments.
787 -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
788 -re "$prompt $" { fail "continue to call7d" ; return }
789 timeout { fail "(timeout) continue to call7d" ; return }
792 send "backtrace 100\n"
794 -re "backtrace 100\[\r\n\]+
795 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
796 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
797 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
798 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
799 .* main \\(.*\\) .*\r
800 $prompt $" { pass "backtrace from call7d" }
801 -re "$prompt $" { fail "backtrace from call7d" ; return }
802 timeout { fail "(timeout) backtrace from call7d" ; return }
805 # Continue; should stop at call7e and print actual arguments.
810 -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
811 -re "$prompt $" { fail "continue to call7e" ; return }
812 timeout { fail "(timeout) continue to call7e" ; return }
815 send "backtrace 100\n"
817 -re "backtrace 100\[\r\n\]+
818 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
819 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
820 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
821 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
822 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
823 .* main \\(.*\\) .*\r
824 $prompt $" { pass "backtrace from call7e" }
825 -re "$prompt $" { fail "backtrace from call7e" ; return }
826 timeout { fail "(timeout) backtrace from call7e" ; return }
829 # Continue; should stop at call7f and print actual arguments.
834 -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
835 -re "$prompt $" { fail "continue to call7f" ; return }
836 timeout { fail "(timeout) continue to call7f" ; return }
839 send "backtrace 100\n"
841 -re "backtrace 100\[\r\n\]+
842 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
843 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
844 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
845 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
846 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
847 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
848 .* main \\(.*\\) .*\r
849 $prompt $" { pass "backtrace from call7f" }
850 -re "$prompt $" { fail "backtrace from call7f" ; return }
851 timeout { fail "(timeout) backtrace from call7f" ; return }
854 # Continue; should stop at call7g and print actual arguments.
859 -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
860 -re "$prompt $" { fail "continue to call7g" ; return }
861 timeout { fail "(timeout) continue to call7g" ; return }
864 send "backtrace 100\n"
866 -re "backtrace 100\[\r\n\]+
867 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
868 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
869 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
870 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
871 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
872 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
873 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
874 .* main \\(.*\\) .*\r
875 $prompt $" { pass "backtrace from call7g" }
876 -re "$prompt $" { fail "backtrace from call7g" ; return }
877 timeout { fail "(timeout) backtrace from call7g" ; return }
880 # Continue; should stop at call7h and print actual arguments.
885 -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
886 -re "$prompt $" { fail "continue to call7h" ; return }
887 timeout { fail "(timeout) continue to call7h" ; return }
890 send "backtrace 100\n"
892 -re "backtrace 100\[\r\n\]+
893 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
894 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
895 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
896 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
897 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
898 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
899 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
900 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
901 .* main \\(.*\\) .*\r
902 $prompt $" { pass "backtrace from call7h" }
903 -re "$prompt $" { fail "backtrace from call7h" ; return }
904 timeout { fail "(timeout) backtrace from call7h" ; return }
907 # Continue; should stop at call7i and print actual arguments.
912 -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
913 -re "$prompt $" { fail "continue to call7i" ; return }
914 timeout { fail "(timeout) continue to call7i" ; return }
917 send "backtrace 100\n"
919 -re "backtrace 100\[\r\n\]+
920 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
921 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
922 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
923 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
924 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
925 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
926 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
927 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
928 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
929 .* main \\(.*\\) .*\r
930 $prompt $" { pass "backtrace from call7i" }
931 -re "$prompt $" { fail "backtrace from call7i" ; return }
932 timeout { fail "(timeout) backtrace from call7i" ; return }
935 # Continue; should stop at call7j and print actual arguments.
940 -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
941 -re "$prompt $" { fail "continue to call7j" ; return }
942 timeout { fail "(timeout) continue to call7j" ; return }
945 send "backtrace 100\n"
947 -re "backtrace 100\[\r\n\]+
948 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
949 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
950 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
951 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
952 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
953 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
954 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
955 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
956 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
957 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
958 .* main \\(.*\\) .*\r
959 $prompt $" { pass "backtrace from call7j" }
960 -re "$prompt $" { fail "backtrace from call7j" ; return }
961 timeout { fail "(timeout) backtrace from call7j" ; return }
964 # Continue; should stop at call7k and print actual arguments.
969 -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
970 -re "$prompt $" { fail "continue to call7k" ; return }
971 timeout { fail "(timeout) continue to call7k" ; return }
974 send "backtrace 100\n"
976 -re "backtrace 100\[\r\n\]+
977 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
978 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
979 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
980 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
981 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
982 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
983 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
984 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
985 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
986 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
987 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
988 .* main \\(.*\\) .*\r
989 $prompt $" { pass "backtrace from call7k" }
990 -re "$prompt $" { fail "backtrace from call7k" ; return }
991 timeout { fail "(timeout) backtrace from call7k" ; return }
996 # Locate actual args; recursive passing of structs by value
999 proc recursive_structs_by_value {} {
1007 send "break hitbottom\n" ; expect -re ".*$prompt $"
1009 # Run; should stop at hitbottom and print actual arguments.
1013 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
1014 -re "$prompt $" { fail "run to hitbottom" ; return }
1015 timeout { fail "(timeout) run to hitbottom" ; return }
1018 # The a29k fails all of these tests, perhaps because the prologue
1020 setup_xfail "a29k-*-udi"
1021 send "backtrace 100\n"
1023 -re "backtrace 100\[\r\n\]+
1024 .* hitbottom \\(\\) .*\r
1025 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
1026 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
1027 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
1028 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
1029 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
1030 .* test_struct_args \\(\\) .*\r
1031 .* main \\(.*\\) .*\r
1032 $prompt $" { pass "recursive passing of structs by value" }
1033 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1034 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1038 proc funcargs_reload { } {
1044 if [istarget "mips-idt-*"] then {
1045 # Restart because IDT/SIM runs out of file descriptors.
1048 gdb_reinitialize_dir $srcdir/$subdir
1049 gdb_load $objdir/$subdir/$binfile
1054 # Test for accessing local stack variables in functions which call alloca
1056 proc localvars_after_alloca { } {
1062 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1064 # Print each arg as a double check to see if we can print
1065 # them here as well as with backtrace.
1067 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1068 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1069 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1070 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1071 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1072 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1076 -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
1077 timeout { fail "next in localvars_after_alloca()" ; return }
1080 # Print each arg as a double check to see if we can print
1081 # them here as well as with backtrace.
1083 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1084 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1085 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1086 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1088 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1091 proc call_after_alloca { } {
1097 if { ! [ runto call_after_alloca_subr ] } then { return 0 }
1099 # Print each arg as a double check to see if we can print
1100 # them here as well as with backtrace.
1102 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1103 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1104 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1105 gdb_test "print s" " = 1" "print s in call_after_alloca"
1106 gdb_test "print i" " = 2" "print i in call_after_alloca"
1107 gdb_test "print l" " = 3" "print l in call_after_alloca"
1109 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1110 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"
1114 # Test for accessing local stack variables, backtraces, finish,
1115 # and finally stepping into indirect calls. The point is that on the PA
1116 # these use a funky `dyncall' mechanism which GDB needs to know about.
1118 proc localvars_in_indirect_call { } {
1124 # Can not use "runto call0a" as call0a is called several times
1125 # during single run. Instead stop in a marker function and
1126 # take control from there.
1127 if { ! [ runto marker_indirect_call ] } then { return 0 }
1129 # break on the next call to call0a, then delete all the breakpoints
1130 # and start testing.
1131 gdb_test "break call0a" "Breakpoint .*" \
1132 "break call0a in localvars_in_indirect_call"
1133 gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
1136 # Print each arg as a double check to see if we can print
1137 # them here as well as with backtrace.
1139 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1140 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1141 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1142 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1143 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1144 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1146 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1147 gdb_test "backtrace 8" \
1148 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1149 "backtrace in indirectly called function"
1152 # "finish" brings us back to main. We then will try to step through
1153 # the second indirect call.
1154 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1155 # of the first indirect call. This is due to stack adjustment instructions
1156 # after the indirect call. In these cases we will step till we hit the
1157 # second indirect call.
1162 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
1166 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
1167 pass "finish from indirectly called function"
1170 fail "finish from indirectly called function"
1173 default { fail "finish from indirectly called function" ; return }
1176 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1177 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1178 "stepping into indirectly called function"
1181 # Start with a fresh gdb.
1183 # Test for stepping into indirect calls which may have trampolines (possibly
1184 # cascaded) on both the call path and the return path.
1185 # to handle trampolines.
1187 proc test_stepping_over_trampolines { } {
1192 # Stop in a marker function and take control from there.
1193 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1195 # Cater for gdb stopping in midline, see comment for finish above.
1198 -re "marker_call_with_trampolines ..;.*$prompt $" {
1202 -re "pointer_to_call_with_trampolines.*$prompt $" {
1203 pass "finish from marker_call_with_trampolines"
1206 fail "finish from marker_call_with_trampolines"
1208 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1211 # Try to step into the target function.
1212 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1213 "stepping into function called with trampolines"
1215 # Make we can backtrace and the argument looks correct. */
1216 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1217 "backtrace through call with trampolines"
1219 # Make sure we can get back to main.
1220 # Stepping back to main might stop again after the return statement
1221 # or immediately transfer control back to main if optimizations
1225 -re "main .* at.*$prompt $" {
1226 pass "stepping back to main from function called with trampolines" ;
1229 -re "\}.*End of call_with_trampolines.*$prompt $" {
1234 fail "stepping back to main from function called with trampolines"
1236 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1240 # Start with a fresh gdb.
1244 gdb_reinitialize_dir $srcdir/$subdir
1245 gdb_load $objdir/$subdir/$binfile
1247 source gdb.base/funcargs.ci
1251 unsigned_integral_args
1253 float_and_integral_args
1257 structs_by_reference
1265 recursive_structs_by_value
1267 localvars_after_alloca
1271 localvars_in_indirect_call
1273 test_stepping_over_trampolines