1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003,
2 # 2004 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 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
181 # The debug info. for "f" is not correct. It's a known bug.
182 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
185 -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" }
186 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
187 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
188 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
191 # Print each arg as a double check to see if we can print
192 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
193 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
194 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
195 gdb_test "print s" ".* = 1" "print s after run to call2a"
196 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
197 gdb_test "print i" ".* = 2" "print i after run to call2a"
198 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
199 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
200 gdb_test "print l" ".* = 3" "print l after run to call2a"
201 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
203 setup_xfail "rs6000-*-*"
204 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
205 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
206 # Continue; should stop at call2b and print actual arguments.
207 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"] {
211 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
212 # Continue; should stop at call2c and print actual arguments.
213 if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] {
217 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
218 # Continue; should stop at call2d and print actual arguments.
219 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"] {
223 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
224 # Continue; should stop at call2e and print actual arguments.
225 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"] {
229 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
230 # Continue; should stop at call2f and print actual arguments.
231 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"] {
235 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
236 # Continue; should stop at call2g and print actual arguments.
237 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"] {
241 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
242 # Continue; should stop at call2h and print actual arguments.
243 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"] {
247 # monitor only allows 8 breakpoints; w89k board allows 10, so
248 # break them up into two groups.
250 gdb_breakpoint call2i
252 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
253 # Continue; should stop at call2i and print actual arguments.
254 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"] {
257 gdb_stop_suppressing_tests;
261 # Locate actual args; dereference pointers to ints and floats.
264 proc pointer_args {} {
271 gdb_breakpoint call3a
272 gdb_breakpoint call3b
273 gdb_breakpoint call3c
275 # Run; should stop at call3a and print actual arguments.
276 # Try dereferencing the arguments.
280 -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
281 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
282 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
285 gdb_test "print *cp" ".* = 97 'a'"
286 gdb_test "print *sp" ".* = 1"
287 gdb_test "print *ip" ".* = 2"
288 gdb_test "print *lp" ".* = 3"
290 # Continue; should stop at call3b and print actual arguments.
291 # Try dereferencing the arguments.
292 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
296 gdb_test "print *ucp" ".* = 98 'b'"
297 gdb_test "print *usp" ".* = 6"
298 gdb_test "print *uip" ".* = 7"
299 gdb_test "print *ulp" ".* = 8"
301 # Continue; should stop at call3c and print actual arguments.
302 # Try dereferencing the arguments.
303 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
307 gdb_test "print *fp" ".* = 4"
308 gdb_test "print *dp" ".* = 5"
310 # pass "locate actual args, pointer types"
311 gdb_stop_suppressing_tests;
315 # Locate actual args; structures and unions passed by reference.
318 proc structs_by_reference {} {
322 global target_sizeof_int
323 global target_sizeof_long
324 global target_bigendian_p
328 gdb_breakpoint call4a
329 gdb_breakpoint call4b
331 # Run; should stop at call4a and print actual arguments.
332 # Try dereferencing the arguments.
336 -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
339 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
340 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
343 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
345 # Continue; should stop at call4b and print actual arguments.
347 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
349 # Try dereferencing the arguments.
350 if { $target_sizeof_long == $target_sizeof_int } {
351 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
352 "print *unp (sizeof long == sizeof int)"
353 } elseif { ! $target_bigendian_p } {
354 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
355 "print *unp (little-endian, sizeof long != sizeof int)"
356 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
357 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
358 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
359 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
360 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
361 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
363 fail "print *unp (unknown case)"
366 pass "locate actual args, structs/unions passed by reference"
367 gdb_stop_suppressing_tests;
371 # Locate actual args; structures and unions passed by value.
374 proc structs_by_value {} {
378 global target_sizeof_int
379 global target_sizeof_long
380 global target_bigendian_p
384 gdb_breakpoint call5a
385 gdb_breakpoint call5b
387 # Run; should stop at call5a and print actual arguments.
388 # Try dereferencing the arguments.
392 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
395 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
396 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
399 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
401 # Continue; should stop at call5b and print actual arguments.
402 if { $target_sizeof_long == $target_sizeof_int } {
403 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
404 "continue to call5b (sizeof long == sizeof int)"
405 } elseif { ! $target_bigendian_p } {
406 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
407 "continue to call5b (little-endian, sizeof long != sizeof int)"
408 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
409 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
410 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
411 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
412 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
413 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
415 fail "continue to call5b (unknown case)"
418 # Try dereferencing the arguments.
419 if { $target_sizeof_long == $target_sizeof_int } {
420 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
421 "print un (sizeof long == sizeof int)"
422 } elseif { ! $target_bigendian_p } {
423 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
424 "print un (little-endian, sizeof long != sizeof int)"
425 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
426 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
427 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
428 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
429 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
430 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
432 fail "print un (unknown case)"
435 gdb_stop_suppressing_tests;
439 # Locate actual args; discard, shuffle, and call
442 proc discard_and_shuffle {} {
448 global hp_cc_compiler
452 gdb_breakpoint call6a
453 gdb_breakpoint call6b
454 gdb_breakpoint call6c
455 gdb_breakpoint call6d
456 gdb_breakpoint call6e
457 gdb_breakpoint call6f
458 gdb_breakpoint call6g
459 gdb_breakpoint call6h
461 # Run; should stop at call6a and print actual arguments.
466 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
467 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
468 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
471 setup_xfail "rs6000-*-*"
473 if {!$gcc_compiled} {
474 setup_xfail "mips-sgi-irix5*"
477 # The debug info. for "f" is not correct. It's a known bug.
478 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
479 send_gdb "backtrace 100\n"
481 -re "backtrace 100\[\r\n\]+
482 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
483 .* main \\(.*\\) .*\r
485 pass "backtrace from call6a"
487 -re "backtrace 100\[\r\n\]+
488 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
489 .* main \\(.*\\) .*\r
491 xfail "backtrace from call6a"
493 -re "$gdb_prompt $" {
494 fail "backtrace from call6a"
498 fail "(timeout) backtrace from call6a"
503 # Continue; should stop at call6b and print actual arguments.
508 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
509 send_gdb "backtrace 100\n"
510 if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" {
511 ".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
512 ".*\[\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\\) "
513 ".*\[\r\n\]#2 .* main \\(.*\\) "
518 # Continue; should stop at call6c and print actual arguments.
523 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
524 send_gdb "backtrace 100\n"
525 if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" {
526 ".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
527 ".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
528 ".*\[\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\\) "
529 ".*\[\r\n\]#3 .* main \\(.*\\) "
533 # Continue; should stop at call6d and print actual arguments.
538 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
539 send_gdb "backtrace 100\n"
540 if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" {
541 ".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
542 ".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
543 ".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
544 ".*\[\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\\) "
545 ".*\[\r\n\]#4 .* main \\(.*\\) "
550 # Continue; should stop at call6e and print actual arguments.
555 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
556 send_gdb "backtrace 100\n"
557 if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" {
558 ".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
559 ".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
560 ".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
561 ".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
562 ".*\[\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\\) "
563 ".*\[\r\n\]#5 .* main \\(.*\\) "
568 # Continue; should stop at call6f and print actual arguments.
573 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
574 send_gdb "backtrace 100\n"
575 if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" {
576 ".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
577 ".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
578 ".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
579 ".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
580 ".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
581 ".*\[\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\\) "
582 ".*\[\r\n\]#6 .* main \\(.*\\) "
587 # Continue; should stop at call6g and print actual arguments.
592 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
593 send_gdb "backtrace 100\n"
594 if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" {
595 ".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
596 ".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
597 ".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
598 ".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 ".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
600 ".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
601 ".*\[\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\\) "
602 ".*\[\r\n\]#7 .* main \\(.*\\) "
607 # Continue; should stop at call6h and print actual arguments.
612 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
613 send_gdb "backtrace 100\n"
614 if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" {
615 ".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
616 ".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
617 ".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
618 ".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
619 ".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
620 ".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
621 ".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
622 ".*\[\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\\) "
623 ".*\[\r\n\]#8 .* main \\(.*\\) "
628 # monitor only allows 8 breakpoints; w89k board allows 10, so
629 # break them up into two groups.
631 gdb_breakpoint call6i
632 gdb_breakpoint call6j
633 gdb_breakpoint call6k
635 # Continue; should stop at call6i and print actual arguments.
640 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
641 send_gdb "backtrace 100\n"
642 if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" {
643 ".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
644 ".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
645 ".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
646 ".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
647 ".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 ".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 ".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
650 ".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
651 ".*\[\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\\) "
652 ".*\[\r\n\]#9 .* main \\(.*\\) "
657 # Continue; should stop at call6j and print actual arguments.
662 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
663 send_gdb "backtrace 100\n"
664 if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" {
665 ".*\[\r\n\]#0 .* call6j \\(ul=8\\) "
666 ".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
667 ".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
668 ".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
669 ".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
670 ".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
671 ".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 ".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
673 ".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
674 ".*\[\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\\) "
675 ".*\[\r\n\]#10 .* main \\(.*\\) "
680 # Continue; should stop at call6k and print actual arguments.
684 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
685 send_gdb "backtrace 100\n"
686 if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" {
687 ".*\[\r\n\]#0 .* call6k \\(\\) "
688 ".*\[\r\n\]#1 .* call6j \\(ul=8\\) "
689 ".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
690 ".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
691 ".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
692 ".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
693 ".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
694 ".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
695 ".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
696 ".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
697 ".*\[\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\\) "
698 ".*\[\r\n\]#11 .* main \\(.*\\) "
702 gdb_stop_suppressing_tests;
707 # Locate actual args; shuffle round robin and call
710 proc shuffle_round_robin {} {
716 global hp_cc_compiler
720 gdb_breakpoint call7a
721 gdb_breakpoint call7b
722 gdb_breakpoint call7c
723 gdb_breakpoint call7d
724 gdb_breakpoint call7e
725 gdb_breakpoint call7f
726 gdb_breakpoint call7g
727 gdb_breakpoint call7h
729 # Run; should stop at call7a and print actual arguments.
734 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
737 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
738 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
741 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
742 # The debug info. for "f" is not correct. It's a known bug.
743 if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*}
744 send_gdb "backtrace 100\n"
746 -re "backtrace 100\[\r\n\]+
747 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
748 .* main \\(.*\\) .*\r
750 pass "backtrace from call7a"
752 -re "backtrace 100\[\r\n\]+
753 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
754 .* main \\(.*\\) .*\r
756 xfail "backtrace from call7a"
758 -re "$gdb_prompt $" { fail "backtrace from call7a" ; return }
759 timeout { fail "(timeout) backtrace from call7a" ; return }
762 # Continue; should stop at call7b and print actual arguments.
767 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
769 send_gdb "backtrace 100\n"
770 gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" {
771 ".*\[\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'\\) "
772 ".*\[\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\\) "
773 ".*\[\r\n\]#2 .* main \\(.*\\) "
776 # Continue; should stop at call7c and print actual arguments.
781 send_gdb "backtrace 100\n"
782 gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" {
783 ".*\[\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\\) "
784 ".*\[\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'\\) "
785 ".*\[\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\\) "
786 ".*\[\r\n\]#3 .* main \\(.*\\) "
789 # Continue; should stop at call7d and print actual arguments.
794 send_gdb "backtrace 100\n"
795 gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" {
796 ".*\[\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\\) "
797 ".*\[\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\\) "
798 ".*\[\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'\\) "
799 ".*\[\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\\) "
800 ".*\[\r\n\]#4 .* main \\(.*\\) "
805 send_gdb "backtrace 100\n"
806 gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" {
807 ".*\[\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\\) "
808 ".*\[\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\\) "
809 ".*\[\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\\) "
810 ".*\[\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'\\) "
811 ".*\[\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\\) "
812 ".*\[\r\n\]#5 .* main \\(.*\\) "
815 # Continue; should stop at call7f and print actual arguments.
820 send_gdb "backtrace 100\n"
821 gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" {
822 ".*\[\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\\) "
823 ".*\[\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\\) "
824 ".*\[\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\\) "
825 ".*\[\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\\) "
826 ".*\[\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'\\) "
827 ".*\[\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\\) "
828 ".*\[\r\n\]#6 .* main \\(.*\\) "
831 # Continue; should stop at call7g and print actual arguments.
836 send_gdb "backtrace 100\n"
837 gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" {
838 ".*\[\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'\\) "
839 ".*\[\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\\) "
840 ".*\[\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\\) "
841 ".*\[\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\\) "
842 ".*\[\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\\) "
843 ".*\[\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'\\) "
844 ".*\[\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\\) "
845 ".*\[\r\n\]#7 .* main \\(.*\\) "
850 send_gdb "backtrace 100\n"
851 gdb_expect_list "backtrace from call7h" ".*$gdb_prompt $" {
852 ".*\[\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\\) "
853 ".*\[\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'\\) "
854 ".*\[\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\\) "
855 ".*\[\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\\) "
856 ".*\[\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\\) "
857 ".*\[\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\\) "
858 ".*\[\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'\\) "
859 ".*\[\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\\) "
860 ".*\[\r\n\]#8 .* main \\(.*\\) "
863 # monitor only allows 8 breakpoints; w89k board allows 10, so
864 # break them up into two groups.
866 gdb_breakpoint call7i
867 gdb_breakpoint call7j
868 gdb_breakpoint call7k
870 # Continue; should stop at call7i and print actual arguments.
875 send_gdb "backtrace 100\n"
876 gdb_expect_list "backtrace from call7i" ".*$gdb_prompt $" {
877 ".*\[\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\\) "
878 ".*\[\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\\) "
879 ".*\[\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'\\) "
880 ".*\[\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\\) "
881 ".*\[\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\\) "
882 ".*\[\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\\) "
883 ".*\[\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\\) "
884 ".*\[\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'\\) "
885 ".*\[\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\\) "
886 ".*\[\r\n\]#9 .* main \\(.*\\) "
889 # Continue; should stop at call7j and print actual arguments.
894 send_gdb "backtrace 100\n"
895 gdb_expect_list "backtrace from call7j" ".*$gdb_prompt $" {
896 ".*\[\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\\) "
897 ".*\[\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\\) "
898 ".*\[\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\\) "
899 ".*\[\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'\\) "
900 ".*\[\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\\) "
901 ".*\[\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\\) "
902 ".*\[\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\\) "
903 ".*\[\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\\) "
904 ".*\[\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'\\) "
905 ".*\[\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\\) "
906 ".*\[\r\n\]#10 .* main \\(.*\\) "
909 # Continue; should stop at call7k and print actual arguments.
914 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
915 send_gdb "backtrace 100\n"
916 gdb_expect_list "backtrace from call7k" ".*$gdb_prompt $" {
917 ".*\[\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\\) "
918 ".*\[\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\\) "
919 ".*\[\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\\) "
920 ".*\[\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\\) "
921 ".*\[\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'\\) "
922 ".*\[\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\\) "
923 ".*\[\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\\) "
924 ".*\[\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\\) "
925 ".*\[\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\\) "
926 ".*\[\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'\\) "
927 ".*\[\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\\) "
928 ".*\[\r\n\]#11 .* main \\(.*\\) "
930 gdb_stop_suppressing_tests;
934 # Locate actual args; recursive passing of structs by value
937 proc recursive_structs_by_value {} {
945 gdb_breakpoint hitbottom
947 # Run; should stop at hitbottom and print actual arguments.
951 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
952 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
953 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
956 if ![istarget sparclet-*-*] {
957 send_gdb "backtrace 100\n"
958 gdb_expect_list "recursive passing of structs by value" ".*$gdb_prompt $" {
959 ".*\[\r\n\]#0 .* hitbottom \\(\\) "
960 ".*\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
961 ".*\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
962 ".*\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
963 ".*\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
964 ".*\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
965 ".*\[\r\n\]#6 .* test_struct_args \\(\\) "
966 ".*\[\r\n\]#7 .* main \\(.*\\) "
969 fail "recursive passing of structs by value (sparclet)"
971 gdb_stop_suppressing_tests;
974 proc funcargs_reload { } {
980 if [istarget "mips-idt-*"] {
981 # Restart because IDT/SIM runs out of file descriptors.
984 gdb_reinitialize_dir $srcdir/$subdir
990 # Test for accessing local stack variables in functions which call alloca
992 proc localvars_after_alloca { } {
998 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
1000 # Print each arg as a double check to see if we can print
1001 # them here as well as with backtrace.
1003 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1004 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1005 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1006 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1007 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1008 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1011 gdb_test "next" ".*" "next in localvars_after_alloca()"
1013 # Print each arg as a double check to see if we can print
1014 # them here as well as with backtrace.
1016 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1017 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1018 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1019 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1021 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1022 gdb_stop_suppressing_tests;
1025 proc call_after_alloca { } {
1031 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
1033 # Print each arg as a double check to see if we can print
1034 # them here as well as with backtrace.
1036 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1037 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1038 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1039 gdb_test "print s" " = 1" "print s in call_after_alloca"
1040 gdb_test "print i" " = 2" "print i in call_after_alloca"
1041 gdb_test "print l" " = 3" "print l in call_after_alloca"
1043 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1044 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"
1045 gdb_stop_suppressing_tests;
1049 # Test for accessing local stack variables, backtraces, finish,
1050 # and finally stepping into indirect calls. The point is that on the PA
1051 # these use a funky `dyncall' mechanism which GDB needs to know about.
1053 proc localvars_in_indirect_call { } {
1059 # Can not use "runto call0a" as call0a is called several times
1060 # during single run. Instead stop in a marker function and
1061 # take control from there.
1062 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
1064 # break on the next call to call0a, then delete all the breakpoints
1065 # and start testing.
1066 gdb_breakpoint call0a
1070 # Print each arg as a double check to see if we can print
1071 # them here as well as with backtrace.
1073 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1074 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1075 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1076 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1077 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1078 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1080 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1081 gdb_test "backtrace 8" \
1082 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1083 "backtrace in indirectly called function"
1086 # "finish" brings us back to main. We then will try to step through
1087 # the second indirect call.
1088 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1089 # of the first indirect call. This is due to stack adjustment instructions
1090 # after the indirect call. In these cases we will step till we hit the
1091 # second indirect call.
1096 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1097 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1098 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test.
1102 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1103 pass "finish from indirectly called function"
1105 -re ".*$gdb_prompt $" {
1106 fail "finish from indirectly called function"
1109 default { fail "finish from indirectly called function" ; gdb_suppress_tests; }
1112 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1113 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1114 "stepping into indirectly called function"
1115 gdb_stop_suppressing_tests;
1119 # Test for stepping into indirect calls which may have trampolines (possibly
1120 # cascaded) on both the call path and the gdb_suppress_tests; path.
1121 # to handle trampolines.
1123 proc test_stepping_over_trampolines { } {
1128 # Stop in a marker function and take control from there.
1129 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1131 # Cater for gdb stopping in midline, see comment for finish above.
1134 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1138 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1139 pass "finish from marker_call_with_trampolines"
1141 -re ".*$gdb_prompt $" {
1142 fail "finish from marker_call_with_trampolines"
1144 default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; }
1147 # Try to step into the target function.
1148 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1149 "stepping into function called with trampolines"
1151 # Make we can backtrace and the argument looks correct. */
1152 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1153 "backtrace through call with trampolines"
1155 # Make sure we can get back to main.
1156 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1157 # or immediately transfer control back to main if optimizations
1161 -re "main .* at.*$gdb_prompt $" {
1162 pass "stepping back to main from function called with trampolines" ;
1165 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1169 -re ".*$gdb_prompt $" {
1170 fail "stepping back to main from function called with trampolines"
1172 default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; }
1174 gdb_stop_suppressing_tests;
1177 # Start with a fresh gdb.
1181 gdb_reinitialize_dir $srcdir/$subdir
1184 if [istarget "mips*tx39-*"] {
1190 # Determine expected output for unsigned long variables,
1191 # the output varies with sizeof (unsigned long).
1193 set target_sizeof_long 4
1194 send_gdb "print sizeof (long)\n"
1196 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1197 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 }
1198 -re ".*$gdb_prompt $" {
1199 fail "getting sizeof long"
1201 default { fail "(timeout) getting sizeof long" }
1204 set target_sizeof_int 4
1205 send_gdb "print sizeof (int)\n"
1207 -re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 }
1208 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1209 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 }
1210 -re ".*$gdb_prompt $" {
1211 fail "getting sizeof unsigned long"
1213 default { fail "(timeout) getting sizeof int" }
1216 set target_bigendian_p 1
1217 send_gdb "show endian\n"
1219 -re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
1220 -re ".*big endian.*$gdb_prompt $" { }
1221 -re ".*$gdb_prompt $" {
1222 fail "getting target endian"
1224 default { fail "(timeout) getting target endian" }
1231 unsigned_integral_args
1233 if {![target_info exists gdb,skip_float_tests]} {
1234 float_and_integral_args
1239 structs_by_reference
1247 recursive_structs_by_value
1249 localvars_after_alloca
1253 localvars_in_indirect_call
1255 test_stepping_over_trampolines