1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Please email any bugs, comments, and/or additions to this file to:
19 # bug-gdb@prep.ai.mit.edu
21 # This file was written by Fred Fish. (fnf@cygnus.com)
30 set testfile "funcargs"
31 set srcfile ${testfile}.c
32 set binfile ${objdir}/${subdir}/${testfile}
33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
34 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
37 # Create and source the file that provides information about the compiler
38 # used to compile the test case.
39 if [get_compiler_info ${binfile}] {
44 # Locate actual args; integral types.
47 proc integral_args {} {
60 # Run; should stop at call0a and print actual arguments.
61 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
64 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
67 -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
68 timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
71 # Print each arg as a double check to see if we can print
72 # them here as well as with backtrace.
73 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
74 gdb_test "print s" ".* = 1" "print s after run to call0a"
75 gdb_test "print i" ".* = 2" "print i after run to call0a"
76 gdb_test "print l " ".* = 3" "print l after run to call0a"
78 # Continue; should stop at call0b and print actual arguments.
79 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
83 # Continue; should stop at call0c and print actual arguments.
84 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
88 # Continue; should stop at call0d and print actual arguments.
89 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
93 # Continue; should stop at call0e and print actual arguments.
94 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 gdb_stop_suppressing_tests;
101 # Locate actual args; unsigned integral types.
104 proc unsigned_integral_args {} {
111 gdb_breakpoint call1a;
112 gdb_breakpoint call1b;
113 gdb_breakpoint call1c;
114 gdb_breakpoint call1d;
115 gdb_breakpoint call1e;
117 # Run; should stop at call1a and print actual arguments.
118 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
121 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
124 -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
125 timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
128 # Print each arg as a double check to see if we can print
129 # them here as well as with backtrace.
130 gdb_test "print uc" ".* = 98 'b'"
131 gdb_test "print us" ".* = 6"
132 gdb_test "print ui" ".* = 7"
133 gdb_test "print ul" ".* = 8"
135 # Continue; should stop at call1b and print actual arguments.
136 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
140 # Continue; should stop at call1c and print actual arguments.
141 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
145 # Continue; should stop at call1d and print actual arguments.
146 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
150 # Continue; should stop at call1e and print actual arguments.
151 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"] {
154 gdb_stop_suppressing_tests;
158 # Locate actual args; integrals mixed with floating point.
161 proc float_and_integral_args {} {
165 global hp_cc_compiler
169 gdb_breakpoint call2a
170 gdb_breakpoint call2b
171 gdb_breakpoint call2c
172 gdb_breakpoint call2d
173 gdb_breakpoint call2e
174 gdb_breakpoint call2f
175 gdb_breakpoint call2g
176 gdb_breakpoint call2h
178 # Run; should stop at call2a and print actual arguments.
180 setup_xfail "i960-*-*" 1813
181 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
182 # The debug info. for "f" is not correct. It's a known bug.
183 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
186 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" }
187 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
188 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
189 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
192 # Print each arg as a double check to see if we can print
193 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
194 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
195 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
196 gdb_test "print s" ".* = 1" "print s after run to call2a"
197 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
198 gdb_test "print i" ".* = 2" "print i after run to call2a"
199 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
200 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
201 gdb_test "print l" ".* = 3" "print l after run to call2a"
202 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
204 setup_xfail "rs6000-*-*"
205 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
206 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
207 # Continue; should stop at call2b and print actual arguments.
208 if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] {
212 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
213 # Continue; should stop at call2c and print actual arguments.
214 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"] {
218 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
219 # Continue; should stop at call2d and print actual arguments.
220 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"] {
224 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
225 # Continue; should stop at call2e and print actual arguments.
226 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"] {
230 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
231 # Continue; should stop at call2f and print actual arguments.
232 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"] {
236 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
237 # Continue; should stop at call2g and print actual arguments.
238 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"] {
242 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
243 # Continue; should stop at call2h and print actual arguments.
244 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"] {
248 # monitor only allows 8 breakpoints; w89k board allows 10, so
249 # break them up into two groups.
251 gdb_breakpoint call2i
253 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
254 # Continue; should stop at call2i and print actual arguments.
255 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"] {
258 gdb_stop_suppressing_tests;
262 # Locate actual args; dereference pointers to ints and floats.
265 proc pointer_args {} {
272 gdb_breakpoint call3a
273 gdb_breakpoint call3b
274 gdb_breakpoint call3c
276 # Run; should stop at call3a and print actual arguments.
277 # Try dereferencing the arguments.
281 -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
282 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
283 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
286 gdb_test "print *cp" ".* = 97 'a'"
287 gdb_test "print *sp" ".* = 1"
288 gdb_test "print *ip" ".* = 2"
289 gdb_test "print *lp" ".* = 3"
291 # Continue; should stop at call3b and print actual arguments.
292 # Try dereferencing the arguments.
293 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
297 gdb_test "print *ucp" ".* = 98 'b'"
298 gdb_test "print *usp" ".* = 6"
299 gdb_test "print *uip" ".* = 7"
300 gdb_test "print *ulp" ".* = 8"
302 # Continue; should stop at call3c and print actual arguments.
303 # Try dereferencing the arguments.
304 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
308 gdb_test "print *fp" ".* = 4"
309 gdb_test "print *dp" ".* = 5"
311 # pass "locate actual args, pointer types"
312 gdb_stop_suppressing_tests;
316 # Locate actual args; structures and unions passed by reference.
319 proc structs_by_reference {} {
323 global target_sizeof_int
324 global target_sizeof_long
325 global target_bigendian_p
329 gdb_breakpoint call4a
330 gdb_breakpoint call4b
332 # Run; should stop at call4a and print actual arguments.
333 # Try dereferencing the arguments.
337 -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
340 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
341 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
344 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
346 # Continue; should stop at call4b and print actual arguments.
348 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
350 # Try dereferencing the arguments.
351 if { $target_sizeof_long == $target_sizeof_int } {
352 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
353 "print *unp (sizeof long == sizeof int)"
354 } elseif { ! $target_bigendian_p } {
355 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
356 "print *unp (little-endian, sizeof long != sizeof int)"
357 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
358 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
359 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
360 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
361 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
362 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
364 fail "print *unp (unknown case)"
367 pass "locate actual args, structs/unions passed by reference"
368 gdb_stop_suppressing_tests;
372 # Locate actual args; structures and unions passed by value.
375 proc structs_by_value {} {
379 global target_sizeof_int
380 global target_sizeof_long
381 global target_bigendian_p
385 gdb_breakpoint call5a
386 gdb_breakpoint call5b
388 # Run; should stop at call5a and print actual arguments.
389 # Try dereferencing the arguments.
393 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
396 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
397 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
400 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
402 # Continue; should stop at call5b and print actual arguments.
403 if { $target_sizeof_long == $target_sizeof_int } {
404 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
405 "continue to call5b (sizeof long == sizeof int)"
406 } elseif { ! $target_bigendian_p } {
407 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
408 "continue to call5b (little-endian, sizeof long != sizeof int)"
409 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
410 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
411 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
412 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
413 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
414 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
416 fail "continue to call5b (unknown case)"
419 # Try dereferencing the arguments.
420 if { $target_sizeof_long == $target_sizeof_int } {
421 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
422 "print un (sizeof long == sizeof int)"
423 } elseif { ! $target_bigendian_p } {
424 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
425 "print un (little-endian, sizeof long != sizeof int)"
426 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
427 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
428 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
429 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
430 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
431 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
433 fail "print un (unknown case)"
436 gdb_stop_suppressing_tests;
440 # Locate actual args; discard, shuffle, and call
443 proc discard_and_shuffle {} {
449 global hp_cc_compiler
453 gdb_breakpoint call6a
454 gdb_breakpoint call6b
455 gdb_breakpoint call6c
456 gdb_breakpoint call6d
457 gdb_breakpoint call6e
458 gdb_breakpoint call6f
459 gdb_breakpoint call6g
460 gdb_breakpoint call6h
462 # Run; should stop at call6a and print actual arguments.
467 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
468 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
469 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
472 setup_xfail "rs6000-*-*"
474 if {!$gcc_compiled} {
475 setup_xfail "mips-sgi-irix5*"
478 # The debug info. for "f" is not correct. It's a known bug.
479 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
480 send_gdb "backtrace 100\n"
482 -re "backtrace 100\[\r\n\]+
483 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
484 .* main \\(.*\\) .*\r
486 pass "backtrace from call6a"
488 -re "backtrace 100\[\r\n\]+
489 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
490 .* main \\(.*\\) .*\r
492 xfail "backtrace from call6a"
494 -re "$gdb_prompt $" {
495 fail "backtrace from call6a"
499 fail "(timeout) backtrace from call6a"
504 # Continue; should stop at call6b and print actual arguments.
509 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
510 send_gdb "backtrace 100\n"
511 if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" {
512 ".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
513 ".*\[\r\n\]#1 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
514 ".*\[\r\n\]#2 .* main \\(.*\\) "
519 # Continue; should stop at call6c and print actual arguments.
524 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
525 send_gdb "backtrace 100\n"
526 if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" {
527 ".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
528 ".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
529 ".*\[\r\n\]#2 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
530 ".*\[\r\n\]#3 .* main \\(.*\\) "
534 # Continue; should stop at call6d and print actual arguments.
539 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
540 send_gdb "backtrace 100\n"
541 if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" {
542 ".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
543 ".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
544 ".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
545 ".*\[\r\n\]#3 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
546 ".*\[\r\n\]#4 .* main \\(.*\\) "
551 # Continue; should stop at call6e and print actual arguments.
556 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
557 send_gdb "backtrace 100\n"
558 if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" {
559 ".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
560 ".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
561 ".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
562 ".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
563 ".*\[\r\n\]#4 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
564 ".*\[\r\n\]#5 .* main \\(.*\\) "
569 # Continue; should stop at call6f and print actual arguments.
574 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
575 send_gdb "backtrace 100\n"
576 if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" {
577 ".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
578 ".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
579 ".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
580 ".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
581 ".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
582 ".*\[\r\n\]#5 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
583 ".*\[\r\n\]#6 .* main \\(.*\\) "
588 # Continue; should stop at call6g and print actual arguments.
593 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
594 send_gdb "backtrace 100\n"
595 if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" {
596 ".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
597 ".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
598 ".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 ".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
600 ".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
601 ".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
602 ".*\[\r\n\]#6 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
603 ".*\[\r\n\]#7 .* main \\(.*\\) "
608 # Continue; should stop at call6h and print actual arguments.
613 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
614 send_gdb "backtrace 100\n"
615 if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" {
616 ".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
617 ".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
618 ".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
619 ".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
620 ".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
621 ".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
622 ".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
623 ".*\[\r\n\]#7 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
624 ".*\[\r\n\]#8 .* main \\(.*\\) "
629 # monitor only allows 8 breakpoints; w89k board allows 10, so
630 # break them up into two groups.
632 gdb_breakpoint call6i
633 gdb_breakpoint call6j
634 gdb_breakpoint call6k
636 # Continue; should stop at call6i and print actual arguments.
641 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
642 send_gdb "backtrace 100\n"
643 if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" {
644 ".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
645 ".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
646 ".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
647 ".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 ".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 ".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
650 ".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
651 ".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
652 ".*\[\r\n\]#8 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
653 ".*\[\r\n\]#9 .* main \\(.*\\) "
658 # Continue; should stop at call6j and print actual arguments.
663 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
664 send_gdb "backtrace 100\n"
665 if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" {
666 ".*\[\r\n\]#0 .* call6j \\(ul=8\\) "
667 ".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
668 ".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
669 ".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
670 ".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
671 ".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 ".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
673 ".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
674 ".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
675 ".*\[\r\n\]#9 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
676 ".*\[\r\n\]#10 .* main \\(.*\\) "
681 # Continue; should stop at call6k and print actual arguments.
683 # This fails on i960-*-vxworks because gdb gets confused by
684 # breakpoints on adjacent instructions.
685 setup_xfail "i960-*-vxworks" 1786
688 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
689 send_gdb "backtrace 100\n"
690 if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" {
691 ".*\[\r\n\]#0 .* call6k \\(\\) "
692 ".*\[\r\n\]#1 .* call6j \\(ul=8\\) "
693 ".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
694 ".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
695 ".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
696 ".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
697 ".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
698 ".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
699 ".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
700 ".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
701 ".*\[\r\n\]#10 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
702 ".*\[\r\n\]#11 .* main \\(.*\\) "
706 gdb_stop_suppressing_tests;
711 # Locate actual args; shuffle round robin and call
714 proc shuffle_round_robin {} {
720 global hp_cc_compiler
724 gdb_breakpoint call7a
725 gdb_breakpoint call7b
726 gdb_breakpoint call7c
727 gdb_breakpoint call7d
728 gdb_breakpoint call7e
729 gdb_breakpoint call7f
730 gdb_breakpoint call7g
731 gdb_breakpoint call7h
733 # Run; should stop at call7a and print actual arguments.
738 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
741 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
742 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
745 setup_xfail "i960-*-*" 1813
746 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
747 # The debug info. for "f" is not correct. It's a known bug.
748 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
749 send_gdb "backtrace 100\n"
751 -re "backtrace 100\[\r\n\]+
752 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
753 .* main \\(.*\\) .*\r
755 pass "backtrace from call7a"
757 -re "backtrace 100\[\r\n\]+
758 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
759 .* main \\(.*\\) .*\r
761 xfail "backtrace from call7a"
763 -re "$gdb_prompt $" { fail "backtrace from call7a" ; return }
764 timeout { fail "(timeout) backtrace from call7a" ; return }
767 # Continue; should stop at call7b and print actual arguments.
772 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
774 send_gdb "backtrace 100\n"
775 gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" {
776 ".*\[\r\n\]#0 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
777 ".*\[\r\n\]#1 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
778 ".*\[\r\n\]#2 .* main \\(.*\\) "
781 # Continue; should stop at call7c and print actual arguments.
786 send_gdb "backtrace 100\n"
787 gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" {
788 ".*\[\r\n\]#0 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
789 ".*\[\r\n\]#1 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
790 ".*\[\r\n\]#2 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
791 ".*\[\r\n\]#3 .* main \\(.*\\) "
794 # Continue; should stop at call7d and print actual arguments.
799 send_gdb "backtrace 100\n"
800 gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" {
801 ".*\[\r\n\]#0 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
802 ".*\[\r\n\]#1 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
803 ".*\[\r\n\]#2 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
804 ".*\[\r\n\]#3 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
805 ".*\[\r\n\]#4 .* main \\(.*\\) "
810 send_gdb "backtrace 100\n"
811 gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" {
812 ".*\[\r\n\]#0 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
813 ".*\[\r\n\]#1 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
814 ".*\[\r\n\]#2 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
815 ".*\[\r\n\]#3 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
816 ".*\[\r\n\]#4 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
817 ".*\[\r\n\]#5 .* main \\(.*\\) "
820 # Continue; should stop at call7f and print actual arguments.
825 send_gdb "backtrace 100\n"
826 gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" {
827 ".*\[\r\n\]#0 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
828 ".*\[\r\n\]#1 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
829 ".*\[\r\n\]#2 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
830 ".*\[\r\n\]#3 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
831 ".*\[\r\n\]#4 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
832 ".*\[\r\n\]#5 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
833 ".*\[\r\n\]#6 .* main \\(.*\\) "
836 # Continue; should stop at call7g and print actual arguments.
841 send_gdb "backtrace 100\n"
842 gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" {
843 ".*\[\r\n\]#0 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
844 ".*\[\r\n\]#1 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
845 ".*\[\r\n\]#2 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
846 ".*\[\r\n\]#3 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
847 ".*\[\r\n\]#4 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
848 ".*\[\r\n\]#5 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
849 ".*\[\r\n\]#6 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
850 ".*\[\r\n\]#7 .* main \\(.*\\) "
855 send_gdb "backtrace 100\n"
856 gdb_expect_list "backtrace from call7h" ".*$gdb_prompt $" {
857 ".*\[\r\n\]#0 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
858 ".*\[\r\n\]#1 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
859 ".*\[\r\n\]#2 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
860 ".*\[\r\n\]#3 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
861 ".*\[\r\n\]#4 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
862 ".*\[\r\n\]#5 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
863 ".*\[\r\n\]#6 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
864 ".*\[\r\n\]#7 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
865 ".*\[\r\n\]#8 .* main \\(.*\\) "
868 # monitor only allows 8 breakpoints; w89k board allows 10, so
869 # break them up into two groups.
871 gdb_breakpoint call7i
872 gdb_breakpoint call7j
873 gdb_breakpoint call7k
875 # Continue; should stop at call7i and print actual arguments.
880 send_gdb "backtrace 100\n"
881 gdb_expect_list "backtrace from call7i" ".*$gdb_prompt $" {
882 ".*\[\r\n\]#0 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
883 ".*\[\r\n\]#1 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
884 ".*\[\r\n\]#2 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
885 ".*\[\r\n\]#3 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
886 ".*\[\r\n\]#4 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
887 ".*\[\r\n\]#5 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
888 ".*\[\r\n\]#6 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
889 ".*\[\r\n\]#7 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
890 ".*\[\r\n\]#8 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
891 ".*\[\r\n\]#9 .* main \\(.*\\) "
894 # Continue; should stop at call7j and print actual arguments.
899 send_gdb "backtrace 100\n"
900 gdb_expect_list "backtrace from call7j" ".*$gdb_prompt $" {
901 ".*\[\r\n\]#0 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
902 ".*\[\r\n\]#1 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
903 ".*\[\r\n\]#2 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
904 ".*\[\r\n\]#3 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
905 ".*\[\r\n\]#4 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
906 ".*\[\r\n\]#5 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
907 ".*\[\r\n\]#6 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
908 ".*\[\r\n\]#7 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
909 ".*\[\r\n\]#8 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
910 ".*\[\r\n\]#9 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
911 ".*\[\r\n\]#10 .* main \\(.*\\) "
914 # Continue; should stop at call7k and print actual arguments.
919 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
920 send_gdb "backtrace 100\n"
921 gdb_expect_list "backtrace from call7k" ".*$gdb_prompt $" {
922 ".*\[\r\n\]#0 .* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
923 ".*\[\r\n\]#1 .* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) "
924 ".*\[\r\n\]#2 .* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) "
925 ".*\[\r\n\]#3 .* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) "
926 ".*\[\r\n\]#4 .* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) "
927 ".*\[\r\n\]#5 .* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) "
928 ".*\[\r\n\]#6 .* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) "
929 ".*\[\r\n\]#7 .* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) "
930 ".*\[\r\n\]#8 .* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) "
931 ".*\[\r\n\]#9 .* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) "
932 ".*\[\r\n\]#10 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) "
933 ".*\[\r\n\]#11 .* main \\(.*\\) "
935 gdb_stop_suppressing_tests;
939 # Locate actual args; recursive passing of structs by value
942 proc recursive_structs_by_value {} {
950 gdb_breakpoint hitbottom
952 # Run; should stop at hitbottom and print actual arguments.
956 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
957 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
958 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
961 if ![istarget sparclet-*-*] {
962 send_gdb "backtrace 100\n"
963 gdb_expect_list "recursive passing of structs by value" ".*$gdb_prompt $" {
964 ".*\[\r\n\]#0 .* hitbottom \\(\\) "
965 ".*\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
966 ".*\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
967 ".*\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
968 ".*\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
969 ".*\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
970 ".*\[\r\n\]#6 .* test_struct_args \\(\\) "
971 ".*\[\r\n\]#7 .* main \\(.*\\) "
974 fail "recursive passing of structs by value (sparclet)"
976 gdb_stop_suppressing_tests;
979 proc funcargs_reload { } {
985 if [istarget "mips-idt-*"] {
986 # Restart because IDT/SIM runs out of file descriptors.
989 gdb_reinitialize_dir $srcdir/$subdir
995 # Test for accessing local stack variables in functions which call alloca
997 proc localvars_after_alloca { } {
1003 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
1005 # Print each arg as a double check to see if we can print
1006 # them here as well as with backtrace.
1008 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1009 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1010 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1011 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1012 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1013 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1016 gdb_test "next" ".*" "next in localvars_after_alloca()"
1018 # Print each arg as a double check to see if we can print
1019 # them here as well as with backtrace.
1021 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1022 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1023 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1024 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1026 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1027 gdb_stop_suppressing_tests;
1030 proc call_after_alloca { } {
1036 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
1038 # Print each arg as a double check to see if we can print
1039 # them here as well as with backtrace.
1041 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1042 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1043 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1044 gdb_test "print s" " = 1" "print s in call_after_alloca"
1045 gdb_test "print i" " = 2" "print i in call_after_alloca"
1046 gdb_test "print l" " = 3" "print l in call_after_alloca"
1048 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1049 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"
1050 gdb_stop_suppressing_tests;
1054 # Test for accessing local stack variables, backtraces, finish,
1055 # and finally stepping into indirect calls. The point is that on the PA
1056 # these use a funky `dyncall' mechanism which GDB needs to know about.
1058 proc localvars_in_indirect_call { } {
1064 # Can not use "runto call0a" as call0a is called several times
1065 # during single run. Instead stop in a marker function and
1066 # take control from there.
1067 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
1069 # break on the next call to call0a, then delete all the breakpoints
1070 # and start testing.
1071 gdb_breakpoint call0a
1075 # Print each arg as a double check to see if we can print
1076 # them here as well as with backtrace.
1078 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1079 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1080 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1081 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1082 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1083 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1085 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1086 gdb_test "backtrace 8" \
1087 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1088 "backtrace in indirectly called function"
1091 # "finish" brings us back to main. We then will try to step through
1092 # the second indirect call.
1093 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1094 # of the first indirect call. This is due to stack adjustment instructions
1095 # after the indirect call. In these cases we will step till we hit the
1096 # second indirect call.
1101 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1102 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1103 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test.
1107 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1108 pass "finish from indirectly called function"
1110 -re ".*$gdb_prompt $" {
1111 fail "finish from indirectly called function"
1114 default { fail "finish from indirectly called function" ; gdb_suppress_tests; }
1117 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1118 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1119 "stepping into indirectly called function"
1120 gdb_stop_suppressing_tests;
1124 # Test for stepping into indirect calls which may have trampolines (possibly
1125 # cascaded) on both the call path and the gdb_suppress_tests; path.
1126 # to handle trampolines.
1128 proc test_stepping_over_trampolines { } {
1133 # Stop in a marker function and take control from there.
1134 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1136 # Cater for gdb stopping in midline, see comment for finish above.
1139 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1143 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1144 pass "finish from marker_call_with_trampolines"
1146 -re ".*$gdb_prompt $" {
1147 fail "finish from marker_call_with_trampolines"
1149 default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; }
1152 # Try to step into the target function.
1153 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1154 "stepping into function called with trampolines"
1156 # Make we can backtrace and the argument looks correct. */
1157 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1158 "backtrace through call with trampolines"
1160 # Make sure we can get back to main.
1161 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1162 # or immediately transfer control back to main if optimizations
1166 -re "main .* at.*$gdb_prompt $" {
1167 pass "stepping back to main from function called with trampolines" ;
1170 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1174 -re ".*$gdb_prompt $" {
1175 fail "stepping back to main from function called with trampolines"
1177 default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; }
1179 gdb_stop_suppressing_tests;
1182 # Start with a fresh gdb.
1186 gdb_reinitialize_dir $srcdir/$subdir
1189 if [istarget "mips*tx39-*"] {
1191 } elseif [istarget "hppa*-hp-hpux*"] then {
1197 # Determine expected output for unsigned long variables,
1198 # the output varies with sizeof (unsigned long).
1200 set target_sizeof_long 4
1201 send_gdb "print sizeof (long)\n"
1203 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1204 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 }
1205 -re ".*$gdb_prompt $" {
1206 fail "getting sizeof long"
1208 default { fail "(timeout) getting sizeof long" }
1211 set target_sizeof_int 4
1212 send_gdb "print sizeof (int)\n"
1214 -re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 }
1215 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1216 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 }
1217 -re ".*$gdb_prompt $" {
1218 fail "getting sizeof unsigned long"
1220 default { fail "(timeout) getting sizeof int" }
1223 set target_bigendian_p 1
1224 send_gdb "show endian\n"
1226 -re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
1227 -re ".*big endian.*$gdb_prompt $" { }
1228 -re ".*$gdb_prompt $" {
1229 fail "getting target endian"
1231 default { fail "(timeout) getting target endian" }
1238 unsigned_integral_args
1240 if {![target_info exists gdb,skip_float_tests]} {
1241 float_and_integral_args
1246 structs_by_reference
1254 recursive_structs_by_value
1256 localvars_after_alloca
1260 localvars_in_indirect_call
1262 test_stepping_over_trampolines