1 # Copyright 1992-2014 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file was written by Fred Fish. (fnf@cygnus.com)
21 set compile_flags {debug nowarnings quiet}
22 if [support_complex_tests] {
23 lappend compile_flags "additional_flags=-DTEST_COMPLEX"
26 # Create and source the file that provides information about the compiler
27 # used to compile the test case.
28 if [get_compiler_info] {
32 if {[prepare_for_testing $testfile.exp $testfile $srcfile $compile_flags]} {
33 untested $testfile.exp
38 # Locate actual args; integral types.
41 proc integral_args {} {
54 # Run; should stop at call0a and print actual arguments.
55 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
57 gdb_test "" " call0a \\(c=97 'a', s=1, i=2, l=3\\) .*" "run to call0a"
59 # Print each arg as a double check to see if we can print
60 # them here as well as with backtrace.
61 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
62 gdb_test "print s" ".* = 1" "print s after run to call0a"
63 gdb_test "print i" ".* = 2" "print i after run to call0a"
64 gdb_test "print l " ".* = 3" "print l after run to call0a"
66 # Continue; should stop at call0b and print actual arguments.
67 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
71 # Continue; should stop at call0c and print actual arguments.
72 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
76 # Continue; should stop at call0d and print actual arguments.
77 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
81 # Continue; should stop at call0e and print actual arguments.
82 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" ] {
85 gdb_stop_suppressing_tests
89 # Locate actual args; unsigned integral types.
92 proc unsigned_integral_args {} {
100 gdb_breakpoint call1b
101 gdb_breakpoint call1c
102 gdb_breakpoint call1d
103 gdb_breakpoint call1e
105 # Run; should stop at call1a and print actual arguments.
106 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
108 gdb_test "" " call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*" "run to call1a"
110 # Print each arg as a double check to see if we can print
111 # them here as well as with backtrace.
112 gdb_test "print uc" ".* = 98 'b'"
113 gdb_test "print us" ".* = 6"
114 gdb_test "print ui" ".* = 7"
115 gdb_test "print ul" ".* = 8"
117 # Continue; should stop at call1b and print actual arguments.
118 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
122 # Continue; should stop at call1c and print actual arguments.
123 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
127 # Continue; should stop at call1d and print actual arguments.
128 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
132 # Continue; should stop at call1e and print actual arguments.
133 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"] {
136 gdb_stop_suppressing_tests
140 # Locate actual args; integrals mixed with floating point.
143 proc float_and_integral_args {} {
150 gdb_breakpoint call2a
151 gdb_breakpoint call2b
152 gdb_breakpoint call2c
153 gdb_breakpoint call2d
154 gdb_breakpoint call2e
155 gdb_breakpoint call2f
156 gdb_breakpoint call2g
157 gdb_breakpoint call2h
159 # Run; should stop at call2a and print actual arguments.
161 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
163 set test "run to call2a"
164 gdb_test_multiple "" $test {
165 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
168 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
173 # Print each arg as a double check to see if we can print
174 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
175 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
176 gdb_test "print s" ".* = 1" "print s after run to call2a"
177 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
178 gdb_test "print i" ".* = 2" "print i after run to call2a"
179 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
180 gdb_test "print l" ".* = 3" "print l after run to call2a"
181 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
183 setup_xfail "rs6000-*-*"
184 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
185 # Continue; should stop at call2b and print actual arguments.
186 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"] {
190 # Continue; should stop at call2c and print actual arguments.
191 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"] {
195 # Continue; should stop at call2d and print actual arguments.
196 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"] {
200 # Continue; should stop at call2e and print actual arguments.
201 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"] {
205 # Continue; should stop at call2f and print actual arguments.
206 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"] {
210 # Continue; should stop at call2g and print actual arguments.
211 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"] {
215 # Continue; should stop at call2h and print actual arguments.
216 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"] {
220 # monitor only allows 8 breakpoints; w89k board allows 10, so
221 # break them up into two groups.
223 gdb_breakpoint call2i
225 # Continue; should stop at call2i and print actual arguments.
226 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"] {
229 gdb_stop_suppressing_tests
234 # Locate actual args; _Complex types.
237 proc complex_args {} {
242 gdb_breakpoint callca
243 gdb_breakpoint callcb
244 gdb_breakpoint callcc
245 gdb_breakpoint callcd
246 gdb_breakpoint callce
247 gdb_breakpoint callcf
249 # Run; should stop at call1a and print actual arguments.
251 gdb_test "" " callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\) .*" "run to call2a"
253 gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4 \\* I\\) .*" "continue to callcb"
254 gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\+ 6 \\* I\\) .*" "continue to callcc"
255 gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "continue to callcd"
256 gdb_test "cont" ".* callce \\(dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I\\) .*" "continue to callce"
257 gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I\\) .*" "continue to callcf"
262 # Locate actual args; _Complex types and integral.
264 proc complex_integral_args {} {
269 gdb_breakpoint callc1a
270 gdb_breakpoint callc1b
272 # Run; should stop at call1a and print actual arguments.
274 gdb_test "" " callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "run to callc1a"
276 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"
280 # Locate actual args; _Complex types and integral/float.
282 proc complex_float_integral_args {} {
287 gdb_breakpoint callc2a
288 gdb_breakpoint callc2b
290 # Run; should stop at call1a and print actual arguments.
292 gdb_test "" " 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\\) .*" "run to callc2a"
294 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"
298 # Locate actual args; dereference pointers to ints and floats.
301 proc pointer_args {} {
308 gdb_breakpoint call3a
309 gdb_breakpoint call3b
310 gdb_breakpoint call3c
312 # Run; should stop at call3a and print actual arguments.
313 # Try dereferencing the arguments.
316 gdb_test "" " call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*" "run to call3a"
318 gdb_test "print *cp" ".* = 97 'a'"
319 gdb_test "print *sp" ".* = 1"
320 gdb_test "print *ip" ".* = 2"
321 gdb_test "print *lp" ".* = 3"
323 # Continue; should stop at call3b and print actual arguments.
324 # Try dereferencing the arguments.
325 if [gdb_test "cont" ".* call3b \\(ucp=$hex <uc> \"b.*\", usp=$hex <us>, uip=$hex <ui>, ulp=$hex <ul>\\) .*" "continue to call3b"] {
329 gdb_test "print *ucp" ".* = 98 'b'"
330 gdb_test "print *usp" ".* = 6"
331 gdb_test "print *uip" ".* = 7"
332 gdb_test "print *ulp" ".* = 8"
334 # Continue; should stop at call3c and print actual arguments.
335 # Try dereferencing the arguments.
336 if [gdb_test "cont" ".* call3c \\(fp=$hex <f>, dp=$hex <d>\\) .*" "continue to call3c"] {
340 gdb_test "print *fp" ".* = 4"
341 gdb_test "print *dp" ".* = 5"
343 # pass "locate actual args, pointer types"
344 gdb_stop_suppressing_tests
348 # Locate actual args; structures and unions passed by reference.
351 proc structs_by_reference {} {
355 global target_sizeof_int
356 global target_sizeof_long
357 global target_bigendian_p
361 gdb_breakpoint call4a
362 gdb_breakpoint call4b
364 # Run; should stop at call4a and print actual arguments.
365 # Try dereferencing the arguments.
368 gdb_test "" " call4a \\(stp=$hex <st>\\) .*" "run to call4a"
370 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
372 # Continue; should stop at call4b and print actual arguments.
374 gdb_test "cont" ".* call4b \\(unp=$hex <un>\\) .*" "continue to call4b"
376 # Try dereferencing the arguments.
377 if { $target_sizeof_long == $target_sizeof_int } {
378 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
379 "print *unp (sizeof long == sizeof int)"
380 } elseif { ! $target_bigendian_p } {
381 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
382 "print *unp (little-endian, sizeof long != sizeof int)"
383 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
384 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
385 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
386 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
387 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
388 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
390 fail "print *unp (unknown case)"
393 pass "locate actual args, structs/unions passed by reference"
394 gdb_stop_suppressing_tests
398 # Locate actual args; structures and unions passed by value.
401 proc structs_by_value {} {
405 global target_sizeof_int
406 global target_sizeof_long
407 global target_bigendian_p
411 gdb_breakpoint call5a
412 gdb_breakpoint call5b
414 # Run; should stop at call5a and print actual arguments.
415 # Try dereferencing the arguments.
418 gdb_test "" " call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*" "run to call5a"
420 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
422 # Continue; should stop at call5b and print actual arguments.
423 if { $target_sizeof_long == $target_sizeof_int } {
424 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
425 "continue to call5b (sizeof long == sizeof int)"
426 } elseif { ! $target_bigendian_p } {
427 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
428 "continue to call5b (little-endian, sizeof long != sizeof int)"
429 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
430 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
431 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
432 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
433 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
434 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
436 fail "continue to call5b (unknown case)"
439 # Try dereferencing the arguments.
440 if { $target_sizeof_long == $target_sizeof_int } {
441 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
442 "print un (sizeof long == sizeof int)"
443 } elseif { ! $target_bigendian_p } {
444 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
445 "print un (little-endian, sizeof long != sizeof int)"
446 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
447 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
448 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
449 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
450 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
451 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
453 fail "print un (unknown case)"
456 gdb_stop_suppressing_tests
460 # Locate actual args; discard, shuffle, and call
463 proc discard_and_shuffle {} {
472 gdb_breakpoint call6a
473 gdb_breakpoint call6b
474 gdb_breakpoint call6c
475 gdb_breakpoint call6d
476 gdb_breakpoint call6e
477 gdb_breakpoint call6f
478 gdb_breakpoint call6g
479 gdb_breakpoint call6h
481 # Run; should stop at call6a and print actual arguments.
485 gdb_test "" "Breakpoint $decimal, call6a .*" "run to call6a"
487 setup_xfail "rs6000-*-*"
489 if {!$gcc_compiled} {
490 setup_xfail "mips-sgi-irix5*"
493 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
494 -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 $" {
495 pass "backtrace from call6a"
497 -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 $" {
498 xfail "backtrace from call6a"
502 # Continue; should stop at call6b and print actual arguments.
507 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
508 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
509 "\[\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\\) "
510 "\[\r\n\]#2 .* main \\(.*\\) at "
515 # Continue; should stop at call6c and print actual arguments.
520 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
521 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
522 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
523 "\[\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\\) "
524 "\[\r\n\]#3 .* main \\(.*\\) at "
528 # Continue; should stop at call6d and print actual arguments.
533 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
534 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
535 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
536 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
537 "\[\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\\) "
538 "\[\r\n\]#4 .* main \\(.*\\) at "
543 # Continue; should stop at call6e and print actual arguments.
548 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
549 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
550 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
551 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
552 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
553 "\[\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\\) "
554 "\[\r\n\]#5 .* main \\(.*\\) at "
559 # Continue; should stop at call6f and print actual arguments.
564 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
565 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
566 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
567 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
568 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
569 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
570 "\[\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\\) "
571 "\[\r\n\]#6 .* main \\(.*\\) at "
576 # Continue; should stop at call6g and print actual arguments.
581 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
582 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
583 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
584 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
585 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
586 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
587 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
588 "\[\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\\) "
589 "\[\r\n\]#7 .* main \\(.*\\) at "
594 # Continue; should stop at call6h and print actual arguments.
599 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
600 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
601 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
602 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
603 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
604 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
605 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
606 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
607 "\[\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\\) "
608 "\[\r\n\]#8 .* main \\(.*\\) at "
613 # monitor only allows 8 breakpoints; w89k board allows 10, so
614 # break them up into two groups.
616 gdb_breakpoint call6i
617 gdb_breakpoint call6j
618 gdb_breakpoint call6k
620 # Continue; should stop at call6i and print actual arguments.
625 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
626 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
627 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
628 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
629 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
630 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
631 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
632 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
633 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
634 "\[\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\\) "
635 "\[\r\n\]#9 .* main \\(.*\\) at "
640 # Continue; should stop at call6j and print actual arguments.
645 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
646 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
647 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
648 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
649 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
650 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
651 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
652 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
653 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
654 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
655 "\[\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\\) "
656 "\[\r\n\]#10 .* main \\(.*\\) at "
661 # Continue; should stop at call6k and print actual arguments.
665 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
666 "\[\r\n\]#0 .* call6k \\(\\) "
667 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
668 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
669 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
670 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
671 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
673 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
674 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
675 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
676 "\[\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\\) "
677 "\[\r\n\]#11 .* main \\(.*\\) at "
681 gdb_stop_suppressing_tests
686 # Locate actual args; shuffle round robin and call
689 proc shuffle_round_robin {} {
698 gdb_breakpoint call7a
699 gdb_breakpoint call7b
700 gdb_breakpoint call7c
701 gdb_breakpoint call7d
702 gdb_breakpoint call7e
703 gdb_breakpoint call7f
704 gdb_breakpoint call7g
705 gdb_breakpoint call7h
707 # Run; should stop at call7a and print actual arguments.
711 gdb_test "" "Breakpoint $decimal, call7a .*" "run to call7a"
713 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
714 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
715 -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 $" {
716 pass "backtrace from call7a"
718 -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 $" {
719 xfail "backtrace from call7a"
723 # Continue; should stop at call7b and print actual arguments.
728 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
730 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
731 "\[\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'\\) "
732 "\[\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\\) "
733 "\[\r\n\]#2 .* main \\(.*\\) at "
736 # Continue; should stop at call7c and print actual arguments.
741 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
742 "\[\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\\) "
743 "\[\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'\\) "
744 "\[\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\\) "
745 "\[\r\n\]#3 .* main \\(.*\\) at "
748 # Continue; should stop at call7d and print actual arguments.
753 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
754 "\[\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\\) "
755 "\[\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\\) "
756 "\[\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'\\) "
757 "\[\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\\) "
758 "\[\r\n\]#4 .* main \\(.*\\) at "
763 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
764 "\[\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\\) "
765 "\[\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\\) "
766 "\[\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\\) "
767 "\[\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'\\) "
768 "\[\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\\) "
769 "\[\r\n\]#5 .* main \\(.*\\) at "
772 # Continue; should stop at call7f and print actual arguments.
777 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
778 "\[\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\\) "
779 "\[\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\\) "
780 "\[\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\\) "
781 "\[\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\\) "
782 "\[\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'\\) "
783 "\[\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\\) "
784 "\[\r\n\]#6 .* main \\(.*\\) at "
787 # Continue; should stop at call7g and print actual arguments.
792 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
793 "\[\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'\\) "
794 "\[\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\\) "
795 "\[\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\\) "
796 "\[\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\\) "
797 "\[\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\\) "
798 "\[\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'\\) "
799 "\[\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\\) "
800 "\[\r\n\]#7 .* main \\(.*\\) at "
805 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
806 "\[\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\\) "
807 "\[\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'\\) "
808 "\[\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\\) "
809 "\[\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\\) "
810 "\[\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\\) "
811 "\[\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\\) "
812 "\[\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'\\) "
813 "\[\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\\) "
814 "\[\r\n\]#8 .* main \\(.*\\) at "
817 # monitor only allows 8 breakpoints; w89k board allows 10, so
818 # break them up into two groups.
820 gdb_breakpoint call7i
821 gdb_breakpoint call7j
822 gdb_breakpoint call7k
824 # Continue; should stop at call7i and print actual arguments.
829 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
830 "\[\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\\) "
831 "\[\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\\) "
832 "\[\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'\\) "
833 "\[\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\\) "
834 "\[\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\\) "
835 "\[\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\\) "
836 "\[\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\\) "
837 "\[\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'\\) "
838 "\[\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\\) "
839 "\[\r\n\]#9 .* main \\(.*\\) at "
842 # Continue; should stop at call7j and print actual arguments.
847 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
848 "\[\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\\) "
849 "\[\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\\) "
850 "\[\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\\) "
851 "\[\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'\\) "
852 "\[\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\\) "
853 "\[\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\\) "
854 "\[\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\\) "
855 "\[\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\\) "
856 "\[\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'\\) "
857 "\[\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\\) "
858 "\[\r\n\]#10 .* main \\(.*\\) at "
861 # Continue; should stop at call7k and print actual arguments.
866 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
867 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
868 "\[\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\\) "
869 "\[\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\\) "
870 "\[\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\\) "
871 "\[\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\\) "
872 "\[\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'\\) "
873 "\[\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\\) "
874 "\[\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\\) "
875 "\[\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\\) "
876 "\[\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\\) "
877 "\[\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'\\) "
878 "\[\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\\) "
879 "\[\r\n\]#11 .* main \\(.*\\) at "
881 gdb_stop_suppressing_tests
885 # Locate actual args; recursive passing of structs by value
888 proc recursive_structs_by_value {} {
896 gdb_breakpoint hitbottom
898 # Run; should stop at hitbottom and print actual arguments.
901 gdb_test "" "Breakpoint $decimal, hitbottom .*" "run to hitbottom"
903 if ![istarget sparclet-*-*] {
904 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
905 "\[\r\n\]#0 .* hitbottom \\(\\) "
906 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
907 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
908 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
909 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
910 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
911 "\[\r\n\]#6 .* test_struct_args \\(\\) "
912 "\[\r\n\]#7 .* main \\(.*\\) at "
915 fail "recursive passing of structs by value (sparclet)"
917 gdb_stop_suppressing_tests
921 # Test for accessing local stack variables in functions which call alloca
923 proc localvars_after_alloca { } {
929 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
931 # Print each arg as a double check to see if we can print
932 # them here as well as with backtrace.
934 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
935 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
936 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
937 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
938 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
939 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
942 gdb_test "next" ".*" "next in localvars_after_alloca()"
944 # Print each arg as a double check to see if we can print
945 # them here as well as with backtrace.
947 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
948 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
949 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
950 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
952 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
953 gdb_stop_suppressing_tests
956 proc call_after_alloca { } {
962 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
964 # Print each arg as a double check to see if we can print
965 # them here as well as with backtrace.
967 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
968 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
969 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
970 gdb_test "print s" " = 1" "print s in call_after_alloca"
971 gdb_test "print i" " = 2" "print i in call_after_alloca"
972 gdb_test "print l" " = 3" "print l in call_after_alloca"
974 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
975 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"
976 gdb_stop_suppressing_tests
980 # Test for accessing local stack variables, backtraces, finish,
981 # and finally stepping into indirect calls. The point is that on the PA
982 # these use a funky `dyncall' mechanism which GDB needs to know about.
984 proc localvars_in_indirect_call { } {
990 # Can not use "runto call0a" as call0a is called several times
991 # during single run. Instead stop in a marker function and
992 # take control from there.
993 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
995 # break on the next call to call0a, then delete all the breakpoints
997 gdb_breakpoint call0a
1001 # Print each arg as a double check to see if we can print
1002 # them here as well as with backtrace.
1004 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1005 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1006 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1007 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1008 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1009 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1011 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1012 gdb_test "backtrace 8" \
1013 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1014 "backtrace in indirectly called function"
1017 # "finish" brings us back to main. We then will try to step through
1018 # the second indirect call.
1019 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1020 # of the first indirect call. This is due to stack adjustment instructions
1021 # after the indirect call. In these cases we will step till we hit the
1022 # second indirect call.
1025 gdb_test_multiple "finish" "finish from indirectly called function" {
1026 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1027 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1028 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary
1029 #to continue the test.
1033 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1034 pass "finish from indirectly called function"
1036 -re ".*$gdb_prompt $" {
1037 fail "finish from indirectly called function"
1041 fail "finish from indirectly called function"
1046 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1047 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1048 "stepping into indirectly called function"
1049 gdb_stop_suppressing_tests
1053 # Test for stepping into indirect calls which may have trampolines (possibly
1054 # cascaded) on both the call path and the gdb_suppress_tests; path.
1055 # to handle trampolines.
1057 proc test_stepping_over_trampolines { } {
1062 # Stop in a marker function and take control from there.
1063 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1065 # Cater for gdb stopping in midline, see comment for finish above.
1066 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1067 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1071 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1072 pass "finish from marker_call_with_trampolines"
1074 -re ".*$gdb_prompt $" {
1075 fail "finish from marker_call_with_trampolines"
1078 fail "finish from marker_call_with_trampolines"
1083 # Try to step into the target function.
1084 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1085 "stepping into function called with trampolines"
1087 # Make we can backtrace and the argument looks correct. */
1088 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1089 "backtrace through call with trampolines"
1091 # Make sure we can get back to main.
1092 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1093 # or immediately transfer control back to main if optimizations
1095 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1096 -re "main .* at.*$gdb_prompt $" {
1097 pass "stepping back to main from function called with trampolines"
1100 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1104 -re ".*$gdb_prompt $" {
1105 fail "stepping back to main from function called with trampolines"
1108 fail "stepping back to main from function called with trampolines"
1112 gdb_stop_suppressing_tests
1115 set prev_timeout $timeout
1116 if [istarget "mips*tx39-*"] {
1122 # Determine expected output for unsigned long variables,
1123 # the output varies with sizeof (unsigned long).
1125 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1126 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1127 set target_sizeof_long 4
1130 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1131 set target_sizeof_long 8
1136 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1137 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1138 set target_sizeof_int 2
1141 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1142 set target_sizeof_int 4
1145 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1146 set target_sizeof_int 8
1151 gdb_test_multiple "show endian" "getting target endian" {
1152 -re ".*little endian.*$gdb_prompt $" {
1153 set target_bigendian_p 0
1156 -re ".*big endian.*$gdb_prompt $" {
1157 set target_bigendian_p 1
1164 gdb_test_no_output "set print frame-arguments all"
1167 unsigned_integral_args
1168 if {![target_info exists gdb,skip_float_tests]} {
1169 float_and_integral_args
1172 # Test _Complex type here if supported.
1173 if [support_complex_tests] {
1176 complex_integral_args
1178 if {![target_info exists gdb,skip_float_tests]} {
1179 complex_float_integral_args
1184 structs_by_reference
1188 recursive_structs_by_value
1189 localvars_after_alloca
1191 localvars_in_indirect_call
1192 test_stepping_over_trampolines
1194 set timeout $prev_timeout