1 # Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
29 set binfile "funcargs"
30 set srcfile $binfile.c
32 if ![file exists $objdir/$subdir/$binfile] then {
33 perror "$objdir/$subdir/$binfile does not exist."
38 # Locate actual args; integral types.
41 proc integral_args {} {
48 send "break call0a\n" ; expect -re ".*$prompt $"
49 send "break call0b\n" ; expect -re ".*$prompt $"
50 send "break call0c\n" ; expect -re ".*$prompt $"
51 send "break call0d\n" ; expect -re ".*$prompt $"
52 send "break call0e\n" ; expect -re ".*$prompt $"
54 # Run; should stop at call0a and print actual arguments.
55 # The a29k fails all of these tests, perhaps because the prologue
57 setup_xfail "a29k-*-udi"
58 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
61 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$prompt $" {
64 -re "$prompt $" { fail "run to call0a" ; return }
65 timeout { fail "(timeout) run to call0a" ; return }
68 # Print each arg as a double check to see if we can print
69 # them here as well as with backtrace.
70 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
71 gdb_test "print s" ".* = 1" "print s after run to call0a"
72 gdb_test "print i" ".* = 2" "print i after run to call0a"
73 gdb_test "print l " ".* = 3" "print l after run to call0a"
75 # Continue; should stop at call0b and print actual arguments.
76 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
80 # Continue; should stop at call0c and print actual arguments.
81 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
85 # Continue; should stop at call0d and print actual arguments.
86 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
90 # Continue; should stop at call0e and print actual arguments.
91 if [gdb_test "cont" ".* call0e \\(c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\\) .*" "continue to call0e" ] {
97 # Locate actual args; unsigned integral types.
100 proc unsigned_integral_args {} {
107 send "break call1a\n" ; expect -re ".*$prompt $"
108 send "break call1b\n" ; expect -re ".*$prompt $"
109 send "break call1c\n" ; expect -re ".*$prompt $"
110 send "break call1d\n" ; expect -re ".*$prompt $"
111 send "break call1e\n" ; expect -re ".*$prompt $"
113 # Run; should stop at call1a and print actual arguments.
114 # The a29k fails all of these tests, perhaps because the prologue
116 setup_xfail "a29k-*-udi"
117 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
120 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$prompt $" {
123 -re "$prompt $" { fail "run to call1a" ; return }
124 timeout { fail "(timeout) run to call1a" ; return }
127 # Print each arg as a double check to see if we can print
128 # them here as well as with backtrace.
129 gdb_test "print uc" ".* = 98 'b'"
130 gdb_test "print us" ".* = 6"
131 gdb_test "print ui" ".* = 7"
132 gdb_test "print ul" ".* = 8"
134 # Continue; should stop at call1b and print actual arguments.
135 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
139 # Continue; should stop at call1c and print actual arguments.
140 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
144 # Continue; should stop at call1d and print actual arguments.
145 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
149 # Continue; should stop at call1e and print actual arguments.
150 if [gdb_test "cont" ".* call1e \\(uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\\) .*" "continue to call1e"] {
156 # Locate actual args; integrals mixed with floating point.
159 proc float_and_integral_args {} {
166 send "break call2a\n" ; expect -re ".*$prompt $"
167 send "break call2b\n" ; expect -re ".*$prompt $"
168 send "break call2c\n" ; expect -re ".*$prompt $"
169 send "break call2d\n" ; expect -re ".*$prompt $"
170 send "break call2e\n" ; expect -re ".*$prompt $"
171 send "break call2f\n" ; expect -re ".*$prompt $"
172 send "break call2g\n" ; expect -re ".*$prompt $"
173 send "break call2h\n" ; expect -re ".*$prompt $"
175 # Run; should stop at call2a and print actual arguments.
177 setup_xfail "i960-*-*" 1813
178 # The a29k fails all of these tests, perhaps because the prologue
180 setup_xfail "a29k-*-udi"
181 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
184 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$prompt $" { pass "run to call2a" }
185 -re "$prompt $" { fail "run to call2a" ; return }
186 timeout { fail "(timeout) run to call2a" ; return }
189 # Print each arg as a double check to see if we can print
190 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
191 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
192 gdb_test "print s" ".* = 1" "print s after run to call2a"
193 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
194 gdb_test "print i" ".* = 2" "print i after run to call2a"
195 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
196 gdb_test "print l" ".* = 3" "print l after run to call2a"
197 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
199 setup_xfail "rs6000-*-*"
200 # Continue; should stop at call2b and print actual arguments.
201 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"] {
205 # Continue; should stop at call2c and print actual arguments.
206 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"] {
210 # Continue; should stop at call2d and print actual arguments.
211 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"] {
215 # Continue; should stop at call2e and print actual arguments.
216 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"] {
220 # Continue; should stop at call2f and print actual arguments.
221 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"] {
225 # Continue; should stop at call2g and print actual arguments.
226 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"] {
230 # Continue; should stop at call2h and print actual arguments.
231 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"] {
235 # monitor only allows 8 breakpoints; w89k board allows 10, so
236 # break them up into two groups.
238 send "break call2i\n" ; expect -re ".*$prompt $"
240 # Continue; should stop at call2i and print actual arguments.
241 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"] {
247 # Locate actual args; dereference pointers to ints and floats.
250 proc pointer_args {} {
257 send "break call3a\n" ; expect -re ".*$prompt $"
258 send "break call3b\n" ; expect -re ".*$prompt $"
259 send "break call3c\n" ; expect -re ".*$prompt $"
261 # Run; should stop at call3a and print actual arguments.
262 # Try dereferencing the arguments.
264 # The a29k fails all of these tests, perhaps because the prologue
266 setup_xfail "a29k-*-udi"
269 -re ".* call3a \\(cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\\) .*$prompt $" { pass "run to call3a" }
270 -re "$prompt $" { fail "run to call3a" ; return }
271 timeout { fail "(timeout) run to call3a" ; return }
274 gdb_test "print *cp" ".* = 97 'a'"
275 gdb_test "print *sp" ".* = 1"
276 gdb_test "print *ip" ".* = 2"
277 gdb_test "print *lp" ".* = 3"
279 # Continue; should stop at call3b and print actual arguments.
280 # Try dereferencing the arguments.
281 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
285 gdb_test "print *ucp" ".* = 98 'b'"
286 gdb_test "print *usp" ".* = 6"
287 gdb_test "print *uip" ".* = 7"
288 gdb_test "print *ulp" ".* = 8"
290 # Continue; should stop at call3c and print actual arguments.
291 # Try dereferencing the arguments.
292 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
296 gdb_test "print *fp" ".* = 4"
297 gdb_test "print *dp" ".* = 5"
299 pass "locate actual args, pointer types"
303 # Locate actual args; structures and unions passed by reference.
306 proc structs_by_reference {} {
313 send "break call4a\n" ; expect -re ".*$prompt $"
314 send "break call4b\n" ; expect -re ".*$prompt $"
316 # Run; should stop at call4a and print actual arguments.
317 # Try dereferencing the arguments.
319 # The a29k fails all of these tests, perhaps because the prologue
321 setup_xfail "a29k-*-udi"
324 -re ".* call4a \\(stp=$hex\\) .*$prompt $" {
327 -re "$prompt $" { fail "run to call4a" ; return }
328 timeout { fail "(timeout) run to call4a" ; return }
331 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
333 # Continue; should stop at call4b and print actual arguments.
334 # Try dereferencing the arguments.
336 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
338 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}"
340 pass "locate actual args, structs/unions passed by reference"
344 # Locate actual args; structures and unions passed by value.
347 proc structs_by_value {} {
354 send "break call5a\n" ; expect -re ".*$prompt $"
355 send "break call5b\n" ; expect -re ".*$prompt $"
357 # Run; should stop at call5a and print actual arguments.
358 # Try dereferencing the arguments.
360 # The a29k fails all of these tests, perhaps because the prologue
362 setup_xfail "a29k-*-udi"
365 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$prompt $" {
368 -re "$prompt $" { fail "run to call5a" ; return }
369 timeout { fail "(timeout) run to call5a" ; return }
372 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
374 # Continue; should stop at call5b and print actual arguments.
375 # Try dereferencing the arguments.
376 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
379 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}"
383 # Locate actual args; discard, shuffle, and call
386 proc discard_and_shuffle {} {
394 send "break call6a\n" ; expect -re ".*$prompt $"
395 send "break call6b\n" ; expect -re ".*$prompt $"
396 send "break call6c\n" ; expect -re ".*$prompt $"
397 send "break call6d\n" ; expect -re ".*$prompt $"
398 send "break call6e\n" ; expect -re ".*$prompt $"
399 send "break call6f\n" ; expect -re ".*$prompt $"
400 send "break call6g\n" ; expect -re ".*$prompt $"
401 send "break call6h\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 # monitor only allows 8 breakpoints; w89k board allows 10, so
596 # break them up into two groups.
598 send "break call6i\n" ; expect -re ".*$prompt $"
599 send "break call6j\n" ; expect -re ".*$prompt $"
600 send "break call6k\n" ; expect -re ".*$prompt $"
602 # Continue; should stop at call6i and print actual arguments.
607 -re ".*Breakpoint $decimal, call6i .*$prompt $" { pass "continue to call6i" }
608 -re "$prompt $" { fail "continue to call6i" ; return }
609 timeout { fail "(timeout) continue to call6i" ; return }
612 send "backtrace 100\n"
614 -re "backtrace 100\[\r\n\]+
615 .* call6i \\(ui=7, ul=8\\) .*\r
616 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
617 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
618 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
619 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
620 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
621 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
622 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
623 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
624 .* main \\(.*\\) .*\r
625 $prompt $" { pass "backtrace from call6i" }
626 -re "$prompt $" { fail "backtrace from call6i" ; return }
627 timeout { fail "(timeout) backtrace from call6i" ; return }
630 # Continue; should stop at call6j and print actual arguments.
635 -re ".*Breakpoint $decimal, call6j .*$prompt $" { pass "continue to call6j" }
636 -re "$prompt $" { fail "continue to call6j" ; return }
637 timeout { fail "(timeout) continue to call6j" ; return }
640 send "backtrace 100\n"
642 -re "backtrace 100\[\r\n\]+
643 .* call6j \\(ul=8\\) .*\r
644 .* call6i \\(ui=7, ul=8\\) .*\r
645 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
646 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
647 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
648 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
649 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
650 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
651 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
652 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
653 .* main \\(.*\\) .*\r
654 $prompt $" { pass "backtrace from call6j" }
655 -re "$prompt $" { fail "backtrace from call6j" ; return }
656 timeout { fail "(timeout) backtrace from call6j" ; return }
659 # Continue; should stop at call6k and print actual arguments.
661 # This fails on i960-*-vxworks because gdb gets confused by
662 # breakpoints on adjacent instructions.
663 setup_xfail "i960-*-vxworks" 1786
666 -re ".*Breakpoint $decimal, call6k .*$prompt $" {
667 pass "continue to call6k"
669 -re "$prompt $" { fail "continue to call6k"; return }
670 timeout { fail "(timeout) continue to call6k"; return }
673 send "backtrace 100\n"
675 -re "backtrace 100\[\r\n\]+
676 .* call6k \\(\\) .*\r
677 .* call6j \\(ul=8\\) .*\r
678 .* call6i \\(ui=7, ul=8\\) .*\r
679 .* call6h \\(us=6, ui=7, ul=8\\) .*\r
680 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\r
681 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
682 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
683 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
684 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
685 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
686 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
687 .* main \\(.*\\) .*\r
688 $prompt $" { pass "backtrace from call6k" }
689 -re "$prompt $" { fail "backtrace from call6k" ; return }
690 timeout { fail "(timeout) backtrace from call6k" ; return }
695 # Locate actual args; shuffle round robin and call
698 proc shuffle_round_robin {} {
707 send "break call7a\n" ; expect -re ".*$prompt $"
708 send "break call7b\n" ; expect -re ".*$prompt $"
709 send "break call7c\n" ; expect -re ".*$prompt $"
710 send "break call7d\n" ; expect -re ".*$prompt $"
711 send "break call7e\n" ; expect -re ".*$prompt $"
712 send "break call7f\n" ; expect -re ".*$prompt $"
713 send "break call7g\n" ; expect -re ".*$prompt $"
714 send "break call7h\n" ; expect -re ".*$prompt $"
716 # Run; should stop at call7a and print actual arguments.
719 # The a29k fails all of these tests, perhaps because the prologue
721 setup_xfail "a29k-*-udi"
724 -re ".*Breakpoint $decimal, call7a .*$prompt $" {
727 -re "$prompt $" { fail "run to call7a" ; return }
728 timeout { fail "(timeout) run to call7a" ; return }
731 setup_xfail "i960-*-*" 1813
732 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
733 send "backtrace 100\n"
735 -re "backtrace 100\[\r\n\]+
736 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
737 .* main \\(.*\\) .*\r
738 $prompt $" { pass "backtrace from call7a" }
739 -re "$prompt $" { fail "backtrace from call7a" ; return }
740 timeout { fail "(timeout) backtrace from call7a" ; return }
743 # Continue; should stop at call7b and print actual arguments.
748 -re ".*Breakpoint $decimal, call7b .*$prompt $" { pass "continue to call7b" }
749 -re "$prompt $" { fail "continue to call7b" ; return }
750 timeout { fail "(timeout) continue to call7b" ; return }
753 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
754 send "backtrace 100\n"
756 -re "backtrace 100\[\r\n\]+
757 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
758 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
759 .* main \\(.*\\) .*\r
760 $prompt $" { pass "backtrace from call7b" }
761 -re "$prompt $" { fail "backtrace from call7b" ; return }
762 timeout { fail "(timeout) backtrace from call7b" ; return }
765 # Continue; should stop at call7c and print actual arguments.
770 -re ".*Breakpoint $decimal, call7c .*$prompt $" { pass "continue to call7c" }
771 -re "$prompt $" { fail "continue to call7c" ; return }
772 timeout { fail "(timeout) continue to call7c" ; return }
775 send "backtrace 100\n"
777 -re "backtrace 100\[\r\n\]+
778 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
779 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
780 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
781 .* main \\(.*\\) .*\r
782 $prompt $" { pass "backtrace from call7c" }
783 -re "$prompt $" { fail "backtrace from call7c" ; return }
784 timeout { fail "(timeout) backtrace from call7c" ; return }
787 # Continue; should stop at call7d and print actual arguments.
792 -re ".*Breakpoint $decimal, call7d .*$prompt $" { pass "continue to call7d" }
793 -re "$prompt $" { fail "continue to call7d" ; return }
794 timeout { fail "(timeout) continue to call7d" ; return }
797 send "backtrace 100\n"
799 -re "backtrace 100\[\r\n\]+
800 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
801 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
802 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
803 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
804 .* main \\(.*\\) .*\r
805 $prompt $" { pass "backtrace from call7d" }
806 -re "$prompt $" { fail "backtrace from call7d" ; return }
807 timeout { fail "(timeout) backtrace from call7d" ; return }
810 # Continue; should stop at call7e and print actual arguments.
815 -re "Breakpoint $decimal, call7e .*$prompt $" { pass "continue to call7e" }
816 -re "$prompt $" { fail "continue to call7e" ; return }
817 timeout { fail "(timeout) continue to call7e" ; return }
820 send "backtrace 100\n"
822 -re "backtrace 100\[\r\n\]+
823 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
824 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
825 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
826 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
827 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
828 .* main \\(.*\\) .*\r
829 $prompt $" { pass "backtrace from call7e" }
830 -re "$prompt $" { fail "backtrace from call7e" ; return }
831 timeout { fail "(timeout) backtrace from call7e" ; return }
834 # Continue; should stop at call7f and print actual arguments.
839 -re ".*Breakpoint $decimal, call7f .*$prompt $" { pass "continue to call7f" }
840 -re "$prompt $" { fail "continue to call7f" ; return }
841 timeout { fail "(timeout) continue to call7f" ; return }
844 send "backtrace 100\n"
846 -re "backtrace 100\[\r\n\]+
847 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
848 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
849 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
850 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
851 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
852 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
853 .* main \\(.*\\) .*\r
854 $prompt $" { pass "backtrace from call7f" }
855 -re "$prompt $" { fail "backtrace from call7f" ; return }
856 timeout { fail "(timeout) backtrace from call7f" ; return }
859 # Continue; should stop at call7g and print actual arguments.
864 -re ".*Breakpoint $decimal, call7g .*$prompt $" { pass "continue to call7g" }
865 -re "$prompt $" { fail "continue to call7g" ; return }
866 timeout { fail "(timeout) continue to call7g" ; return }
869 send "backtrace 100\n"
871 -re "backtrace 100\[\r\n\]+
872 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
873 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
874 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
875 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
876 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
877 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
878 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
879 .* main \\(.*\\) .*\r
880 $prompt $" { pass "backtrace from call7g" }
881 -re "$prompt $" { fail "backtrace from call7g" ; return }
882 timeout { fail "(timeout) backtrace from call7g" ; return }
885 # Continue; should stop at call7h and print actual arguments.
890 -re ".*Breakpoint $decimal, call7h .*$prompt $" { pass "continue to call7h" }
891 -re "$prompt $" { fail "continue to call7h" ; return }
892 timeout { fail "(timeout) continue to call7h" ; return }
895 send "backtrace 100\n"
897 -re "backtrace 100\[\r\n\]+
898 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
899 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
900 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
901 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
902 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
903 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
904 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
905 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
906 .* main \\(.*\\) .*\r
907 $prompt $" { pass "backtrace from call7h" }
908 -re "$prompt $" { fail "backtrace from call7h" ; return }
909 timeout { fail "(timeout) backtrace from call7h" ; return }
912 # Continue; should stop at call7i and print actual arguments.
917 -re ".*Breakpoint $decimal, call7i .*$prompt $" { pass "continue to call7i" }
918 -re "$prompt $" { fail "continue to call7i" ; return }
919 timeout { fail "(timeout) continue to call7i" ; return }
922 send "backtrace 100\n"
924 -re "backtrace 100\[\r\n\]+
925 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
926 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
927 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
928 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
929 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
930 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
931 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
932 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
933 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
934 .* main \\(.*\\) .*\r
935 $prompt $" { pass "backtrace from call7i" }
936 -re "$prompt $" { fail "backtrace from call7i" ; return }
937 timeout { fail "(timeout) backtrace from call7i" ; return }
940 # monitor only allows 8 breakpoints; w89k board allows 10, so
941 # break them up into two groups.
943 send "break call7i\n" ; expect -re ".*$prompt $"
944 send "break call7j\n" ; expect -re ".*$prompt $"
945 send "break call7k\n" ; expect -re ".*$prompt $"
947 # Continue; should stop at call7j and print actual arguments.
952 -re ".*Breakpoint $decimal, call7j .*$prompt $" { pass "continue to call7j" }
953 -re "$prompt $" { fail "continue to call7j" ; return }
954 timeout { fail "(timeout) continue to call7j" ; return }
957 send "backtrace 100\n"
959 -re "backtrace 100\[\r\n\]+
960 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
961 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
962 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
963 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
964 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
965 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
966 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
967 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
968 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
969 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
970 .* main \\(.*\\) .*\r
971 $prompt $" { pass "backtrace from call7j" }
972 -re "$prompt $" { fail "backtrace from call7j" ; return }
973 timeout { fail "(timeout) backtrace from call7j" ; return }
976 # Continue; should stop at call7k and print actual arguments.
981 -re ".*Breakpoint $decimal, call7k .*$prompt $" { pass "continue to call7k" }
982 -re "$prompt $" { fail "continue to call7k" ; return }
983 timeout { fail "(timeout) continue to call7k" ; return }
986 send "backtrace 100\n"
988 -re "backtrace 100\[\r\n\]+
989 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
990 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\r
991 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\r
992 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\r
993 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\r
994 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\r
995 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\r
996 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\r
997 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\r
998 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\r
999 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
1000 .* main \\(.*\\) .*\r
1001 $prompt $" { pass "backtrace from call7k" }
1002 -re "$prompt $" { fail "backtrace from call7k" ; return }
1003 timeout { fail "(timeout) backtrace from call7k" ; return }
1008 # Locate actual args; recursive passing of structs by value
1011 proc recursive_structs_by_value {} {
1019 send "break hitbottom\n" ; expect -re ".*$prompt $"
1021 # Run; should stop at hitbottom and print actual arguments.
1025 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" { pass "run to hitbottom" }
1026 -re "$prompt $" { fail "run to hitbottom" ; return }
1027 timeout { fail "(timeout) run to hitbottom" ; return }
1030 # The a29k fails all of these tests, perhaps because the prologue
1032 setup_xfail "a29k-*-udi"
1033 send "backtrace 100\n"
1035 -re "backtrace 100\[\r\n\]+
1036 .* hitbottom \\(\\) .*\r
1037 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\r
1038 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\r
1039 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\r
1040 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\r
1041 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\r
1042 .* test_struct_args \\(\\) .*\r
1043 .* main \\(.*\\) .*\r
1044 $prompt $" { pass "recursive passing of structs by value" }
1045 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1046 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1050 proc funcargs_reload { } {
1056 if [istarget "mips-idt-*"] then {
1057 # Restart because IDT/SIM runs out of file descriptors.
1060 gdb_reinitialize_dir $srcdir/$subdir
1061 gdb_load $objdir/$subdir/$binfile
1066 # Test for accessing local stack variables in functions which call alloca
1068 proc localvars_after_alloca { } {
1074 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1076 # Print each arg as a double check to see if we can print
1077 # them here as well as with backtrace.
1079 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1080 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1081 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1082 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1083 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1084 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1088 -re ".*$prompt $" { pass "next in localvars_after_alloca()" }
1089 timeout { fail "next in localvars_after_alloca()" ; return }
1092 # Print each arg as a double check to see if we can print
1093 # them here as well as with backtrace.
1095 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1096 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1097 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1098 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1100 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1103 proc call_after_alloca { } {
1109 if { ! [ runto call_after_alloca_subr ] } then { return 0 }
1111 # Print each arg as a double check to see if we can print
1112 # them here as well as with backtrace.
1114 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1115 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1116 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1117 gdb_test "print s" " = 1" "print s in call_after_alloca"
1118 gdb_test "print i" " = 2" "print i in call_after_alloca"
1119 gdb_test "print l" " = 3" "print l in call_after_alloca"
1121 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1122 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"
1126 # Test for accessing local stack variables, backtraces, finish,
1127 # and finally stepping into indirect calls. The point is that on the PA
1128 # these use a funky `dyncall' mechanism which GDB needs to know about.
1130 proc localvars_in_indirect_call { } {
1136 # Can not use "runto call0a" as call0a is called several times
1137 # during single run. Instead stop in a marker function and
1138 # take control from there.
1139 if { ! [ runto marker_indirect_call ] } then { return 0 }
1141 # break on the next call to call0a, then delete all the breakpoints
1142 # and start testing.
1143 gdb_test "break call0a" "Breakpoint .*" \
1144 "break call0a in localvars_in_indirect_call"
1145 gdb_test "continue" "call0a .*" "continue in localvars_in_indirect_call"
1148 # Print each arg as a double check to see if we can print
1149 # them here as well as with backtrace.
1151 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1152 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1153 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1154 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1155 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1156 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1158 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1159 gdb_test "backtrace 8" \
1160 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1161 "backtrace in indirectly called function"
1164 # "finish" brings us back to main. We then will try to step through
1165 # the second indirect call.
1166 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1167 # of the first indirect call. This is due to stack adjustment instructions
1168 # after the indirect call. In these cases we will step till we hit the
1169 # second indirect call.
1174 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$prompt $" {
1178 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$prompt $" {
1179 pass "finish from indirectly called function"
1182 fail "finish from indirectly called function"
1185 default { fail "finish from indirectly called function" ; return }
1188 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1189 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1190 "stepping into indirectly called function"
1193 # Start with a fresh gdb.
1195 # Test for stepping into indirect calls which may have trampolines (possibly
1196 # cascaded) on both the call path and the return path.
1197 # to handle trampolines.
1199 proc test_stepping_over_trampolines { } {
1204 # Stop in a marker function and take control from there.
1205 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1207 # Cater for gdb stopping in midline, see comment for finish above.
1210 -re "marker_call_with_trampolines ..;.*$prompt $" {
1214 -re "pointer_to_call_with_trampolines.*$prompt $" {
1215 pass "finish from marker_call_with_trampolines"
1218 fail "finish from marker_call_with_trampolines"
1220 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1223 # Try to step into the target function.
1224 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1225 "stepping into function called with trampolines"
1227 # Make we can backtrace and the argument looks correct. */
1228 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1229 "backtrace through call with trampolines"
1231 # Make sure we can get back to main.
1232 # Stepping back to main might stop again after the return statement
1233 # or immediately transfer control back to main if optimizations
1237 -re "main .* at.*$prompt $" {
1238 pass "stepping back to main from function called with trampolines" ;
1241 -re "\}.*End of call_with_trampolines.*$prompt $" {
1246 fail "stepping back to main from function called with trampolines"
1248 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1252 # Start with a fresh gdb.
1256 gdb_reinitialize_dir $srcdir/$subdir
1257 gdb_load $objdir/$subdir/$binfile
1259 source gdb.base/funcargs.ci
1263 unsigned_integral_args
1265 float_and_integral_args
1269 structs_by_reference
1277 recursive_structs_by_value
1279 localvars_after_alloca
1283 localvars_in_indirect_call
1285 test_stepping_over_trampolines