1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
2 # 2007, 2008, 2009, 2010, 2011 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 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)
24 set testfile "funcargs"
25 set srcfile ${testfile}.c
26 set binfile ${objdir}/${subdir}/${testfile}
27 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
32 # Create and source the file that provides information about the compiler
33 # used to compile the test case.
34 if [get_compiler_info ${binfile}] {
39 # Locate actual args; integral types.
42 proc integral_args {} {
55 # Run; should stop at call0a and print actual arguments.
56 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
59 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
62 -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
63 timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
66 # Print each arg as a double check to see if we can print
67 # them here as well as with backtrace.
68 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
69 gdb_test "print s" ".* = 1" "print s after run to call0a"
70 gdb_test "print i" ".* = 2" "print i after run to call0a"
71 gdb_test "print l " ".* = 3" "print l after run to call0a"
73 # Continue; should stop at call0b and print actual arguments.
74 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
78 # Continue; should stop at call0c and print actual arguments.
79 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
83 # Continue; should stop at call0d and print actual arguments.
84 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
88 # Continue; should stop at call0e and print actual arguments.
89 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" ] {
92 gdb_stop_suppressing_tests;
96 # Locate actual args; unsigned integral types.
99 proc unsigned_integral_args {} {
106 gdb_breakpoint call1a;
107 gdb_breakpoint call1b;
108 gdb_breakpoint call1c;
109 gdb_breakpoint call1d;
110 gdb_breakpoint call1e;
112 # Run; should stop at call1a and print actual arguments.
113 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
116 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
119 -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
120 timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
123 # Print each arg as a double check to see if we can print
124 # them here as well as with backtrace.
125 gdb_test "print uc" ".* = 98 'b'"
126 gdb_test "print us" ".* = 6"
127 gdb_test "print ui" ".* = 7"
128 gdb_test "print ul" ".* = 8"
130 # Continue; should stop at call1b and print actual arguments.
131 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
135 # Continue; should stop at call1c and print actual arguments.
136 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
140 # Continue; should stop at call1d and print actual arguments.
141 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
145 # Continue; should stop at call1e and print actual arguments.
146 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"] {
149 gdb_stop_suppressing_tests;
153 # Locate actual args; integrals mixed with floating point.
156 proc float_and_integral_args {} {
163 gdb_breakpoint call2a
164 gdb_breakpoint call2b
165 gdb_breakpoint call2c
166 gdb_breakpoint call2d
167 gdb_breakpoint call2e
168 gdb_breakpoint call2f
169 gdb_breakpoint call2g
170 gdb_breakpoint call2h
172 # Run; should stop at call2a and print actual arguments.
174 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
177 -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" }
178 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
179 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
180 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
183 # Print each arg as a double check to see if we can print
184 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
185 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
186 gdb_test "print s" ".* = 1" "print s after run to call2a"
187 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
188 gdb_test "print i" ".* = 2" "print i after run to call2a"
189 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
190 gdb_test "print l" ".* = 3" "print l after run to call2a"
191 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
193 setup_xfail "rs6000-*-*"
194 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
195 # Continue; should stop at call2b and print actual arguments.
196 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"] {
200 # Continue; should stop at call2c and print actual arguments.
201 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"] {
205 # Continue; should stop at call2d and print actual arguments.
206 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"] {
210 # Continue; should stop at call2e and print actual arguments.
211 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"] {
215 # Continue; should stop at call2f and print actual arguments.
216 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"] {
220 # Continue; should stop at call2g and print actual arguments.
221 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"] {
225 # Continue; should stop at call2h and print actual arguments.
226 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"] {
230 # monitor only allows 8 breakpoints; w89k board allows 10, so
231 # break them up into two groups.
233 gdb_breakpoint call2i
235 # Continue; should stop at call2i and print actual arguments.
236 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"] {
239 gdb_stop_suppressing_tests;
243 # Locate actual args; dereference pointers to ints and floats.
246 proc pointer_args {} {
253 gdb_breakpoint call3a
254 gdb_breakpoint call3b
255 gdb_breakpoint call3c
257 # Run; should stop at call3a and print actual arguments.
258 # Try dereferencing the arguments.
262 -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
263 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
264 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
267 gdb_test "print *cp" ".* = 97 'a'"
268 gdb_test "print *sp" ".* = 1"
269 gdb_test "print *ip" ".* = 2"
270 gdb_test "print *lp" ".* = 3"
272 # Continue; should stop at call3b and print actual arguments.
273 # Try dereferencing the arguments.
274 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
278 gdb_test "print *ucp" ".* = 98 'b'"
279 gdb_test "print *usp" ".* = 6"
280 gdb_test "print *uip" ".* = 7"
281 gdb_test "print *ulp" ".* = 8"
283 # Continue; should stop at call3c and print actual arguments.
284 # Try dereferencing the arguments.
285 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
289 gdb_test "print *fp" ".* = 4"
290 gdb_test "print *dp" ".* = 5"
292 # pass "locate actual args, pointer types"
293 gdb_stop_suppressing_tests;
297 # Locate actual args; structures and unions passed by reference.
300 proc structs_by_reference {} {
304 global target_sizeof_int
305 global target_sizeof_long
306 global target_bigendian_p
310 gdb_breakpoint call4a
311 gdb_breakpoint call4b
313 # Run; should stop at call4a and print actual arguments.
314 # Try dereferencing the arguments.
318 -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
321 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
322 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
325 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
327 # Continue; should stop at call4b and print actual arguments.
329 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
331 # Try dereferencing the arguments.
332 if { $target_sizeof_long == $target_sizeof_int } {
333 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
334 "print *unp (sizeof long == sizeof int)"
335 } elseif { ! $target_bigendian_p } {
336 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
337 "print *unp (little-endian, sizeof long != sizeof int)"
338 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
339 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
340 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
341 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
342 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
343 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
345 fail "print *unp (unknown case)"
348 pass "locate actual args, structs/unions passed by reference"
349 gdb_stop_suppressing_tests;
353 # Locate actual args; structures and unions passed by value.
356 proc structs_by_value {} {
360 global target_sizeof_int
361 global target_sizeof_long
362 global target_bigendian_p
366 gdb_breakpoint call5a
367 gdb_breakpoint call5b
369 # Run; should stop at call5a and print actual arguments.
370 # Try dereferencing the arguments.
374 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
377 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
378 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
381 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
383 # Continue; should stop at call5b and print actual arguments.
384 if { $target_sizeof_long == $target_sizeof_int } {
385 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
386 "continue to call5b (sizeof long == sizeof int)"
387 } elseif { ! $target_bigendian_p } {
388 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
389 "continue to call5b (little-endian, sizeof long != sizeof int)"
390 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
391 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
392 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
393 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
394 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
395 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
397 fail "continue to call5b (unknown case)"
400 # Try dereferencing the arguments.
401 if { $target_sizeof_long == $target_sizeof_int } {
402 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
403 "print un (sizeof long == sizeof int)"
404 } elseif { ! $target_bigendian_p } {
405 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
406 "print un (little-endian, sizeof long != sizeof int)"
407 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
408 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
409 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
410 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
411 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
412 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
414 fail "print un (unknown case)"
417 gdb_stop_suppressing_tests;
421 # Locate actual args; discard, shuffle, and call
424 proc discard_and_shuffle {} {
433 gdb_breakpoint call6a
434 gdb_breakpoint call6b
435 gdb_breakpoint call6c
436 gdb_breakpoint call6d
437 gdb_breakpoint call6e
438 gdb_breakpoint call6f
439 gdb_breakpoint call6g
440 gdb_breakpoint call6h
442 # Run; should stop at call6a and print actual arguments.
447 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
448 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
449 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
452 setup_xfail "rs6000-*-*"
454 if {!$gcc_compiled} {
455 setup_xfail "mips-sgi-irix5*"
458 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
459 -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 $" {
460 pass "backtrace from call6a"
462 -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 $" {
463 xfail "backtrace from call6a"
467 # Continue; should stop at call6b and print actual arguments.
472 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
473 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
474 "\[\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\\) "
475 "\[\r\n\]#2 .* main \\(.*\\) at "
480 # Continue; should stop at call6c and print actual arguments.
485 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
486 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
487 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
488 "\[\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\\) "
489 "\[\r\n\]#3 .* main \\(.*\\) at "
493 # Continue; should stop at call6d and print actual arguments.
498 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
499 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
500 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
501 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
502 "\[\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\\) "
503 "\[\r\n\]#4 .* main \\(.*\\) at "
508 # Continue; should stop at call6e and print actual arguments.
513 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
514 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
515 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
516 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
517 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
518 "\[\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\\) "
519 "\[\r\n\]#5 .* main \\(.*\\) at "
524 # Continue; should stop at call6f and print actual arguments.
529 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
530 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
531 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
532 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
533 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
534 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
535 "\[\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\\) "
536 "\[\r\n\]#6 .* main \\(.*\\) at "
541 # Continue; should stop at call6g and print actual arguments.
546 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
547 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
548 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
549 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
550 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
551 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
552 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
553 "\[\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\\) "
554 "\[\r\n\]#7 .* main \\(.*\\) at "
559 # Continue; should stop at call6h and print actual arguments.
564 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
565 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
566 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
567 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
568 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
569 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
570 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
571 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
572 "\[\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\\) "
573 "\[\r\n\]#8 .* main \\(.*\\) at "
578 # monitor only allows 8 breakpoints; w89k board allows 10, so
579 # break them up into two groups.
581 gdb_breakpoint call6i
582 gdb_breakpoint call6j
583 gdb_breakpoint call6k
585 # Continue; should stop at call6i and print actual arguments.
590 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
591 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
592 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
593 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
594 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
595 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
596 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
597 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
598 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 "\[\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\\) "
600 "\[\r\n\]#9 .* main \\(.*\\) at "
605 # Continue; should stop at call6j and print actual arguments.
610 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
611 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
612 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
613 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
614 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
615 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
616 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
617 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
618 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
619 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
620 "\[\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\\) "
621 "\[\r\n\]#10 .* main \\(.*\\) at "
626 # Continue; should stop at call6k and print actual arguments.
630 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
631 "\[\r\n\]#0 .* call6k \\(\\) "
632 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
633 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
634 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
635 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
636 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
637 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
638 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
639 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
640 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
641 "\[\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\\) "
642 "\[\r\n\]#11 .* main \\(.*\\) at "
646 gdb_stop_suppressing_tests;
651 # Locate actual args; shuffle round robin and call
654 proc shuffle_round_robin {} {
663 gdb_breakpoint call7a
664 gdb_breakpoint call7b
665 gdb_breakpoint call7c
666 gdb_breakpoint call7d
667 gdb_breakpoint call7e
668 gdb_breakpoint call7f
669 gdb_breakpoint call7g
670 gdb_breakpoint call7h
672 # Run; should stop at call7a and print actual arguments.
677 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
680 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
681 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
684 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
685 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
686 -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 $" {
687 pass "backtrace from call7a"
689 -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 $" {
690 xfail "backtrace from call7a"
694 # Continue; should stop at call7b and print actual arguments.
699 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
701 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
702 "\[\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'\\) "
703 "\[\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\\) "
704 "\[\r\n\]#2 .* main \\(.*\\) at "
707 # Continue; should stop at call7c and print actual arguments.
712 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
713 "\[\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\\) "
714 "\[\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'\\) "
715 "\[\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\\) "
716 "\[\r\n\]#3 .* main \\(.*\\) at "
719 # Continue; should stop at call7d and print actual arguments.
724 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
725 "\[\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\\) "
726 "\[\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\\) "
727 "\[\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'\\) "
728 "\[\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\\) "
729 "\[\r\n\]#4 .* main \\(.*\\) at "
734 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
735 "\[\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\\) "
736 "\[\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\\) "
737 "\[\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\\) "
738 "\[\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'\\) "
739 "\[\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\\) "
740 "\[\r\n\]#5 .* main \\(.*\\) at "
743 # Continue; should stop at call7f and print actual arguments.
748 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
749 "\[\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\\) "
750 "\[\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\\) "
751 "\[\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\\) "
752 "\[\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\\) "
753 "\[\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'\\) "
754 "\[\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\\) "
755 "\[\r\n\]#6 .* main \\(.*\\) at "
758 # Continue; should stop at call7g and print actual arguments.
763 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
764 "\[\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'\\) "
765 "\[\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\\) "
766 "\[\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\\) "
767 "\[\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\\) "
768 "\[\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\\) "
769 "\[\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'\\) "
770 "\[\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\\) "
771 "\[\r\n\]#7 .* main \\(.*\\) at "
776 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
777 "\[\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\\) "
778 "\[\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'\\) "
779 "\[\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\\) "
780 "\[\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\\) "
781 "\[\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\\) "
782 "\[\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\\) "
783 "\[\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'\\) "
784 "\[\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\\) "
785 "\[\r\n\]#8 .* main \\(.*\\) at "
788 # monitor only allows 8 breakpoints; w89k board allows 10, so
789 # break them up into two groups.
791 gdb_breakpoint call7i
792 gdb_breakpoint call7j
793 gdb_breakpoint call7k
795 # Continue; should stop at call7i and print actual arguments.
800 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
801 "\[\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\\) "
802 "\[\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\\) "
803 "\[\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'\\) "
804 "\[\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\\) "
805 "\[\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\\) "
806 "\[\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\\) "
807 "\[\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\\) "
808 "\[\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'\\) "
809 "\[\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\\) "
810 "\[\r\n\]#9 .* main \\(.*\\) at "
813 # Continue; should stop at call7j and print actual arguments.
818 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
819 "\[\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\\) "
820 "\[\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\\) "
821 "\[\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\\) "
822 "\[\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'\\) "
823 "\[\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\\) "
824 "\[\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\\) "
825 "\[\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\\) "
826 "\[\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\\) "
827 "\[\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'\\) "
828 "\[\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\\) "
829 "\[\r\n\]#10 .* main \\(.*\\) at "
832 # Continue; should stop at call7k and print actual arguments.
837 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
838 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
839 "\[\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\\) "
840 "\[\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\\) "
841 "\[\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\\) "
842 "\[\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\\) "
843 "\[\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'\\) "
844 "\[\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\\) "
845 "\[\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\\) "
846 "\[\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\\) "
847 "\[\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\\) "
848 "\[\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'\\) "
849 "\[\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\\) "
850 "\[\r\n\]#11 .* main \\(.*\\) at "
852 gdb_stop_suppressing_tests;
856 # Locate actual args; recursive passing of structs by value
859 proc recursive_structs_by_value {} {
867 gdb_breakpoint hitbottom
869 # Run; should stop at hitbottom and print actual arguments.
873 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
874 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
875 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
878 if ![istarget sparclet-*-*] {
879 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
880 "\[\r\n\]#0 .* hitbottom \\(\\) "
881 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
882 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
883 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
884 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
885 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
886 "\[\r\n\]#6 .* test_struct_args \\(\\) "
887 "\[\r\n\]#7 .* main \\(.*\\) at "
890 fail "recursive passing of structs by value (sparclet)"
892 gdb_stop_suppressing_tests;
895 proc funcargs_reload { } {
901 if [istarget "mips-idt-*"] {
902 # Restart because IDT/SIM runs out of file descriptors.
905 gdb_reinitialize_dir $srcdir/$subdir
911 # Test for accessing local stack variables in functions which call alloca
913 proc localvars_after_alloca { } {
919 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
921 # Print each arg as a double check to see if we can print
922 # them here as well as with backtrace.
924 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
925 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
926 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
927 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
928 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
929 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
932 gdb_test "next" ".*" "next in localvars_after_alloca()"
934 # Print each arg as a double check to see if we can print
935 # them here as well as with backtrace.
937 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
938 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
939 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
940 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
942 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
943 gdb_stop_suppressing_tests;
946 proc call_after_alloca { } {
952 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
954 # Print each arg as a double check to see if we can print
955 # them here as well as with backtrace.
957 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
958 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
959 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
960 gdb_test "print s" " = 1" "print s in call_after_alloca"
961 gdb_test "print i" " = 2" "print i in call_after_alloca"
962 gdb_test "print l" " = 3" "print l in call_after_alloca"
964 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
965 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"
966 gdb_stop_suppressing_tests;
970 # Test for accessing local stack variables, backtraces, finish,
971 # and finally stepping into indirect calls. The point is that on the PA
972 # these use a funky `dyncall' mechanism which GDB needs to know about.
974 proc localvars_in_indirect_call { } {
980 # Can not use "runto call0a" as call0a is called several times
981 # during single run. Instead stop in a marker function and
982 # take control from there.
983 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
985 # break on the next call to call0a, then delete all the breakpoints
987 gdb_breakpoint call0a
991 # Print each arg as a double check to see if we can print
992 # them here as well as with backtrace.
994 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
995 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
996 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
997 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
998 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
999 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1001 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1002 gdb_test "backtrace 8" \
1003 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1004 "backtrace in indirectly called function"
1007 # "finish" brings us back to main. We then will try to step through
1008 # the second indirect call.
1009 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1010 # of the first indirect call. This is due to stack adjustment instructions
1011 # after the indirect call. In these cases we will step till we hit the
1012 # second indirect call.
1015 gdb_test_multiple "finish" "finish from indirectly called function" {
1016 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1017 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1018 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary
1019 #to continue the test.
1023 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1024 pass "finish from indirectly called function"
1026 -re ".*$gdb_prompt $" {
1027 fail "finish from indirectly called function"
1031 fail "finish from indirectly called function"
1036 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1037 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1038 "stepping into indirectly called function"
1039 gdb_stop_suppressing_tests;
1043 # Test for stepping into indirect calls which may have trampolines (possibly
1044 # cascaded) on both the call path and the gdb_suppress_tests; path.
1045 # to handle trampolines.
1047 proc test_stepping_over_trampolines { } {
1052 # Stop in a marker function and take control from there.
1053 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1055 # Cater for gdb stopping in midline, see comment for finish above.
1056 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1057 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1061 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1062 pass "finish from marker_call_with_trampolines"
1064 -re ".*$gdb_prompt $" {
1065 fail "finish from marker_call_with_trampolines"
1068 fail "finish from marker_call_with_trampolines"
1073 # Try to step into the target function.
1074 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1075 "stepping into function called with trampolines"
1077 # Make we can backtrace and the argument looks correct. */
1078 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1079 "backtrace through call with trampolines"
1081 # Make sure we can get back to main.
1082 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1083 # or immediately transfer control back to main if optimizations
1085 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1086 -re "main .* at.*$gdb_prompt $" {
1087 pass "stepping back to main from function called with trampolines"
1090 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1094 -re ".*$gdb_prompt $" {
1095 fail "stepping back to main from function called with trampolines"
1098 fail "stepping back to main from function called with trampolines"
1102 gdb_stop_suppressing_tests;
1105 # Start with a fresh gdb.
1109 gdb_reinitialize_dir $srcdir/$subdir
1112 set prev_timeout $timeout
1113 if [istarget "mips*tx39-*"] {
1119 # Determine expected output for unsigned long variables,
1120 # the output varies with sizeof (unsigned long).
1122 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1123 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1124 set target_sizeof_long 4
1127 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1128 set target_sizeof_long 8
1133 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1134 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1135 set target_sizeof_int 2
1138 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1139 set target_sizeof_int 4
1142 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1143 set target_sizeof_int 8
1148 gdb_test_multiple "show endian" "getting target endian" {
1149 -re ".*little endian.*$gdb_prompt $" {
1150 set target_bigendian_p 0
1153 -re ".*big endian.*$gdb_prompt $" {
1154 set target_bigendian_p 1
1161 gdb_test_no_output "set print frame-arguments all"
1165 unsigned_integral_args
1167 if {![target_info exists gdb,skip_float_tests]} {
1168 float_and_integral_args
1173 structs_by_reference
1181 recursive_structs_by_value
1183 localvars_after_alloca
1187 localvars_in_indirect_call
1189 test_stepping_over_trampolines
1191 set timeout $prev_timeout