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 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
193 gdb_test "print fl" ".* = 4" "print f1 after run to call2a"
194 gdb_test "print s" ".* = 1" "print s after run to call2a"
195 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
196 gdb_test "print i" ".* = 2" "print i after run to call2a"
197 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
198 gdb_test "print l" ".* = 3" "print l after run to call2a"
199 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
201 setup_xfail "rs6000-*-*"
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 # Continue; should stop at call2g and print actual arguments.
228 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"] {
232 # Continue; should stop at call2h and print actual arguments.
233 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"] {
237 # Continue; should stop at call2i and print actual arguments.
238 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"] {
244 # Locate actual args; dereference pointers to ints and floats.
247 proc pointer_args {} {
254 send "break call3a\n" ; expect -re ".*$prompt $"
255 send "break call3b\n" ; expect -re ".*$prompt $"
256 send "break call3c\n" ; expect -re ".*$prompt $"
258 # Run; should stop at call3a and print actual arguments.
259 # Try dereferencing the arguments.
261 # The a29k fails all of these tests, perhaps because the prologue
263 setup_xfail "a29k-*-udi"
266 -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
267 -re "$prompt $" { fail "run to call3a" ; return }
268 timeout { fail "(timeout) run to call3a" ; return }
271 gdb_test "print *cp" ".* = 97 'a'"
272 gdb_test "print *sp" ".* = 1"
273 gdb_test "print *ip" ".* = 2"
274 gdb_test "print *lp" ".* = 3"
276 # Continue; should stop at call3b and print actual arguments.
277 # Try dereferencing the arguments.
278 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
282 gdb_test "print *ucp" ".* = 98 'b'"
283 gdb_test "print *usp" ".* = 6"
284 gdb_test "print *uip" ".* = 7"
285 gdb_test "print *ulp" ".* = 8"
287 # Continue; should stop at call3c and print actual arguments.
288 # Try dereferencing the arguments.
289 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
293 gdb_test "print *fp" ".* = 4"
294 gdb_test "print *dp" ".* = 5"
296 pass "locate actual args, pointer types"
300 # Locate actual args; structures and unions passed by reference.
303 proc structs_by_reference {} {
310 send "break call4a\n" ; expect -re ".*$prompt $"
311 send "break call4b\n" ; expect -re ".*$prompt $"
313 # Run; should stop at call4a and print actual arguments.
314 # Try dereferencing the arguments.
316 # The a29k fails all of these tests, perhaps because the prologue
318 setup_xfail "a29k-*-udi"
321 -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
324 -re "$prompt $" { fail "run to call4a" ; return }
325 timeout { fail "(timeout) run to call4a" ; return }
328 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
330 # Continue; should stop at call4b and print actual arguments.
331 # Try dereferencing the arguments.
333 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
335 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
337 pass "locate actual args, structs/unions passed by reference"
341 # Locate actual args; structures and unions passed by value.
344 proc structs_by_value {} {
351 send "break call5a\n" ; expect -re ".*$prompt $"
352 send "break call5b\n" ; expect -re ".*$prompt $"
354 # Run; should stop at call5a and print actual arguments.
355 # Try dereferencing the arguments.
357 # The a29k fails all of these tests, perhaps because the prologue
359 setup_xfail "a29k-*-udi"
362 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
365 -re "$prompt $" { fail "run to call5a" ; return }
366 timeout { fail "(timeout) run to call5a" ; return }
369 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
371 # Continue; should stop at call5b and print actual arguments.
372 # Try dereferencing the arguments.
373 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
376 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
380 # Locate actual args; discard, shuffle, and call
383 proc discard_and_shuffle {} {
391 send "break call6a\n" ; expect -re ".*$prompt $"
392 send "break call6b\n" ; expect -re ".*$prompt $"
393 send "break call6c\n" ; expect -re ".*$prompt $"
394 send "break call6d\n" ; expect -re ".*$prompt $"
395 send "break call6e\n" ; expect -re ".*$prompt $"
396 send "break call6f\n" ; expect -re ".*$prompt $"
397 send "break call6g\n" ; expect -re ".*$prompt $"
398 send "break call6h\n" ; expect -re ".*$prompt $"
399 send "break call6i\n" ; expect -re ".*$prompt $"
400 send "break call6j\n" ; expect -re ".*$prompt $"
401 send "break call6k\n" ; expect -re ".*$prompt $"
403 # Run; should stop at call6a and print actual arguments.
406 # The a29k fails all of these tests, perhaps because the prologue
408 setup_xfail "a29k-*-udi"
411 -re ".*Breakpoint $decimal, call6a .*$prompt $" { pass "run to call6a" }
412 -re "$prompt $" { fail "run to call6a" ; return }
413 timeout { fail "(timeout) run to call6a" ; return }
416 setup_xfail "rs6000-*-*"
417 send "backtrace 100\n"
419 -re "backtrace 100\[\r\n\]+
420 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
421 .* main \\(.*\\) .*\r
422 $prompt $" { pass "backtrace from call6a" }
423 -re "$prompt $" { fail "backtrace from call6a" ; return }
424 timeout { fail "(timeout) backtrace from call6a" ; return }
427 # Continue; should stop at call6b and print actual arguments.
432 -re ".*Breakpoint $decimal, call6b .*$prompt $" { pass "continue to call6b" }
433 -re "$prompt $" { fail "continue to call6b" ; return }
434 timeout { fail "(timeout) continue to call6b" ; return }
437 send "backtrace 100\n"
439 -re "backtrace 100\[\r\n]+
440 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
441 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
442 .* main \\(.*\\) .*\r
443 $prompt $" { pass "backtrace from call6b" }
444 -re "$prompt $" { fail "backtrace from call6b" ; return }
445 timeout { fail "(timeout) backtrace from call6b" ; return }
448 # Continue; should stop at call6c and print actual arguments.
453 -re ".*Breakpoint $decimal, call6c .*$prompt $" { pass "continue to call6c" }
454 -re "$prompt $" { fail "continue to call6c" ; return }
455 timeout { fail "(timeout) continue to call6c" ; return }
458 send "backtrace 100\n"
460 -re "backtrace 100\[\r\n\]+
461 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
462 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
463 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
464 .* main \\(.*\\) .*\r
465 $prompt $" { pass "backtrace from call6c" }
466 -re "$prompt $" { fail "backtrace from call6c" ; return }
467 timeout { fail "(timeout) backtrace from call6c" ; return }
470 # Continue; should stop at call6d and print actual arguments.
475 -re ".*Breakpoint $decimal, call6d .*$prompt $" { pass "continue to call6d" }
476 -re "$prompt $" { fail "continue to call6d" ; return }
477 timeout { fail "(timeout) continue to call6d" ; return }
480 send "backtrace 100\n"
482 -re "backtrace 100\[\r\n\]+
483 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
484 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
485 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
486 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
487 .* main \\(.*\\) .*\r
488 $prompt $" { pass "backtrace from call6d" }
489 -re "$prompt $" { fail "backtrace from call6d" ; return }
490 timeout { fail "(timeout) backtrace from call6d" ; return }
493 # Continue; should stop at call6e and print actual arguments.
498 -re ".*Breakpoint $decimal, call6e .*$prompt $" { pass "continue to call6e" }
499 -re "$prompt $" { fail "continue to call6e" ; return }
500 timeout { fail "(timeout) continue to call6e" ; return }
503 send "backtrace 100\n"
505 -re "backtrace 100\[\r\n\]+
506 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
507 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
508 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
509 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
510 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
511 .* main \\(.*\\) .*\r
512 $prompt $" { pass "backtrace from call6e" }
513 -re "$prompt $" { fail "backtrace from call6e" ; return }
514 timeout { fail "(timeout) backtrace from call6e" ; return }
517 # Continue; should stop at call6f and print actual arguments.
522 -re ".*Breakpoint $decimal, call6f .*$prompt $" { pass "continue to call6f" }
523 -re "$prompt $" { fail "continue to call6f" ; return }
524 timeout { fail "(timeout) continue to call6f" ; return }
527 send "backtrace 100\n"
529 -re "backtrace 100\[\r\n\]+
530 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
531 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
532 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
533 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
534 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
535 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
536 .* main \\(.*\\) .*\r
537 $prompt $" { pass "backtrace from call6f" }
538 -re "$prompt $" { fail "backtrace from call6f" ; return }
539 timeout { fail "(timeout) backtrace from call6f" ; return }
542 # Continue; should stop at call6g and print actual arguments.
547 -re ".*Breakpoint $decimal, call6g .*$prompt $" { pass "continue to call6g" }
548 -re "$prompt $" { fail "continue to call6g" ; return }
549 timeout { fail "(timeout) continue to call6g" ; return }
552 send "backtrace 100\n"
554 -re "backtrace 100\[\r\n\]+
555 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
556 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
557 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
558 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
559 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
560 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
561 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
562 .* main \\(.*\\) .*\r
563 $prompt $" { pass "backtrace from call6g" }
564 -re "$prompt $" { fail "backtrace from call6g" ; return }
565 timeout { fail "(timeout) backtrace from call6g" ; return }
568 # Continue; should stop at call6h and print actual arguments.
573 -re ".*Breakpoint $decimal, call6h .*$prompt $" { pass "continue to call6h" }
574 -re "$prompt $" { fail "continue to call6h" ; return }
575 timeout { fail "(timeout) continue to call6h" ; return }
578 send "backtrace 100\n"
580 -re "backtrace 100\[\r\n\]+
581 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
582 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
583 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
584 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
585 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
586 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
587 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
588 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
589 .* main \\(.*\\) .*\r
590 $prompt $" { pass "backtrace from call6h" }
591 -re "$prompt $" { fail "backtrace from call6h" ; return }
592 timeout { fail "(timeout) backtrace from call6h" ; return }
595 # Continue; should stop at call6i and print actual arguments.
600 -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
601 -re "$prompt $" { fail "continue to call6i" ; return }
602 timeout { fail "(timeout) continue to call6i" ; return }
605 send "backtrace 100\n"
607 -re "backtrace 100\[\r\n\]+
608 .* call6i \\(ui=7, ul=8\\) .*\r
609 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
610 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
611 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
612 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
613 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
614 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
615 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
616 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
617 .* main \\(.*\\) .*\r
618 $prompt $" { pass "backtrace from call6i" }
619 -re "$prompt $" { fail "backtrace from call6i" ; return }
620 timeout { fail "(timeout) backtrace from call6i" ; return }
623 # Continue; should stop at call6j and print actual arguments.
628 -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
629 -re "$prompt $" { fail "continue to call6j" ; return }
630 timeout { fail "(timeout) continue to call6j" ; return }
633 send "backtrace 100\n"
635 -re "backtrace 100\[\r\n\]+
636 .* call6j \\(ul=8\\) .*\r
637 .* call6i \\(ui=7, ul=8\\) .*\r
638 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
639 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
640 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
641 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
642 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
643 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
644 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
645 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
646 .* main \\(.*\\) .*\r
647 $prompt $" { pass "backtrace from call6j" }
648 -re "$prompt $" { fail "backtrace from call6j" ; return }
649 timeout { fail "(timeout) backtrace from call6j" ; return }
652 # Continue; should stop at call6k and print actual arguments.
654 # This fails on i960-*-vxworks because gdb gets confused by
655 # breakpoints on adjacent instructions.
656 setup_xfail "i960-*-vxworks" 1786
659 -re ".*Breakpoint $decimal, call6k .*$prompt $" {
660 pass "continue to call6k"
662 -re "$prompt $" { fail "continue to call6k"; return }
663 timeout { fail "(timeout) continue to call6k"; return }
666 send "backtrace 100\n"
668 -re "backtrace 100\[\r\n\]+
669 .* call6k \\(\\) .*\r
670 .* call6j \\(ul=8\\) .*\r
671 .* call6i \\(ui=7, ul=8\\) .*\r
672 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
673 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
674 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
675 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
676 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
677 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
678 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
679 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
680 .* main \\(.*\\) .*\r
681 $prompt $" { pass "backtrace from call6k" }
682 -re "$prompt $" { fail "backtrace from call6k" ; return }
683 timeout { fail "(timeout) backtrace from call6k" ; return }
688 # Locate actual args; shuffle round robin and call
691 proc shuffle_round_robin {} {
700 send "break call7a\n" ; expect -re ".*$prompt $"
701 send "break call7b\n" ; expect -re ".*$prompt $"
702 send "break call7c\n" ; expect -re ".*$prompt $"
703 send "break call7d\n" ; expect -re ".*$prompt $"
704 send "break call7e\n" ; expect -re ".*$prompt $"
705 send "break call7f\n" ; expect -re ".*$prompt $"
706 send "break call7g\n" ; expect -re ".*$prompt $"
707 send "break call7h\n" ; expect -re ".*$prompt $"
708 send "break call7i\n" ; expect -re ".*$prompt $"
709 send "break call7j\n" ; expect -re ".*$prompt $"
710 send "break call7k\n" ; expect -re ".*$prompt $"
712 # Run; should stop at call7a and print actual arguments.
715 # The a29k fails all of these tests, perhaps because the prologue
717 setup_xfail "a29k-*-udi"
720 -re ".*Breakpoint $decimal, call7a .*$prompt $" {
723 -re "$prompt $" { fail "run to call7a" ; return }
724 timeout { fail "(timeout) run to call7a" ; return }
727 setup_xfail "i960-*-*" 1813
728 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
729 send "backtrace 100\n"
731 -re "backtrace 100\[\r\n\]+
732 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
733 .* main \\(.*\\) .*\r
734 $prompt $" { pass "backtrace from call7a" }
735 -re "$prompt $" { fail "backtrace from call7a" ; return }
736 timeout { fail "(timeout) backtrace from call7a" ; return }
739 # Continue; should stop at call7b and print actual arguments.
744 -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
745 -re "$prompt $" { fail "continue to call7b" ; return }
746 timeout { fail "(timeout) continue to call7b" ; return }
749 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
750 send "backtrace 100\n"
752 -re "backtrace 100\[\r\n\]+
753 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
754 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
755 .* main \\(.*\\) .*\r
756 $prompt $" { pass "backtrace from call7b" }
757 -re "$prompt $" { fail "backtrace from call7b" ; return }
758 timeout { fail "(timeout) backtrace from call7b" ; return }
761 # Continue; should stop at call7c and print actual arguments.
766 -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
767 -re "$prompt $" { fail "continue to call7c" ; return }
768 timeout { fail "(timeout) continue to call7c" ; return }
771 send "backtrace 100\n"
773 -re "backtrace 100\[\r\n\]+
774 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
775 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
776 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
777 .* main \\(.*\\) .*\r
778 $prompt $" { pass "backtrace from call7c" }
779 -re "$prompt $" { fail "backtrace from call7c" ; return }
780 timeout { fail "(timeout) backtrace from call7c" ; return }
783 # Continue; should stop at call7d and print actual arguments.
788 -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
789 -re "$prompt $" { fail "continue to call7d" ; return }
790 timeout { fail "(timeout) continue to call7d" ; return }
793 send "backtrace 100\n"
795 -re "backtrace 100\[\r\n\]+
796 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
797 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
798 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
799 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
800 .* main \\(.*\\) .*\r
801 $prompt $" { pass "backtrace from call7d" }
802 -re "$prompt $" { fail "backtrace from call7d" ; return }
803 timeout { fail "(timeout) backtrace from call7d" ; return }
806 # Continue; should stop at call7e and print actual arguments.
811 -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
812 -re "$prompt $" { fail "continue to call7e" ; return }
813 timeout { fail "(timeout) continue to call7e" ; return }
816 send "backtrace 100\n"
818 -re "backtrace 100\[\r\n\]+
819 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
820 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
821 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
822 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
823 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
824 .* main \\(.*\\) .*\r
825 $prompt $" { pass "backtrace from call7e" }
826 -re "$prompt $" { fail "backtrace from call7e" ; return }
827 timeout { fail "(timeout) backtrace from call7e" ; return }
830 # Continue; should stop at call7f and print actual arguments.
835 -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
836 -re "$prompt $" { fail "continue to call7f" ; return }
837 timeout { fail "(timeout) continue to call7f" ; return }
840 send "backtrace 100\n"
842 -re "backtrace 100\[\r\n\]+
843 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
844 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
845 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
846 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
847 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
848 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
849 .* main \\(.*\\) .*\r
850 $prompt $" { pass "backtrace from call7f" }
851 -re "$prompt $" { fail "backtrace from call7f" ; return }
852 timeout { fail "(timeout) backtrace from call7f" ; return }
855 # Continue; should stop at call7g and print actual arguments.
860 -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
861 -re "$prompt $" { fail "continue to call7g" ; return }
862 timeout { fail "(timeout) continue to call7g" ; return }
865 send "backtrace 100\n"
867 -re "backtrace 100\[\r\n\]+
868 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
869 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
870 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
871 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
872 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
873 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
874 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
875 .* main \\(.*\\) .*\r
876 $prompt $" { pass "backtrace from call7g" }
877 -re "$prompt $" { fail "backtrace from call7g" ; return }
878 timeout { fail "(timeout) backtrace from call7g" ; return }
881 # Continue; should stop at call7h and print actual arguments.
886 -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
887 -re "$prompt $" { fail "continue to call7h" ; return }
888 timeout { fail "(timeout) continue to call7h" ; return }
891 send "backtrace 100\n"
893 -re "backtrace 100\[\r\n\]+
894 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
895 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
896 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
897 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
898 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
899 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
900 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
901 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
902 .* main \\(.*\\) .*\r
903 $prompt $" { pass "backtrace from call7h" }
904 -re "$prompt $" { fail "backtrace from call7h" ; return }
905 timeout { fail "(timeout) backtrace from call7h" ; return }
908 # Continue; should stop at call7i and print actual arguments.
913 -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
914 -re "$prompt $" { fail "continue to call7i" ; return }
915 timeout { fail "(timeout) continue to call7i" ; return }
918 send "backtrace 100\n"
920 -re "backtrace 100\[\r\n\]+
921 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
922 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
923 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
924 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
925 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
926 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
927 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
928 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
929 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
930 .* main \\(.*\\) .*\r
931 $prompt $" { pass "backtrace from call7i" }
932 -re "$prompt $" { fail "backtrace from call7i" ; return }
933 timeout { fail "(timeout) backtrace from call7i" ; return }
936 # Continue; should stop at call7j and print actual arguments.
941 -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
942 -re "$prompt $" { fail "continue to call7j" ; return }
943 timeout { fail "(timeout) continue to call7j" ; return }
946 send "backtrace 100\n"
948 -re "backtrace 100\[\r\n\]+
949 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
950 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
951 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
952 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
953 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
954 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
955 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
956 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
957 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
958 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
959 .* main \\(.*\\) .*\r
960 $prompt $" { pass "backtrace from call7j" }
961 -re "$prompt $" { fail "backtrace from call7j" ; return }
962 timeout { fail "(timeout) backtrace from call7j" ; return }
965 # Continue; should stop at call7k and print actual arguments.
970 -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
971 -re "$prompt $" { fail "continue to call7k" ; return }
972 timeout { fail "(timeout) continue to call7k" ; return }
975 send "backtrace 100\n"
977 -re "backtrace 100\[\r\n\]+
978 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
979 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
980 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
981 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
982 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
983 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
984 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
985 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
986 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
987 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
988 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
989 .* main \\(.*\\) .*\r
990 $prompt $" { pass "backtrace from call7k" }
991 -re "$prompt $" { fail "backtrace from call7k" ; return }
992 timeout { fail "(timeout) backtrace from call7k" ; return }
997 # Locate actual args; recursive passing of structs by value
1000 proc recursive_structs_by_value {} {
1008 send "break hitbottom\n" ; expect -re ".*$prompt $"
1010 # Run; should stop at hitbottom and print actual arguments.
1014 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
1015 -re "$prompt $" { fail "run to hitbottom" ; return }
1016 timeout { fail "(timeout) run to hitbottom" ; return }
1019 # The a29k fails all of these tests, perhaps because the prologue
1021 setup_xfail "a29k-*-udi"
1022 send "backtrace 100\n"
1024 -re "backtrace 100\[\r\n\]+
1025 .* hitbottom \\(\\) .*\r
1026 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
1027 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
1028 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
1029 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
1030 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
1031 .* test_struct_args \\(\\) .*\r
1032 .* main \\(.*\\) .*\r
1033 $prompt $" { pass "recursive passing of structs by value" }
1034 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1035 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1039 proc funcargs_reload { } {
1045 if [istarget "mips-idt-*"] then {
1046 # Restart because IDT/SIM runs out of file descriptors.
1049 gdb_reinitialize_dir $srcdir/$subdir
1050 gdb_load $objdir/$subdir/$binfile
1055 # Test for accessing local stack variables in functions which call alloca
1057 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 setup_xfail "rs6000-*-*"
1068 gdb_test "print c after runto localvars_after_alloca" " = 97 'a'"
1069 setup_xfail "rs6000-*-*"
1070 gdb_test "print s after runto localvars_after_alloca" " = 1"
1071 setup_xfail "rs6000-*-*"
1072 gdb_test "print i after runto localvars_after_alloca" " = 2"
1073 setup_xfail "rs6000-*-*"
1074 gdb_test "print l after runto localvars_after_alloca" " = 3"
1078 -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
1079 timeout { fail "next in localvars_after_alloca()" ; return }
1082 # Print each arg as a double check to see if we can print
1083 # them here as well as with backtrace.
1085 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1086 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1087 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1088 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1090 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1093 proc call_after_alloca { } {
1099 if { ! [ runto call_after_alloca_subr ] } then { return 0 }
1101 # Print each arg as a double check to see if we can print
1102 # them here as well as with backtrace.
1104 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1105 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1106 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1107 gdb_test "print s" " = 1" "print s in call_after_alloca"
1108 gdb_test "print i" " = 2" "print i in call_after_alloca"
1109 gdb_test "print l" " = 3" "print l in call_after_alloca"
1111 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1112 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"
1116 # Test for accessing local stack variables, backtraces, finish,
1117 # and finally stepping into indirect calls. The point is that on the PA
1118 # these use a funky `dyncall' mechanism which GDB needs to know about.
1120 proc localvars_in_indirect_call { } {
1126 # Can not use "runto call0a" as call0a is called several times
1127 # during single run. Instead stop in a marker function and
1128 # take control from there.
1129 if { ! [ runto marker_indirect_call ] } then { return 0 }
1131 # break on the next call to call0a, then delete all the breakpoints
1132 # and start testing.
1133 gdb_test "break call0a" "Breakpoint .*" \
1134 "break call0a in localvars_in_indirect_call"
1135 gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
1138 # Print each arg as a double check to see if we can print
1139 # them here as well as with backtrace.
1141 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1142 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1143 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1144 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1145 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1146 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1148 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1149 gdb_test "backtrace 8" \
1150 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1151 "backtrace in indirectly called function"
1154 # "finish" brings us back to main. We then will try to step through
1155 # the second indirect call.
1156 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1157 # of the first indirect call. This is due to stack adjustment instructions
1158 # after the indirect call. In these cases we will step till we hit the
1159 # second indirect call.
1164 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
1168 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
1169 pass "finish from indirectly called function"
1172 fail "finish from indirectly called function"
1175 default { fail "finish from indirectly called function" ; return }
1178 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1179 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1180 "stepping into indirectly called function"
1183 # Start with a fresh gdb.
1185 # Test for stepping into indirect calls which may have trampolines (possibly
1186 # cascaded) on both the call path and the return path.
1187 # to handle trampolines.
1189 proc test_stepping_over_trampolines { } {
1194 # Stop in a marker function and take control from there.
1195 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1197 # Cater for gdb stopping in midline, see comment for finish above.
1200 -re "marker_call_with_trampolines ..;.*$prompt $" {
1204 -re "pointer_to_call_with_trampolines.*$prompt $" {
1205 pass "finish from marker_call_with_trampolines"
1208 fail "finish from marker_call_with_trampolines"
1210 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1213 # Try to step into the target function.
1214 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1215 "stepping into function called with trampolines"
1217 # Make we can backtrace and the argument looks correct. */
1218 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1219 "backtrace through call with trampolines"
1221 # Make sure we can get back to main.
1222 # Stepping back to main might stop again after the return statement
1223 # or immediately transfer control back to main if optimizations
1227 -re "main .* at.*$prompt $" {
1228 pass "stepping back to main from function called with trampolines" ;
1231 -re "\}.*End of call_with_trampolines.*$prompt $" {
1236 fail "stepping back to main from function called with trampolines"
1238 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1242 # Start with a fresh gdb.
1246 gdb_reinitialize_dir $srcdir/$subdir
1247 gdb_load $objdir/$subdir/$binfile
1249 source gdb.base/funcargs.ci
1253 unsigned_integral_args
1255 float_and_integral_args
1259 structs_by_reference
1267 recursive_structs_by_value
1269 localvars_after_alloca
1273 localvars_in_indirect_call
1275 test_stepping_over_trampolines