1 # Copyright 1992, 1994-2000, 2002-2004, 2007-2012 Free Software
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 3 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, see <http://www.gnu.org/licenses/>.
17 # This file was written by Fred Fish. (fnf@cygnus.com)
20 set testfile "funcargs"
21 set srcfile ${testfile}.c
22 set binfile ${objdir}/${subdir}/${testfile}
24 set compile_flags {debug nowarnings quiet}
25 if [support_complex_tests] {
26 lappend compile_flags "additional_flags=-DTEST_COMPLEX"
29 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } {
34 # Create and source the file that provides information about the compiler
35 # used to compile the test case.
36 if [get_compiler_info] {
41 # Locate actual args; integral types.
44 proc integral_args {} {
57 # Run; should stop at call0a and print actual arguments.
58 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
61 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
64 -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
65 timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
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" ] {
94 gdb_stop_suppressing_tests;
98 # Locate actual args; unsigned integral types.
101 proc unsigned_integral_args {} {
108 gdb_breakpoint call1a;
109 gdb_breakpoint call1b;
110 gdb_breakpoint call1c;
111 gdb_breakpoint call1d;
112 gdb_breakpoint call1e;
114 # Run; should stop at call1a and print actual arguments.
115 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
118 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
121 -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
122 timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
125 # Print each arg as a double check to see if we can print
126 # them here as well as with backtrace.
127 gdb_test "print uc" ".* = 98 'b'"
128 gdb_test "print us" ".* = 6"
129 gdb_test "print ui" ".* = 7"
130 gdb_test "print ul" ".* = 8"
132 # Continue; should stop at call1b and print actual arguments.
133 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
137 # Continue; should stop at call1c and print actual arguments.
138 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
142 # Continue; should stop at call1d and print actual arguments.
143 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
147 # Continue; should stop at call1e and print actual arguments.
148 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"] {
151 gdb_stop_suppressing_tests;
155 # Locate actual args; integrals mixed with floating point.
158 proc float_and_integral_args {} {
165 gdb_breakpoint call2a
166 gdb_breakpoint call2b
167 gdb_breakpoint call2c
168 gdb_breakpoint call2d
169 gdb_breakpoint call2e
170 gdb_breakpoint call2f
171 gdb_breakpoint call2g
172 gdb_breakpoint call2h
174 # Run; should stop at call2a and print actual arguments.
176 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
179 -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" }
180 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
181 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
182 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
185 # Print each arg as a double check to see if we can print
186 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
187 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
188 gdb_test "print s" ".* = 1" "print s after run to call2a"
189 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
190 gdb_test "print i" ".* = 2" "print i after run to call2a"
191 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
192 gdb_test "print l" ".* = 3" "print l after run to call2a"
193 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
195 setup_xfail "rs6000-*-*"
196 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
197 # Continue; should stop at call2b and print actual arguments.
198 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"] {
202 # Continue; should stop at call2c and print actual arguments.
203 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"] {
207 # Continue; should stop at call2d and print actual arguments.
208 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"] {
212 # Continue; should stop at call2e and print actual arguments.
213 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"] {
217 # Continue; should stop at call2f and print actual arguments.
218 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"] {
222 # Continue; should stop at call2g and print actual arguments.
223 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"] {
227 # Continue; should stop at call2h and print actual arguments.
228 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"] {
232 # monitor only allows 8 breakpoints; w89k board allows 10, so
233 # break them up into two groups.
235 gdb_breakpoint call2i
237 # Continue; should stop at call2i and print actual arguments.
238 if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] {
241 gdb_stop_suppressing_tests;
246 # Locate actual args; _Complex types.
249 proc complex_args {} {
254 gdb_breakpoint callca
255 gdb_breakpoint callcb
256 gdb_breakpoint callcc
257 gdb_breakpoint callcd
258 gdb_breakpoint callce
259 gdb_breakpoint callcf
261 # Run; should stop at call1a and print actual arguments.
264 -re ".* callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\) .*$gdb_prompt $" { pass "run to call2a" }
265 timeout { fail "(timeout) run to callca" ; gdb_suppress_tests; }
267 gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4 \\* I\\) .*" "continue to callcb"
268 gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\+ 6 \\* I\\) .*" "continue to callcc"
269 gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "continue to callcd"
270 gdb_test "cont" ".* callce \\(dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I\\) .*" "continue to callce"
271 gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I\\) .*" "continue to callcf"
276 # Locate actual args; _Complex types and integral.
278 proc complex_integral_args {} {
283 gdb_breakpoint callc1a
284 gdb_breakpoint callc1b
286 # Run; should stop at call1a and print actual arguments.
289 -re ".* callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*$gdb_prompt $" { pass "run to callc1a" }
290 timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
292 gdb_test "cont" ".* callc1b \\(ldc1=5 \\+ 6 \\* I\\, c=97 'a', s=1, i=2, fc1=1 \\+ 2 \\* I, ui=7, l=3, dc1=3 \\+ 4 \\* I\\) .*" "continue to callc1b"
296 # Locate actual args; _Complex types and integral/float.
298 proc complex_float_integral_args {} {
303 gdb_breakpoint callc2a
304 gdb_breakpoint callc2b
306 # Run; should stop at call1a and print actual arguments.
309 -re ".* callc2a \\(c=97 'a', s=1, i=2, ui=7, l=3, f=4, d=5, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*$gdb_prompt $" { pass "run to callc2a" }
310 timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
312 gdb_test "cont" ".* callc2b \\(fc1=1 \\+ 2 \\* I, c=97 'a', s=1, i=2, ui=7, ldc1=5 \\+ 6 \\* I\\, l=3, f=4, d=5, dc1=3 \\+ 4 \\* I\\) .*" "continue to callc2b"
316 # Locate actual args; dereference pointers to ints and floats.
319 proc pointer_args {} {
326 gdb_breakpoint call3a
327 gdb_breakpoint call3b
328 gdb_breakpoint call3c
330 # Run; should stop at call3a and print actual arguments.
331 # Try dereferencing the arguments.
335 -re ".* call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*$gdb_prompt $" { pass "run to call3a" }
336 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
337 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
340 gdb_test "print *cp" ".* = 97 'a'"
341 gdb_test "print *sp" ".* = 1"
342 gdb_test "print *ip" ".* = 2"
343 gdb_test "print *lp" ".* = 3"
345 # Continue; should stop at call3b and print actual arguments.
346 # Try dereferencing the arguments.
347 if [gdb_test "cont" ".* call3b \\(ucp=$hex <uc> \"b.*\", usp=$hex <us>, uip=$hex <ui>, ulp=$hex <ul>\\) .*" "continue to call3b"] {
351 gdb_test "print *ucp" ".* = 98 'b'"
352 gdb_test "print *usp" ".* = 6"
353 gdb_test "print *uip" ".* = 7"
354 gdb_test "print *ulp" ".* = 8"
356 # Continue; should stop at call3c and print actual arguments.
357 # Try dereferencing the arguments.
358 if [gdb_test "cont" ".* call3c \\(fp=$hex <f>, dp=$hex <d>\\) .*" "continue to call3c"] {
362 gdb_test "print *fp" ".* = 4"
363 gdb_test "print *dp" ".* = 5"
365 # pass "locate actual args, pointer types"
366 gdb_stop_suppressing_tests;
370 # Locate actual args; structures and unions passed by reference.
373 proc structs_by_reference {} {
377 global target_sizeof_int
378 global target_sizeof_long
379 global target_bigendian_p
383 gdb_breakpoint call4a
384 gdb_breakpoint call4b
386 # Run; should stop at call4a and print actual arguments.
387 # Try dereferencing the arguments.
391 -re ".* call4a \\(stp=$hex <st>\\) .*$gdb_prompt $" {
394 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
395 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
398 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
400 # Continue; should stop at call4b and print actual arguments.
402 gdb_test "cont" ".* call4b \\(unp=$hex <un>\\) .*" "continue to call4b"
404 # Try dereferencing the arguments.
405 if { $target_sizeof_long == $target_sizeof_int } {
406 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
407 "print *unp (sizeof long == sizeof int)"
408 } elseif { ! $target_bigendian_p } {
409 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
410 "print *unp (little-endian, sizeof long != sizeof int)"
411 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
412 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
413 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
414 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
415 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
416 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
418 fail "print *unp (unknown case)"
421 pass "locate actual args, structs/unions passed by reference"
422 gdb_stop_suppressing_tests;
426 # Locate actual args; structures and unions passed by value.
429 proc structs_by_value {} {
433 global target_sizeof_int
434 global target_sizeof_long
435 global target_bigendian_p
439 gdb_breakpoint call5a
440 gdb_breakpoint call5b
442 # Run; should stop at call5a and print actual arguments.
443 # Try dereferencing the arguments.
447 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
450 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
451 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
454 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
456 # Continue; should stop at call5b and print actual arguments.
457 if { $target_sizeof_long == $target_sizeof_int } {
458 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
459 "continue to call5b (sizeof long == sizeof int)"
460 } elseif { ! $target_bigendian_p } {
461 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
462 "continue to call5b (little-endian, sizeof long != sizeof int)"
463 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
464 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
465 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
466 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
467 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
468 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
470 fail "continue to call5b (unknown case)"
473 # Try dereferencing the arguments.
474 if { $target_sizeof_long == $target_sizeof_int } {
475 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
476 "print un (sizeof long == sizeof int)"
477 } elseif { ! $target_bigendian_p } {
478 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
479 "print un (little-endian, sizeof long != sizeof int)"
480 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
481 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
482 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
483 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
484 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
485 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
487 fail "print un (unknown case)"
490 gdb_stop_suppressing_tests;
494 # Locate actual args; discard, shuffle, and call
497 proc discard_and_shuffle {} {
506 gdb_breakpoint call6a
507 gdb_breakpoint call6b
508 gdb_breakpoint call6c
509 gdb_breakpoint call6d
510 gdb_breakpoint call6e
511 gdb_breakpoint call6f
512 gdb_breakpoint call6g
513 gdb_breakpoint call6h
515 # Run; should stop at call6a and print actual arguments.
520 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
521 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
522 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
525 setup_xfail "rs6000-*-*"
527 if {!$gcc_compiled} {
528 setup_xfail "mips-sgi-irix5*"
531 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
532 -re " call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .* main \\(.*\\) .*$gdb_prompt $" {
533 pass "backtrace from call6a"
535 -re " call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .* main \\(.*\\) .*$gdb_prompt $" {
536 xfail "backtrace from call6a"
540 # Continue; should stop at call6b and print actual arguments.
545 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
546 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
547 "\[\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\\) "
548 "\[\r\n\]#2 .* main \\(.*\\) at "
553 # Continue; should stop at call6c and print actual arguments.
558 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
559 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
560 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
561 "\[\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\\) "
562 "\[\r\n\]#3 .* main \\(.*\\) at "
566 # Continue; should stop at call6d and print actual arguments.
571 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
572 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
573 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
574 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
575 "\[\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\\) "
576 "\[\r\n\]#4 .* main \\(.*\\) at "
581 # Continue; should stop at call6e and print actual arguments.
586 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
587 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
588 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
589 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
590 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
591 "\[\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\\) "
592 "\[\r\n\]#5 .* main \\(.*\\) at "
597 # Continue; should stop at call6f and print actual arguments.
602 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
603 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
604 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
605 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
606 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
607 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
608 "\[\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\\) "
609 "\[\r\n\]#6 .* main \\(.*\\) at "
614 # Continue; should stop at call6g and print actual arguments.
619 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
620 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
621 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
622 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
623 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
624 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
625 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
626 "\[\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\\) "
627 "\[\r\n\]#7 .* main \\(.*\\) at "
632 # Continue; should stop at call6h and print actual arguments.
637 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
638 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
639 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
640 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
641 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
642 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
643 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
644 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
645 "\[\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\\) "
646 "\[\r\n\]#8 .* main \\(.*\\) at "
651 # monitor only allows 8 breakpoints; w89k board allows 10, so
652 # break them up into two groups.
654 gdb_breakpoint call6i
655 gdb_breakpoint call6j
656 gdb_breakpoint call6k
658 # Continue; should stop at call6i and print actual arguments.
663 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
664 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
665 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
666 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
667 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
668 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
669 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
670 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
671 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 "\[\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\\) "
673 "\[\r\n\]#9 .* main \\(.*\\) at "
678 # Continue; should stop at call6j and print actual arguments.
683 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
684 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
685 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
686 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
687 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
688 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
689 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
690 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
691 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
692 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
693 "\[\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\\) "
694 "\[\r\n\]#10 .* main \\(.*\\) at "
699 # Continue; should stop at call6k and print actual arguments.
703 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
704 "\[\r\n\]#0 .* call6k \\(\\) "
705 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
706 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
707 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
708 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
709 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
710 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
711 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
712 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
713 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
714 "\[\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\\) "
715 "\[\r\n\]#11 .* main \\(.*\\) at "
719 gdb_stop_suppressing_tests;
724 # Locate actual args; shuffle round robin and call
727 proc shuffle_round_robin {} {
736 gdb_breakpoint call7a
737 gdb_breakpoint call7b
738 gdb_breakpoint call7c
739 gdb_breakpoint call7d
740 gdb_breakpoint call7e
741 gdb_breakpoint call7f
742 gdb_breakpoint call7g
743 gdb_breakpoint call7h
745 # Run; should stop at call7a and print actual arguments.
750 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
753 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
754 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
757 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
758 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
759 -re " call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .* main \\(.*\\) .*$gdb_prompt $" {
760 pass "backtrace from call7a"
762 -re " call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .* main \\(.*\\) .*$gdb_prompt $" {
763 xfail "backtrace from call7a"
767 # Continue; should stop at call7b and print actual arguments.
772 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
774 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
775 "\[\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'\\) "
776 "\[\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\\) "
777 "\[\r\n\]#2 .* main \\(.*\\) at "
780 # Continue; should stop at call7c and print actual arguments.
785 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
786 "\[\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\\) "
787 "\[\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'\\) "
788 "\[\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\\) "
789 "\[\r\n\]#3 .* main \\(.*\\) at "
792 # Continue; should stop at call7d and print actual arguments.
797 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
798 "\[\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\\) "
799 "\[\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\\) "
800 "\[\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'\\) "
801 "\[\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\\) "
802 "\[\r\n\]#4 .* main \\(.*\\) at "
807 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
808 "\[\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\\) "
809 "\[\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\\) "
810 "\[\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\\) "
811 "\[\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'\\) "
812 "\[\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\\) "
813 "\[\r\n\]#5 .* main \\(.*\\) at "
816 # Continue; should stop at call7f and print actual arguments.
821 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
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 \\(.*\\) at "
831 # Continue; should stop at call7g and print actual arguments.
836 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
837 "\[\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'\\) "
838 "\[\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\\) "
839 "\[\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\\) "
840 "\[\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\\) "
841 "\[\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\\) "
842 "\[\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'\\) "
843 "\[\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\\) "
844 "\[\r\n\]#7 .* main \\(.*\\) at "
849 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
850 "\[\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\\) "
851 "\[\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'\\) "
852 "\[\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\\) "
853 "\[\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\\) "
854 "\[\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\\) "
855 "\[\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\\) "
856 "\[\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'\\) "
857 "\[\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\\) "
858 "\[\r\n\]#8 .* main \\(.*\\) at "
861 # monitor only allows 8 breakpoints; w89k board allows 10, so
862 # break them up into two groups.
864 gdb_breakpoint call7i
865 gdb_breakpoint call7j
866 gdb_breakpoint call7k
868 # Continue; should stop at call7i and print actual arguments.
873 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
874 "\[\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\\) "
875 "\[\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\\) "
876 "\[\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'\\) "
877 "\[\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\\) "
878 "\[\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\\) "
879 "\[\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\\) "
880 "\[\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\\) "
881 "\[\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'\\) "
882 "\[\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\\) "
883 "\[\r\n\]#9 .* main \\(.*\\) at "
886 # Continue; should stop at call7j and print actual arguments.
891 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
892 "\[\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\\) "
893 "\[\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\\) "
894 "\[\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\\) "
895 "\[\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'\\) "
896 "\[\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\\) "
897 "\[\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\\) "
898 "\[\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\\) "
899 "\[\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\\) "
900 "\[\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'\\) "
901 "\[\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\\) "
902 "\[\r\n\]#10 .* main \\(.*\\) at "
905 # Continue; should stop at call7k and print actual arguments.
910 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
911 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
912 "\[\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\\) "
913 "\[\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\\) "
914 "\[\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\\) "
915 "\[\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\\) "
916 "\[\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'\\) "
917 "\[\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\\) "
918 "\[\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\\) "
919 "\[\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\\) "
920 "\[\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\\) "
921 "\[\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'\\) "
922 "\[\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\\) "
923 "\[\r\n\]#11 .* main \\(.*\\) at "
925 gdb_stop_suppressing_tests;
929 # Locate actual args; recursive passing of structs by value
932 proc recursive_structs_by_value {} {
940 gdb_breakpoint hitbottom
942 # Run; should stop at hitbottom and print actual arguments.
946 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
947 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
948 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
951 if ![istarget sparclet-*-*] {
952 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
953 "\[\r\n\]#0 .* hitbottom \\(\\) "
954 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
955 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
956 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
957 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
958 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
959 "\[\r\n\]#6 .* test_struct_args \\(\\) "
960 "\[\r\n\]#7 .* main \\(.*\\) at "
963 fail "recursive passing of structs by value (sparclet)"
965 gdb_stop_suppressing_tests;
969 # Test for accessing local stack variables in functions which call alloca
971 proc localvars_after_alloca { } {
977 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
979 # Print each arg as a double check to see if we can print
980 # them here as well as with backtrace.
982 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
983 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
984 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
985 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
986 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
987 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
990 gdb_test "next" ".*" "next in localvars_after_alloca()"
992 # Print each arg as a double check to see if we can print
993 # them here as well as with backtrace.
995 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
996 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
997 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
998 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1000 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1001 gdb_stop_suppressing_tests;
1004 proc call_after_alloca { } {
1010 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
1012 # Print each arg as a double check to see if we can print
1013 # them here as well as with backtrace.
1015 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1016 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1017 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1018 gdb_test "print s" " = 1" "print s in call_after_alloca"
1019 gdb_test "print i" " = 2" "print i in call_after_alloca"
1020 gdb_test "print l" " = 3" "print l in call_after_alloca"
1022 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1023 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"
1024 gdb_stop_suppressing_tests;
1028 # Test for accessing local stack variables, backtraces, finish,
1029 # and finally stepping into indirect calls. The point is that on the PA
1030 # these use a funky `dyncall' mechanism which GDB needs to know about.
1032 proc localvars_in_indirect_call { } {
1038 # Can not use "runto call0a" as call0a is called several times
1039 # during single run. Instead stop in a marker function and
1040 # take control from there.
1041 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
1043 # break on the next call to call0a, then delete all the breakpoints
1044 # and start testing.
1045 gdb_breakpoint call0a
1049 # Print each arg as a double check to see if we can print
1050 # them here as well as with backtrace.
1052 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1053 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1054 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1055 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1056 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1057 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1059 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1060 gdb_test "backtrace 8" \
1061 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1062 "backtrace in indirectly called function"
1065 # "finish" brings us back to main. We then will try to step through
1066 # the second indirect call.
1067 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1068 # of the first indirect call. This is due to stack adjustment instructions
1069 # after the indirect call. In these cases we will step till we hit the
1070 # second indirect call.
1073 gdb_test_multiple "finish" "finish from indirectly called function" {
1074 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1075 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1076 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary
1077 #to continue the test.
1081 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1082 pass "finish from indirectly called function"
1084 -re ".*$gdb_prompt $" {
1085 fail "finish from indirectly called function"
1089 fail "finish from indirectly called function"
1094 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1095 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1096 "stepping into indirectly called function"
1097 gdb_stop_suppressing_tests;
1101 # Test for stepping into indirect calls which may have trampolines (possibly
1102 # cascaded) on both the call path and the gdb_suppress_tests; path.
1103 # to handle trampolines.
1105 proc test_stepping_over_trampolines { } {
1110 # Stop in a marker function and take control from there.
1111 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1113 # Cater for gdb stopping in midline, see comment for finish above.
1114 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1115 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1119 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1120 pass "finish from marker_call_with_trampolines"
1122 -re ".*$gdb_prompt $" {
1123 fail "finish from marker_call_with_trampolines"
1126 fail "finish from marker_call_with_trampolines"
1131 # Try to step into the target function.
1132 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1133 "stepping into function called with trampolines"
1135 # Make we can backtrace and the argument looks correct. */
1136 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1137 "backtrace through call with trampolines"
1139 # Make sure we can get back to main.
1140 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1141 # or immediately transfer control back to main if optimizations
1143 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1144 -re "main .* at.*$gdb_prompt $" {
1145 pass "stepping back to main from function called with trampolines"
1148 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1152 -re ".*$gdb_prompt $" {
1153 fail "stepping back to main from function called with trampolines"
1156 fail "stepping back to main from function called with trampolines"
1160 gdb_stop_suppressing_tests;
1163 # Start with a fresh gdb.
1167 gdb_reinitialize_dir $srcdir/$subdir
1170 set prev_timeout $timeout
1171 if [istarget "mips*tx39-*"] {
1177 # Determine expected output for unsigned long variables,
1178 # the output varies with sizeof (unsigned long).
1180 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1181 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1182 set target_sizeof_long 4
1185 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1186 set target_sizeof_long 8
1191 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1192 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1193 set target_sizeof_int 2
1196 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1197 set target_sizeof_int 4
1200 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1201 set target_sizeof_int 8
1206 gdb_test_multiple "show endian" "getting target endian" {
1207 -re ".*little endian.*$gdb_prompt $" {
1208 set target_bigendian_p 0
1211 -re ".*big endian.*$gdb_prompt $" {
1212 set target_bigendian_p 1
1219 gdb_test_no_output "set print frame-arguments all"
1222 unsigned_integral_args
1223 if {![target_info exists gdb,skip_float_tests]} {
1224 float_and_integral_args
1227 # Test _Complex type here if supported.
1228 if [support_complex_tests] {
1231 complex_integral_args
1233 if {![target_info exists gdb,skip_float_tests]} {
1234 complex_float_integral_args
1239 structs_by_reference
1243 recursive_structs_by_value
1244 localvars_after_alloca
1246 localvars_in_indirect_call
1247 test_stepping_over_trampolines
1249 set timeout $prev_timeout