1 # Copyright 1992-2019 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 set skip_float_test [gdb_skip_float_test]
34 if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} {
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-*-*" }
58 gdb_test "" " call0a \\(c=97 'a', s=1, i=2, l=3\\) .*" "run to call0a"
60 # Print each arg as a double check to see if we can print
61 # them here as well as with backtrace.
62 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
63 gdb_test "print s" ".* = 1" "print s after run to call0a"
64 gdb_test "print i" ".* = 2" "print i after run to call0a"
65 gdb_test "print l " ".* = 3" "print l after run to call0a"
67 # Continue; should stop at call0b and print actual arguments.
68 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
72 # Continue; should stop at call0c and print actual arguments.
73 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
77 # Continue; should stop at call0d and print actual arguments.
78 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
82 # Continue; should stop at call0e and print actual arguments.
83 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" ] {
86 gdb_stop_suppressing_tests
90 # Locate actual args; unsigned integral types.
93 proc unsigned_integral_args {} {
100 gdb_breakpoint call1a
101 gdb_breakpoint call1b
102 gdb_breakpoint call1c
103 gdb_breakpoint call1d
104 gdb_breakpoint call1e
106 # Run; should stop at call1a and print actual arguments.
107 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
109 gdb_test "" " call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*" "run to call1a"
111 # Print each arg as a double check to see if we can print
112 # them here as well as with backtrace.
113 gdb_test "print uc" ".* = 98 'b'"
114 gdb_test "print us" ".* = 6"
115 gdb_test "print ui" ".* = 7"
116 gdb_test "print ul" ".* = 8"
118 # Continue; should stop at call1b and print actual arguments.
119 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
123 # Continue; should stop at call1c and print actual arguments.
124 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
128 # Continue; should stop at call1d and print actual arguments.
129 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
133 # Continue; should stop at call1e and print actual arguments.
134 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"] {
137 gdb_stop_suppressing_tests
141 # Locate actual args; integrals mixed with floating point.
144 proc float_and_integral_args {} {
151 gdb_breakpoint call2a
152 gdb_breakpoint call2b
153 gdb_breakpoint call2c
154 gdb_breakpoint call2d
155 gdb_breakpoint call2e
156 gdb_breakpoint call2f
157 gdb_breakpoint call2g
158 gdb_breakpoint call2h
160 # Run; should stop at call2a and print actual arguments.
162 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
164 set test "run to call2a"
165 gdb_test_multiple "" $test {
166 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
169 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
174 # Print each arg as a double check to see if we can print
175 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
176 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
177 gdb_test "print s" ".* = 1" "print s after run to call2a"
178 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
179 gdb_test "print i" ".* = 2" "print i after run to call2a"
180 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
181 gdb_test "print l" ".* = 3" "print l after run to call2a"
182 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
184 setup_xfail "rs6000-*-*"
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 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
490 -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 $" {
491 pass "backtrace from call6a"
493 -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 $" {
494 xfail "backtrace from call6a"
498 # Continue; should stop at call6b and print actual arguments.
503 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
504 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
505 "\[\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\\) "
506 "\[\r\n\]#2 .* main \\(.*\\) at "
511 # Continue; should stop at call6c and print actual arguments.
516 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
517 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
518 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
519 "\[\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\\) "
520 "\[\r\n\]#3 .* main \\(.*\\) at "
524 # Continue; should stop at call6d and print actual arguments.
529 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
530 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
531 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
532 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
533 "\[\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\\) "
534 "\[\r\n\]#4 .* main \\(.*\\) at "
539 # Continue; should stop at call6e and print actual arguments.
544 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
545 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
546 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
547 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
548 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
549 "\[\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\\) "
550 "\[\r\n\]#5 .* main \\(.*\\) at "
555 # Continue; should stop at call6f and print actual arguments.
560 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
561 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
562 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
563 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
564 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
565 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
566 "\[\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\\) "
567 "\[\r\n\]#6 .* main \\(.*\\) at "
572 # Continue; should stop at call6g and print actual arguments.
577 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
578 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
579 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
580 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
581 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
582 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
583 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
584 "\[\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\\) "
585 "\[\r\n\]#7 .* main \\(.*\\) at "
590 # Continue; should stop at call6h and print actual arguments.
595 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
596 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
597 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
598 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
600 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
601 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
602 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
603 "\[\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\\) "
604 "\[\r\n\]#8 .* main \\(.*\\) at "
609 # monitor only allows 8 breakpoints; w89k board allows 10, so
610 # break them up into two groups.
612 gdb_breakpoint call6i
613 gdb_breakpoint call6j
614 gdb_breakpoint call6k
616 # Continue; should stop at call6i and print actual arguments.
621 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
622 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
623 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
624 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
625 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
626 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
627 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
628 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
629 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
630 "\[\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\\) "
631 "\[\r\n\]#9 .* main \\(.*\\) at "
636 # Continue; should stop at call6j and print actual arguments.
641 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
642 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
643 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
644 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
645 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
646 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
647 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
650 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
651 "\[\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\\) "
652 "\[\r\n\]#10 .* main \\(.*\\) at "
657 # Continue; should stop at call6k and print actual arguments.
661 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
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 \\(.*\\) at "
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.
707 gdb_test "" "Breakpoint $decimal, call7a .*" "run to call7a"
709 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
710 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
711 -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 $" {
712 pass "backtrace from call7a"
714 -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 $" {
715 xfail "backtrace from call7a"
719 # Continue; should stop at call7b and print actual arguments.
724 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
726 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
727 "\[\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'\\) "
728 "\[\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\\) "
729 "\[\r\n\]#2 .* main \\(.*\\) at "
732 # Continue; should stop at call7c and print actual arguments.
737 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
738 "\[\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\\) "
739 "\[\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'\\) "
740 "\[\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\\) "
741 "\[\r\n\]#3 .* main \\(.*\\) at "
744 # Continue; should stop at call7d and print actual arguments.
749 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
750 "\[\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\\) "
751 "\[\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\\) "
752 "\[\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'\\) "
753 "\[\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\\) "
754 "\[\r\n\]#4 .* main \\(.*\\) at "
759 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
760 "\[\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\\) "
761 "\[\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\\) "
762 "\[\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\\) "
763 "\[\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'\\) "
764 "\[\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\\) "
765 "\[\r\n\]#5 .* main \\(.*\\) at "
768 # Continue; should stop at call7f and print actual arguments.
773 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
774 "\[\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\\) "
775 "\[\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\\) "
776 "\[\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\\) "
777 "\[\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\\) "
778 "\[\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'\\) "
779 "\[\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\\) "
780 "\[\r\n\]#6 .* main \\(.*\\) at "
783 # Continue; should stop at call7g and print actual arguments.
788 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
789 "\[\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'\\) "
790 "\[\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\\) "
791 "\[\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\\) "
792 "\[\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\\) "
793 "\[\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\\) "
794 "\[\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'\\) "
795 "\[\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\\) "
796 "\[\r\n\]#7 .* main \\(.*\\) at "
801 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
802 "\[\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\\) "
803 "\[\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'\\) "
804 "\[\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\\) "
805 "\[\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\\) "
806 "\[\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\\) "
807 "\[\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\\) "
808 "\[\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'\\) "
809 "\[\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\\) "
810 "\[\r\n\]#8 .* main \\(.*\\) at "
813 # monitor only allows 8 breakpoints; w89k board allows 10, so
814 # break them up into two groups.
816 gdb_breakpoint call7i
817 gdb_breakpoint call7j
818 gdb_breakpoint call7k
820 # Continue; should stop at call7i and print actual arguments.
825 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
826 "\[\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\\) "
827 "\[\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\\) "
828 "\[\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'\\) "
829 "\[\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\\) "
830 "\[\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\\) "
831 "\[\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\\) "
832 "\[\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\\) "
833 "\[\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'\\) "
834 "\[\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\\) "
835 "\[\r\n\]#9 .* main \\(.*\\) at "
838 # Continue; should stop at call7j and print actual arguments.
843 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
844 "\[\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\\) "
845 "\[\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\\) "
846 "\[\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\\) "
847 "\[\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'\\) "
848 "\[\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\\) "
849 "\[\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\\) "
850 "\[\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\\) "
851 "\[\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\\) "
852 "\[\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'\\) "
853 "\[\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\\) "
854 "\[\r\n\]#10 .* main \\(.*\\) at "
857 # Continue; should stop at call7k and print actual arguments.
862 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
863 "\[\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\\) "
864 "\[\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\\) "
865 "\[\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\\) "
866 "\[\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\\) "
867 "\[\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'\\) "
868 "\[\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\\) "
869 "\[\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\\) "
870 "\[\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\\) "
871 "\[\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\\) "
872 "\[\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'\\) "
873 "\[\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\\) "
874 "\[\r\n\]#11 .* main \\(.*\\) at "
876 gdb_stop_suppressing_tests
880 # Locate actual args; recursive passing of structs by value
883 proc recursive_structs_by_value {} {
891 gdb_breakpoint hitbottom
893 # Run; should stop at hitbottom and print actual arguments.
896 gdb_test "" "Breakpoint $decimal, hitbottom .*" "run to hitbottom"
898 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
899 "\[\r\n\]#0 .* hitbottom \\(\\) "
900 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
901 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
902 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
903 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
904 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
905 "\[\r\n\]#6 .* test_struct_args \\(\\) "
906 "\[\r\n\]#7 .* main \\(.*\\) at "
908 gdb_stop_suppressing_tests
912 # Test for accessing local stack variables in functions which call alloca
914 proc localvars_after_alloca { } {
920 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
922 # Print each arg as a double check to see if we can print
923 # them here as well as with backtrace.
925 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
926 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
927 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
928 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
929 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
930 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
933 gdb_test "next" ".*" "next in localvars_after_alloca()"
935 # Print each arg as a double check to see if we can print
936 # them here as well as with backtrace.
938 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
939 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
940 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
941 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
943 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
944 gdb_stop_suppressing_tests
947 proc call_after_alloca { } {
953 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
955 # Print each arg as a double check to see if we can print
956 # them here as well as with backtrace.
958 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
959 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
960 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
961 gdb_test "print s" " = 1" "print s in call_after_alloca"
962 gdb_test "print i" " = 2" "print i in call_after_alloca"
963 gdb_test "print l" " = 3" "print l in call_after_alloca"
965 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
966 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"
967 gdb_stop_suppressing_tests
971 # Test for accessing local stack variables, backtraces, finish,
972 # and finally stepping into indirect calls. The point is that on the PA
973 # these use a funky `dyncall' mechanism which GDB needs to know about.
975 proc localvars_in_indirect_call { } {
981 # Can not use "runto call0a" as call0a is called several times
982 # during single run. Instead stop in a marker function and
983 # take control from there.
984 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
986 # break on the next call to call0a, then delete all the breakpoints
988 gdb_breakpoint call0a
992 # Print each arg as a double check to see if we can print
993 # them here as well as with backtrace.
995 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
996 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
997 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
998 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
999 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1000 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1002 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1003 gdb_test "backtrace 8" \
1004 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1005 "backtrace in indirectly called function"
1008 # "finish" brings us back to main. We then will try to step through
1009 # the second indirect call.
1010 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1011 # of the first indirect call. This is due to stack adjustment instructions
1012 # after the indirect call. In these cases we will step till we hit the
1013 # second indirect call.
1016 gdb_test_multiple "finish" "finish from indirectly called function" {
1017 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1018 # If the branch instruction is not the last instruction in the
1019 # function call line, we'll stop at that line, and need an extra
1020 # "step" to continue the test.
1024 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1025 pass "finish from indirectly called function"
1027 -re ".*$gdb_prompt $" {
1028 fail "finish from indirectly called function"
1032 fail "finish from indirectly called function"
1037 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1038 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1039 "stepping into indirectly called function"
1040 gdb_stop_suppressing_tests
1044 # Test for stepping into indirect calls which may have trampolines (possibly
1045 # cascaded) on both the call path and the gdb_suppress_tests; path.
1046 # to handle trampolines.
1048 proc test_stepping_over_trampolines { } {
1053 # Stop in a marker function and take control from there.
1054 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1056 # Cater for gdb stopping in midline, see comment for finish above.
1057 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1058 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1062 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1063 pass "finish from marker_call_with_trampolines"
1065 -re ".*$gdb_prompt $" {
1066 fail "finish from marker_call_with_trampolines"
1069 fail "finish from marker_call_with_trampolines"
1074 # Try to step into the target function.
1075 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1076 "stepping into function called with trampolines"
1078 # Make we can backtrace and the argument looks correct. */
1079 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1080 "backtrace through call with trampolines"
1082 # Make sure we can get back to main.
1083 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1084 # or immediately transfer control back to main if optimizations
1086 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1087 -re "main .* at.*$gdb_prompt $" {
1088 pass "stepping back to main from function called with trampolines"
1091 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1095 -re ".*$gdb_prompt $" {
1096 fail "stepping back to main from function called with trampolines"
1099 fail "stepping back to main from function called with trampolines"
1103 gdb_stop_suppressing_tests
1106 set prev_timeout $timeout
1107 if [istarget "mips*tx39-*"] {
1113 # Determine expected output for unsigned long variables,
1114 # the output varies with sizeof (unsigned long).
1116 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1117 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1118 set target_sizeof_long 4
1121 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1122 set target_sizeof_long 8
1127 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1128 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1129 set target_sizeof_int 2
1132 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1133 set target_sizeof_int 4
1136 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1137 set target_sizeof_int 8
1142 switch [get_endianness] {
1143 little { set target_bigendian_p 0 }
1144 big { set target_bigendian_p 1 }
1149 gdb_test_no_output "set print frame-arguments all"
1152 unsigned_integral_args
1153 if {!$skip_float_test} {
1154 float_and_integral_args
1157 # Test _Complex type here if supported.
1158 if [support_complex_tests] {
1161 complex_integral_args
1163 if {!$skip_float_test} {
1164 complex_float_integral_args
1169 structs_by_reference
1173 recursive_structs_by_value
1174 localvars_after_alloca
1176 localvars_in_indirect_call
1177 test_stepping_over_trampolines
1179 set timeout $prev_timeout