1 # Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
2 # 2007 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}] != "" } {
38 # Create and source the file that provides information about the compiler
39 # used to compile the test case.
40 if [get_compiler_info ${binfile}] {
45 # Locate actual args; integral types.
48 proc integral_args {} {
61 # Run; should stop at call0a and print actual arguments.
62 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
65 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
68 -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
69 timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
72 # Print each arg as a double check to see if we can print
73 # them here as well as with backtrace.
74 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
75 gdb_test "print s" ".* = 1" "print s after run to call0a"
76 gdb_test "print i" ".* = 2" "print i after run to call0a"
77 gdb_test "print l " ".* = 3" "print l after run to call0a"
79 # Continue; should stop at call0b and print actual arguments.
80 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
84 # Continue; should stop at call0c and print actual arguments.
85 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
89 # Continue; should stop at call0d and print actual arguments.
90 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
94 # Continue; should stop at call0e and print actual arguments.
95 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" ] {
98 gdb_stop_suppressing_tests;
102 # Locate actual args; unsigned integral types.
105 proc unsigned_integral_args {} {
112 gdb_breakpoint call1a;
113 gdb_breakpoint call1b;
114 gdb_breakpoint call1c;
115 gdb_breakpoint call1d;
116 gdb_breakpoint call1e;
118 # Run; should stop at call1a and print actual arguments.
119 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
122 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
125 -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
126 timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
129 # Print each arg as a double check to see if we can print
130 # them here as well as with backtrace.
131 gdb_test "print uc" ".* = 98 'b'"
132 gdb_test "print us" ".* = 6"
133 gdb_test "print ui" ".* = 7"
134 gdb_test "print ul" ".* = 8"
136 # Continue; should stop at call1b and print actual arguments.
137 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
141 # Continue; should stop at call1c and print actual arguments.
142 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
146 # Continue; should stop at call1d and print actual arguments.
147 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
151 # Continue; should stop at call1e and print actual arguments.
152 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"] {
155 gdb_stop_suppressing_tests;
159 # Locate actual args; integrals mixed with floating point.
162 proc float_and_integral_args {} {
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*" }
183 -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" }
184 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
185 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
186 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
189 # Print each arg as a double check to see if we can print
190 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
191 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
192 gdb_test "print s" ".* = 1" "print s after run to call2a"
193 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
194 gdb_test "print i" ".* = 2" "print i after run to call2a"
195 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
196 gdb_test "print l" ".* = 3" "print l after run to call2a"
197 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
199 setup_xfail "rs6000-*-*"
200 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
201 # Continue; should stop at call2b and print actual arguments.
202 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"] {
206 # Continue; should stop at call2c and print actual arguments.
207 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"] {
211 # Continue; should stop at call2d and print actual arguments.
212 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"] {
216 # Continue; should stop at call2e and print actual arguments.
217 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"] {
221 # Continue; should stop at call2f and print actual arguments.
222 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"] {
226 # Continue; should stop at call2g and print actual arguments.
227 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"] {
231 # Continue; should stop at call2h and print actual arguments.
232 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"] {
236 # monitor only allows 8 breakpoints; w89k board allows 10, so
237 # break them up into two groups.
239 gdb_breakpoint call2i
241 # Continue; should stop at call2i and print actual arguments.
242 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"] {
245 gdb_stop_suppressing_tests;
249 # Locate actual args; dereference pointers to ints and floats.
252 proc pointer_args {} {
259 gdb_breakpoint call3a
260 gdb_breakpoint call3b
261 gdb_breakpoint call3c
263 # Run; should stop at call3a and print actual arguments.
264 # Try dereferencing the arguments.
268 -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
269 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
270 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
273 gdb_test "print *cp" ".* = 97 'a'"
274 gdb_test "print *sp" ".* = 1"
275 gdb_test "print *ip" ".* = 2"
276 gdb_test "print *lp" ".* = 3"
278 # Continue; should stop at call3b and print actual arguments.
279 # Try dereferencing the arguments.
280 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
284 gdb_test "print *ucp" ".* = 98 'b'"
285 gdb_test "print *usp" ".* = 6"
286 gdb_test "print *uip" ".* = 7"
287 gdb_test "print *ulp" ".* = 8"
289 # Continue; should stop at call3c and print actual arguments.
290 # Try dereferencing the arguments.
291 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
295 gdb_test "print *fp" ".* = 4"
296 gdb_test "print *dp" ".* = 5"
298 # pass "locate actual args, pointer types"
299 gdb_stop_suppressing_tests;
303 # Locate actual args; structures and unions passed by reference.
306 proc structs_by_reference {} {
310 global target_sizeof_int
311 global target_sizeof_long
312 global target_bigendian_p
316 gdb_breakpoint call4a
317 gdb_breakpoint call4b
319 # Run; should stop at call4a and print actual arguments.
320 # Try dereferencing the arguments.
324 -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
327 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
328 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
331 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
333 # Continue; should stop at call4b and print actual arguments.
335 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
337 # Try dereferencing the arguments.
338 if { $target_sizeof_long == $target_sizeof_int } {
339 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
340 "print *unp (sizeof long == sizeof int)"
341 } elseif { ! $target_bigendian_p } {
342 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
343 "print *unp (little-endian, sizeof long != sizeof int)"
344 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
345 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
346 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
347 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
348 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
349 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
351 fail "print *unp (unknown case)"
354 pass "locate actual args, structs/unions passed by reference"
355 gdb_stop_suppressing_tests;
359 # Locate actual args; structures and unions passed by value.
362 proc structs_by_value {} {
366 global target_sizeof_int
367 global target_sizeof_long
368 global target_bigendian_p
372 gdb_breakpoint call5a
373 gdb_breakpoint call5b
375 # Run; should stop at call5a and print actual arguments.
376 # Try dereferencing the arguments.
380 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
383 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
384 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
387 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
389 # Continue; should stop at call5b and print actual arguments.
390 if { $target_sizeof_long == $target_sizeof_int } {
391 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
392 "continue to call5b (sizeof long == sizeof int)"
393 } elseif { ! $target_bigendian_p } {
394 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
395 "continue to call5b (little-endian, sizeof long != sizeof int)"
396 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
397 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
398 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
399 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
400 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
401 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
403 fail "continue to call5b (unknown case)"
406 # Try dereferencing the arguments.
407 if { $target_sizeof_long == $target_sizeof_int } {
408 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
409 "print un (sizeof long == sizeof int)"
410 } elseif { ! $target_bigendian_p } {
411 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
412 "print un (little-endian, sizeof long != sizeof int)"
413 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
414 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
415 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
416 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
417 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
418 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
420 fail "print un (unknown case)"
423 gdb_stop_suppressing_tests;
427 # Locate actual args; discard, shuffle, and call
430 proc discard_and_shuffle {} {
439 gdb_breakpoint call6a
440 gdb_breakpoint call6b
441 gdb_breakpoint call6c
442 gdb_breakpoint call6d
443 gdb_breakpoint call6e
444 gdb_breakpoint call6f
445 gdb_breakpoint call6g
446 gdb_breakpoint call6h
448 # Run; should stop at call6a and print actual arguments.
453 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
454 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
455 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
458 setup_xfail "rs6000-*-*"
460 if {!$gcc_compiled} {
461 setup_xfail "mips-sgi-irix5*"
464 send_gdb "backtrace 100\n"
466 -re "backtrace 100\[\r\n\]+
467 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
468 .* main \\(.*\\) .*\r
470 pass "backtrace from call6a"
472 -re "backtrace 100\[\r\n\]+
473 .* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r
474 .* main \\(.*\\) .*\r
476 xfail "backtrace from call6a"
478 -re "$gdb_prompt $" {
479 fail "backtrace from call6a"
483 fail "(timeout) backtrace from call6a"
488 # Continue; should stop at call6b and print actual arguments.
493 send_gdb "backtrace 100\n"
494 if [gdb_expect_list "backtrace from call6b" ".*$gdb_prompt $" {
495 ".*\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
496 ".*\[\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\\) "
497 ".*\[\r\n\]#2 .* main \\(.*\\) "
502 # Continue; should stop at call6c and print actual arguments.
507 send_gdb "backtrace 100\n"
508 if [gdb_expect_list "backtrace from call6c" ".*$gdb_prompt $" {
509 ".*\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
510 ".*\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
511 ".*\[\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\\) "
512 ".*\[\r\n\]#3 .* main \\(.*\\) "
516 # Continue; should stop at call6d and print actual arguments.
521 send_gdb "backtrace 100\n"
522 if [gdb_expect_list "backtrace from call6d" ".*$gdb_prompt $" {
523 ".*\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
524 ".*\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
525 ".*\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
526 ".*\[\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\\) "
527 ".*\[\r\n\]#4 .* main \\(.*\\) "
532 # Continue; should stop at call6e and print actual arguments.
537 send_gdb "backtrace 100\n"
538 if [gdb_expect_list "backtrace from call6e" ".*$gdb_prompt $" {
539 ".*\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
540 ".*\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
541 ".*\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
542 ".*\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
543 ".*\[\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\\) "
544 ".*\[\r\n\]#5 .* main \\(.*\\) "
549 # Continue; should stop at call6f and print actual arguments.
554 send_gdb "backtrace 100\n"
555 if [gdb_expect_list "backtrace from call6f" ".*$gdb_prompt $" {
556 ".*\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
557 ".*\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
558 ".*\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
559 ".*\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
560 ".*\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
561 ".*\[\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\\) "
562 ".*\[\r\n\]#6 .* main \\(.*\\) "
567 # Continue; should stop at call6g and print actual arguments.
572 send_gdb "backtrace 100\n"
573 if [gdb_expect_list "backtrace from call6g" ".*$gdb_prompt $" {
574 ".*\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
575 ".*\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
576 ".*\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
577 ".*\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
578 ".*\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
579 ".*\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
580 ".*\[\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\\) "
581 ".*\[\r\n\]#7 .* main \\(.*\\) "
586 # Continue; should stop at call6h and print actual arguments.
591 send_gdb "backtrace 100\n"
592 if [gdb_expect_list "backtrace from call6h" ".*$gdb_prompt $" {
593 ".*\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
594 ".*\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
595 ".*\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
596 ".*\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
597 ".*\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
598 ".*\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 ".*\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
600 ".*\[\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\\) "
601 ".*\[\r\n\]#8 .* main \\(.*\\) "
606 # monitor only allows 8 breakpoints; w89k board allows 10, so
607 # break them up into two groups.
609 gdb_breakpoint call6i
610 gdb_breakpoint call6j
611 gdb_breakpoint call6k
613 # Continue; should stop at call6i and print actual arguments.
618 send_gdb "backtrace 100\n"
619 if [gdb_expect_list "backtrace from call6i" ".*$gdb_prompt $" {
620 ".*\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
621 ".*\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
622 ".*\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
623 ".*\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
624 ".*\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
625 ".*\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
626 ".*\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
627 ".*\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
628 ".*\[\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\\) "
629 ".*\[\r\n\]#9 .* main \\(.*\\) "
634 # Continue; should stop at call6j and print actual arguments.
639 send_gdb "backtrace 100\n"
640 if [gdb_expect_list "backtrace from call6j" ".*$gdb_prompt $" {
641 ".*\[\r\n\]#0 .* call6j \\(ul=8\\) "
642 ".*\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
643 ".*\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
644 ".*\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
645 ".*\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
646 ".*\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
647 ".*\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 ".*\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 ".*\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
650 ".*\[\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\\) "
651 ".*\[\r\n\]#10 .* main \\(.*\\) "
656 # Continue; should stop at call6k and print actual arguments.
660 send_gdb "backtrace 100\n"
661 if [gdb_expect_list "backtrace from call6k" ".*$gdb_prompt $" {
662 ".*\[\r\n\]#0 .* call6k \\(\\) "
663 ".*\[\r\n\]#1 .* call6j \\(ul=8\\) "
664 ".*\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
665 ".*\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
666 ".*\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
667 ".*\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
668 ".*\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
669 ".*\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
670 ".*\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
671 ".*\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 ".*\[\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\\) "
673 ".*\[\r\n\]#11 .* main \\(.*\\) "
677 gdb_stop_suppressing_tests;
682 # Locate actual args; shuffle round robin and call
685 proc shuffle_round_robin {} {
694 gdb_breakpoint call7a
695 gdb_breakpoint call7b
696 gdb_breakpoint call7c
697 gdb_breakpoint call7d
698 gdb_breakpoint call7e
699 gdb_breakpoint call7f
700 gdb_breakpoint call7g
701 gdb_breakpoint call7h
703 # Run; should stop at call7a and print actual arguments.
708 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
711 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
712 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
715 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
716 send_gdb "backtrace 100\n"
718 -re "backtrace 100\[\r\n\]+
719 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
720 .* main \\(.*\\) .*\r
722 pass "backtrace from call7a"
724 -re "backtrace 100\[\r\n\]+
725 .* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r
726 .* main \\(.*\\) .*\r
728 xfail "backtrace from call7a"
730 -re "$gdb_prompt $" { fail "backtrace from call7a" ; return }
731 timeout { fail "(timeout) backtrace from call7a" ; return }
734 # Continue; should stop at call7b and print actual arguments.
739 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
741 send_gdb "backtrace 100\n"
742 gdb_expect_list "backtrace from call7b" ".*$gdb_prompt $" {
743 ".*\[\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'\\) "
744 ".*\[\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\\) "
745 ".*\[\r\n\]#2 .* main \\(.*\\) "
748 # Continue; should stop at call7c and print actual arguments.
753 send_gdb "backtrace 100\n"
754 gdb_expect_list "backtrace from call7c" ".*$gdb_prompt $" {
755 ".*\[\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\\) "
756 ".*\[\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'\\) "
757 ".*\[\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\\) "
758 ".*\[\r\n\]#3 .* main \\(.*\\) "
761 # Continue; should stop at call7d and print actual arguments.
766 send_gdb "backtrace 100\n"
767 gdb_expect_list "backtrace from call7d" ".*$gdb_prompt $" {
768 ".*\[\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\\) "
769 ".*\[\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\\) "
770 ".*\[\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'\\) "
771 ".*\[\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\\) "
772 ".*\[\r\n\]#4 .* main \\(.*\\) "
777 send_gdb "backtrace 100\n"
778 gdb_expect_list "backtrace from call7e" ".*$gdb_prompt $" {
779 ".*\[\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\\) "
780 ".*\[\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\\) "
781 ".*\[\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\\) "
782 ".*\[\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'\\) "
783 ".*\[\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\\) "
784 ".*\[\r\n\]#5 .* main \\(.*\\) "
787 # Continue; should stop at call7f and print actual arguments.
792 send_gdb "backtrace 100\n"
793 gdb_expect_list "backtrace from call7f" ".*$gdb_prompt $" {
794 ".*\[\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\\) "
795 ".*\[\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\\) "
796 ".*\[\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\\) "
797 ".*\[\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\\) "
798 ".*\[\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'\\) "
799 ".*\[\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\\) "
800 ".*\[\r\n\]#6 .* main \\(.*\\) "
803 # Continue; should stop at call7g and print actual arguments.
808 send_gdb "backtrace 100\n"
809 gdb_expect_list "backtrace from call7g" ".*$gdb_prompt $" {
810 ".*\[\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'\\) "
811 ".*\[\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\\) "
812 ".*\[\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\\) "
813 ".*\[\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\\) "
814 ".*\[\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\\) "
815 ".*\[\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'\\) "
816 ".*\[\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\\) "
817 ".*\[\r\n\]#7 .* main \\(.*\\) "
822 send_gdb "backtrace 100\n"
823 gdb_expect_list "backtrace from call7h" ".*$gdb_prompt $" {
824 ".*\[\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\\) "
825 ".*\[\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'\\) "
826 ".*\[\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\\) "
827 ".*\[\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\\) "
828 ".*\[\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\\) "
829 ".*\[\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\\) "
830 ".*\[\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'\\) "
831 ".*\[\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\\) "
832 ".*\[\r\n\]#8 .* main \\(.*\\) "
835 # monitor only allows 8 breakpoints; w89k board allows 10, so
836 # break them up into two groups.
838 gdb_breakpoint call7i
839 gdb_breakpoint call7j
840 gdb_breakpoint call7k
842 # Continue; should stop at call7i and print actual arguments.
847 send_gdb "backtrace 100\n"
848 gdb_expect_list "backtrace from call7i" ".*$gdb_prompt $" {
849 ".*\[\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\\) "
850 ".*\[\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\\) "
851 ".*\[\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'\\) "
852 ".*\[\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\\) "
853 ".*\[\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\\) "
854 ".*\[\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\\) "
855 ".*\[\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\\) "
856 ".*\[\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'\\) "
857 ".*\[\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\\) "
858 ".*\[\r\n\]#9 .* main \\(.*\\) "
861 # Continue; should stop at call7j and print actual arguments.
866 send_gdb "backtrace 100\n"
867 gdb_expect_list "backtrace from call7j" ".*$gdb_prompt $" {
868 ".*\[\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\\) "
869 ".*\[\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\\) "
870 ".*\[\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\\) "
871 ".*\[\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'\\) "
872 ".*\[\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\\) "
873 ".*\[\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\\) "
874 ".*\[\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\\) "
875 ".*\[\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\\) "
876 ".*\[\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'\\) "
877 ".*\[\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\\) "
878 ".*\[\r\n\]#10 .* main \\(.*\\) "
881 # Continue; should stop at call7k and print actual arguments.
886 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
887 send_gdb "backtrace 100\n"
888 gdb_expect_list "backtrace from call7k" ".*$gdb_prompt $" {
889 ".*\[\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\\) "
890 ".*\[\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\\) "
891 ".*\[\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\\) "
892 ".*\[\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\\) "
893 ".*\[\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'\\) "
894 ".*\[\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\\) "
895 ".*\[\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\\) "
896 ".*\[\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\\) "
897 ".*\[\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\\) "
898 ".*\[\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'\\) "
899 ".*\[\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\\) "
900 ".*\[\r\n\]#11 .* main \\(.*\\) "
902 gdb_stop_suppressing_tests;
906 # Locate actual args; recursive passing of structs by value
909 proc recursive_structs_by_value {} {
917 gdb_breakpoint hitbottom
919 # Run; should stop at hitbottom and print actual arguments.
923 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
924 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
925 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
928 if ![istarget sparclet-*-*] {
929 send_gdb "backtrace 100\n"
930 gdb_expect_list "recursive passing of structs by value" ".*$gdb_prompt $" {
931 ".*\[\r\n\]#0 .* hitbottom \\(\\) "
932 ".*\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
933 ".*\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
934 ".*\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
935 ".*\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
936 ".*\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
937 ".*\[\r\n\]#6 .* test_struct_args \\(\\) "
938 ".*\[\r\n\]#7 .* main \\(.*\\) "
941 fail "recursive passing of structs by value (sparclet)"
943 gdb_stop_suppressing_tests;
946 proc funcargs_reload { } {
952 if [istarget "mips-idt-*"] {
953 # Restart because IDT/SIM runs out of file descriptors.
956 gdb_reinitialize_dir $srcdir/$subdir
962 # Test for accessing local stack variables in functions which call alloca
964 proc localvars_after_alloca { } {
970 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
972 # Print each arg as a double check to see if we can print
973 # them here as well as with backtrace.
975 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
976 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
977 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
978 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
979 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
980 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
983 gdb_test "next" ".*" "next in localvars_after_alloca()"
985 # Print each arg as a double check to see if we can print
986 # them here as well as with backtrace.
988 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
989 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
990 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
991 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
993 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
994 gdb_stop_suppressing_tests;
997 proc call_after_alloca { } {
1003 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
1005 # Print each arg as a double check to see if we can print
1006 # them here as well as with backtrace.
1008 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1009 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1010 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1011 gdb_test "print s" " = 1" "print s in call_after_alloca"
1012 gdb_test "print i" " = 2" "print i in call_after_alloca"
1013 gdb_test "print l" " = 3" "print l in call_after_alloca"
1015 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1016 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"
1017 gdb_stop_suppressing_tests;
1021 # Test for accessing local stack variables, backtraces, finish,
1022 # and finally stepping into indirect calls. The point is that on the PA
1023 # these use a funky `dyncall' mechanism which GDB needs to know about.
1025 proc localvars_in_indirect_call { } {
1031 # Can not use "runto call0a" as call0a is called several times
1032 # during single run. Instead stop in a marker function and
1033 # take control from there.
1034 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
1036 # break on the next call to call0a, then delete all the breakpoints
1037 # and start testing.
1038 gdb_breakpoint call0a
1042 # Print each arg as a double check to see if we can print
1043 # them here as well as with backtrace.
1045 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1046 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1047 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1048 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1049 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1050 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1052 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1053 gdb_test "backtrace 8" \
1054 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1055 "backtrace in indirectly called function"
1058 # "finish" brings us back to main. We then will try to step through
1059 # the second indirect call.
1060 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1061 # of the first indirect call. This is due to stack adjustment instructions
1062 # after the indirect call. In these cases we will step till we hit the
1063 # second indirect call.
1068 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1069 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1070 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test.
1074 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1075 pass "finish from indirectly called function"
1077 -re ".*$gdb_prompt $" {
1078 fail "finish from indirectly called function"
1081 default { fail "finish from indirectly called function" ; gdb_suppress_tests; }
1084 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1085 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1086 "stepping into indirectly called function"
1087 gdb_stop_suppressing_tests;
1091 # Test for stepping into indirect calls which may have trampolines (possibly
1092 # cascaded) on both the call path and the gdb_suppress_tests; path.
1093 # to handle trampolines.
1095 proc test_stepping_over_trampolines { } {
1100 # Stop in a marker function and take control from there.
1101 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1103 # Cater for gdb stopping in midline, see comment for finish above.
1106 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1110 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1111 pass "finish from marker_call_with_trampolines"
1113 -re ".*$gdb_prompt $" {
1114 fail "finish from marker_call_with_trampolines"
1116 default { fail "finish from marker_call_with_trampolines" ; gdb_suppress_tests; }
1119 # Try to step into the target function.
1120 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1121 "stepping into function called with trampolines"
1123 # Make we can backtrace and the argument looks correct. */
1124 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1125 "backtrace through call with trampolines"
1127 # Make sure we can get back to main.
1128 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1129 # or immediately transfer control back to main if optimizations
1133 -re "main .* at.*$gdb_prompt $" {
1134 pass "stepping back to main from function called with trampolines" ;
1137 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1141 -re ".*$gdb_prompt $" {
1142 fail "stepping back to main from function called with trampolines"
1144 default { fail "stepping back to main from function called with trampolines" ; gdb_suppress_tests; }
1146 gdb_stop_suppressing_tests;
1149 # Start with a fresh gdb.
1153 gdb_reinitialize_dir $srcdir/$subdir
1156 if [istarget "mips*tx39-*"] {
1162 # Determine expected output for unsigned long variables,
1163 # the output varies with sizeof (unsigned long).
1165 set target_sizeof_long 4
1166 send_gdb "print sizeof (long)\n"
1168 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1169 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_long 8 }
1170 -re ".*$gdb_prompt $" {
1171 fail "getting sizeof long"
1173 default { fail "(timeout) getting sizeof long" }
1176 set target_sizeof_int 4
1177 send_gdb "print sizeof (int)\n"
1179 -re ".\[0-9\]* = 2.*$gdb_prompt $" { set target_sizeof_int 2 }
1180 -re ".\[0-9\]* = 4.*$gdb_prompt $" { }
1181 -re ".\[0-9\]* = 8.*$gdb_prompt $" { set target_sizeof_int 8 }
1182 -re ".*$gdb_prompt $" {
1183 fail "getting sizeof unsigned long"
1185 default { fail "(timeout) getting sizeof int" }
1188 set target_bigendian_p 1
1189 send_gdb "show endian\n"
1191 -re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
1192 -re ".*big endian.*$gdb_prompt $" { }
1193 -re ".*$gdb_prompt $" {
1194 fail "getting target endian"
1196 default { fail "(timeout) getting target endian" }
1203 unsigned_integral_args
1205 if {![target_info exists gdb,skip_float_tests]} {
1206 float_and_integral_args
1211 structs_by_reference
1219 recursive_structs_by_value
1221 localvars_after_alloca
1225 localvars_in_indirect_call
1227 test_stepping_over_trampolines