gdb/testsuite: fix gdb.trace/signal.exp on x86
[binutils-gdb/blckswan.git] / gdb / testsuite / gdb.base / funcargs.exp
blob96448dc2c9a123eeb97717630ac8e130f70505ab
1 # Copyright 1992-2022 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)
19 standard_testfile
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] {
29 return -1
32 set skip_float_test [gdb_skip_float_test]
34 if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} {
35 return -1
39 # Locate actual args; integral types.
42 proc_with_prefix integral_args {} {
43 global gdb_prompt
44 global det_file
45 global gcc_compiled
47 delete_breakpoints
49 gdb_breakpoint call0a
50 gdb_breakpoint call0b
51 gdb_breakpoint call0c
52 gdb_breakpoint call0d
53 gdb_breakpoint call0e
55 # Run; should stop at call0a and print actual arguments.
56 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
57 gdb_run_cmd
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 gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"
70 # Continue; should stop at call0c and print actual arguments.
71 gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"
73 # Continue; should stop at call0d and print actual arguments.
74 gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d"
76 # Continue; should stop at call0e and print actual arguments.
77 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"
81 # Locate actual args; unsigned integral types.
84 proc unsigned_integral_args {} {
85 global gdb_prompt
86 global det_file
87 global gcc_compiled
89 delete_breakpoints
91 gdb_breakpoint call1a
92 gdb_breakpoint call1b
93 gdb_breakpoint call1c
94 gdb_breakpoint call1d
95 gdb_breakpoint call1e
97 # Run; should stop at call1a and print actual arguments.
98 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
99 gdb_run_cmd
100 gdb_test "" " call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*" "run to call1a"
102 # Print each arg as a double check to see if we can print
103 # them here as well as with backtrace.
104 gdb_test "print uc" ".* = 98 'b'"
105 gdb_test "print us" ".* = 6"
106 gdb_test "print ui" ".* = 7"
107 gdb_test "print ul" ".* = 8"
109 # Continue; should stop at call1b and print actual arguments.
110 gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"
112 # Continue; should stop at call1c and print actual arguments.
113 gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"
115 # Continue; should stop at call1d and print actual arguments.
116 gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"
118 # Continue; should stop at call1e and print actual arguments.
119 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"
123 # Locate actual args; integrals mixed with floating point.
126 proc float_and_integral_args {} {
127 global gdb_prompt
128 global det_file
129 global gcc_compiled
131 delete_breakpoints
133 gdb_breakpoint call2a
134 gdb_breakpoint call2b
135 gdb_breakpoint call2c
136 gdb_breakpoint call2d
137 gdb_breakpoint call2e
138 gdb_breakpoint call2f
139 gdb_breakpoint call2g
140 gdb_breakpoint call2h
142 # Run; should stop at call2a and print actual arguments.
144 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
145 gdb_run_cmd
146 set test "run to call2a"
147 gdb_test_multiple "" $test {
148 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
149 pass $test
151 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
152 xfail $test
156 # Print each arg as a double check to see if we can print
157 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
158 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
159 gdb_test "print s" ".* = 1" "print s after run to call2a"
160 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
161 gdb_test "print i" ".* = 2" "print i after run to call2a"
162 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
163 gdb_test "print l" ".* = 3" "print l after run to call2a"
164 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
166 setup_xfail "rs6000-*-*"
167 # Continue; should stop at call2b and print actual arguments.
168 gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"
170 # Continue; should stop at call2c and print actual arguments.
171 gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"
173 # Continue; should stop at call2d and print actual arguments.
174 gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"
176 # Continue; should stop at call2e and print actual arguments.
177 gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"
179 # Continue; should stop at call2f and print actual arguments.
180 gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"
182 # Continue; should stop at call2g and print actual arguments.
183 gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"
185 # Continue; should stop at call2h and print actual arguments.
186 gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"
188 # monitor only allows 8 breakpoints; w89k board allows 10, so
189 # break them up into two groups.
190 delete_breakpoints
191 gdb_breakpoint call2i
193 # Continue; should stop at call2i and print actual arguments.
194 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"
199 # Locate actual args; _Complex types.
202 proc_with_prefix complex_args {} {
203 global gdb_prompt
205 delete_breakpoints
207 gdb_breakpoint callca
208 gdb_breakpoint callcb
209 gdb_breakpoint callcc
210 gdb_breakpoint callcd
211 gdb_breakpoint callce
212 gdb_breakpoint callcf
214 # Run; should stop at call1a and print actual arguments.
215 gdb_run_cmd
216 gdb_test "" " callca \\(f1=1 \\+ 2i, f2=1 \\+ 2i, f3=1 \\+ 2i\\) .*" "run to call2a"
218 gdb_test "cont" ".* callcb \\(d1=3 \\+ 4i, d2=3 \\+ 4i, d3=3 \\+ 4i\\) .*" "continue to callcb"
219 gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6i, ld2=5 \\+ 6i, ld3=5 \\+ 6i\\) .*" "continue to callcc"
220 gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2i, dc1=3 \\+ 4i, ldc1=5 \\+ 6i\\) .*" "continue to callcd"
221 gdb_test "cont" ".* callce \\(dc1=3 \\+ 4i, ldc1=5 \\+ 6i, fc1=1 \\+ 2i\\) .*" "continue to callce"
222 gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6i, fc1=1 \\+ 2i, dc1=3 \\+ 4i\\) .*" "continue to callcf"
227 # Locate actual args; _Complex types and integral.
229 proc_with_prefix complex_integral_args {} {
230 global gdb_prompt
232 delete_breakpoints
234 gdb_breakpoint callc1a
235 gdb_breakpoint callc1b
237 # Run; should stop at call1a and print actual arguments.
238 gdb_run_cmd
239 gdb_test "" " callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2i, dc1=3 \\+ 4i, ldc1=5 \\+ 6i\\) .*" "run to callc1a"
241 gdb_test "cont" ".* callc1b \\(ldc1=5 \\+ 6i\\, c=97 'a', s=1, i=2, fc1=1 \\+ 2i, ui=7, l=3, dc1=3 \\+ 4i\\) .*" "continue to callc1b"
245 # Locate actual args; _Complex types and integral/float.
247 proc_with_prefix complex_float_integral_args {} {
248 global gdb_prompt
250 delete_breakpoints
252 gdb_breakpoint callc2a
253 gdb_breakpoint callc2b
255 # Run; should stop at call1a and print actual arguments.
256 gdb_run_cmd
257 gdb_test "" " callc2a \\(c=97 'a', s=1, i=2, ui=7, l=3, f=4, d=5, fc1=1 \\+ 2i, dc1=3 \\+ 4i, ldc1=5 \\+ 6i\\) .*" "run to callc2a"
259 gdb_test "cont" ".* callc2b \\(fc1=1 \\+ 2i, c=97 'a', s=1, i=2, ui=7, ldc1=5 \\+ 6i\\, l=3, f=4, d=5, dc1=3 \\+ 4i\\) .*" "continue to callc2b"
263 # Locate actual args; dereference pointers to ints and floats.
266 proc_with_prefix pointer_args {} {
267 global gdb_prompt
268 global hex
269 global det_file
271 delete_breakpoints
273 gdb_breakpoint call3a
274 gdb_breakpoint call3b
275 gdb_breakpoint call3c
277 # Run; should stop at call3a and print actual arguments.
278 # Try dereferencing the arguments.
280 gdb_run_cmd
281 gdb_test "" " call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$hex <l>\\) .*" "run to call3a"
283 gdb_test "print *cp" ".* = 97 'a'"
284 gdb_test "print *sp" ".* = 1"
285 gdb_test "print *ip" ".* = 2"
286 gdb_test "print *lp" ".* = 3"
288 # Continue; should stop at call3b and print actual arguments.
289 # Try dereferencing the arguments.
290 gdb_test "cont" ".* call3b \\(ucp=$hex <uc> \"b.*\", usp=$hex <us>, uip=$hex <ui>, ulp=$hex <ul>\\) .*" "continue to call3b"
292 gdb_test "print *ucp" ".* = 98 'b'"
293 gdb_test "print *usp" ".* = 6"
294 gdb_test "print *uip" ".* = 7"
295 gdb_test "print *ulp" ".* = 8"
297 # Continue; should stop at call3c and print actual arguments.
298 # Try dereferencing the arguments.
299 gdb_test "cont" ".* call3c \\(fp=$hex <f>, dp=$hex <d>\\) .*" "continue to call3c"
301 gdb_test "print *fp" ".* = 4"
302 gdb_test "print *dp" ".* = 5"
306 # Locate actual args; structures and unions passed by reference.
309 proc_with_prefix structs_by_reference {} {
310 global gdb_prompt
311 global hex
312 global det_file
313 global target_sizeof_int
314 global target_sizeof_long
315 global target_bigendian_p
317 delete_breakpoints
319 gdb_breakpoint call4a
320 gdb_breakpoint call4b
322 # Run; should stop at call4a and print actual arguments.
323 # Try dereferencing the arguments.
325 gdb_run_cmd
326 gdb_test "" " call4a \\(stp=$hex <st>\\) .*" "run to call4a"
328 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
330 # Continue; should stop at call4b and print actual arguments.
332 gdb_test "cont" ".* call4b \\(unp=$hex <un>\\) .*" "continue to call4b"
334 # Try dereferencing the arguments.
335 if { $target_sizeof_long == $target_sizeof_int } {
336 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
337 "print *unp (sizeof long == sizeof int)"
338 } elseif { ! $target_bigendian_p } {
339 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
340 "print *unp (little-endian, sizeof long != sizeof int)"
341 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
342 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
343 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
344 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
345 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
346 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
347 } else {
348 fail "print *unp (unknown case)"
351 pass "locate actual args, structs/unions passed by reference"
355 # Locate actual args; structures and unions passed by value.
358 proc_with_prefix structs_by_value {} {
359 global gdb_prompt
360 global hex
361 global det_file
362 global target_sizeof_int
363 global target_sizeof_long
364 global target_bigendian_p
366 delete_breakpoints
368 gdb_breakpoint call5a
369 gdb_breakpoint call5b
371 # Run; should stop at call5a and print actual arguments.
372 # Try dereferencing the arguments.
374 gdb_run_cmd
375 gdb_test "" " call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*" "run to call5a"
377 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
379 # Continue; should stop at call5b and print actual arguments.
380 if { $target_sizeof_long == $target_sizeof_int } {
381 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
382 "continue to call5b (sizeof long == sizeof int)"
383 } elseif { ! $target_bigendian_p } {
384 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
385 "continue to call5b (little-endian, sizeof long != sizeof int)"
386 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
387 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
388 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
389 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
390 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
391 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
392 } else {
393 fail "continue to call5b (unknown case)"
396 # Try dereferencing the arguments.
397 if { $target_sizeof_long == $target_sizeof_int } {
398 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
399 "print un (sizeof long == sizeof int)"
400 } elseif { ! $target_bigendian_p } {
401 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
402 "print un (little-endian, sizeof long != sizeof int)"
403 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
404 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
405 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
406 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
407 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
408 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
409 } else {
410 fail "print un (unknown case)"
415 # Locate actual args; discard, shuffle, and call
418 proc_with_prefix discard_and_shuffle {} {
419 global gdb_prompt
420 global hex
421 global decimal
422 global det_file
423 global gcc_compiled
425 delete_breakpoints
427 gdb_breakpoint call6a
428 gdb_breakpoint call6b
429 gdb_breakpoint call6c
430 gdb_breakpoint call6d
431 gdb_breakpoint call6e
432 gdb_breakpoint call6f
433 gdb_breakpoint call6g
434 gdb_breakpoint call6h
436 # Run; should stop at call6a and print actual arguments.
437 # Print backtrace.
439 gdb_run_cmd
440 gdb_test "" "Breakpoint $decimal, call6a .*" "run to call6a"
442 setup_xfail "rs6000-*-*"
444 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
445 -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 $" {
446 pass "backtrace from call6a"
448 -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 $" {
449 xfail "backtrace from call6a"
453 # Continue; should stop at call6b and print actual arguments.
454 # Print backtrace.
456 gdb_continue call6b
458 gdb_test_sequence "backtrace 100" "backtrace from call6b" {
459 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
460 "\[\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\\) "
461 "\[\r\n\]#2 .* main \\(.*\\) at "
464 # Continue; should stop at call6c and print actual arguments.
465 # Print backtrace.
467 gdb_continue call6c
469 gdb_test_sequence "backtrace 100" "backtrace from call6c" {
470 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
471 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
472 "\[\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\\) "
473 "\[\r\n\]#3 .* main \\(.*\\) at "
476 # Continue; should stop at call6d and print actual arguments.
477 # Print backtrace.
479 gdb_continue call6d
481 gdb_test_sequence "backtrace 100" "backtrace from call6d" {
482 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
483 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
484 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
485 "\[\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\\) "
486 "\[\r\n\]#4 .* main \\(.*\\) at "
489 # Continue; should stop at call6e and print actual arguments.
490 # Print backtrace.
492 gdb_continue call6e
494 gdb_test_sequence "backtrace 100" "backtrace from call6e" {
495 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
496 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
497 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
498 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
499 "\[\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\\) "
500 "\[\r\n\]#5 .* main \\(.*\\) at "
503 # Continue; should stop at call6f and print actual arguments.
504 # Print backtrace.
506 gdb_continue call6f
508 gdb_test_sequence "backtrace 100" "backtrace from call6f" {
509 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
510 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
511 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
512 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
513 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
514 "\[\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\\) "
515 "\[\r\n\]#6 .* main \\(.*\\) at "
518 # Continue; should stop at call6g and print actual arguments.
519 # Print backtrace.
521 gdb_continue call6g
523 gdb_test_sequence "backtrace 100" "backtrace from call6g" {
524 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
525 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
526 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
527 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
528 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
529 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
530 "\[\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\\) "
531 "\[\r\n\]#7 .* main \\(.*\\) at "
534 # Continue; should stop at call6h and print actual arguments.
535 # Print backtrace.
537 gdb_continue call6h
539 gdb_test_sequence "backtrace 100" "backtrace from call6h" {
540 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
541 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
542 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
543 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
544 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
545 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
546 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
547 "\[\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\\) "
548 "\[\r\n\]#8 .* main \\(.*\\) at "
551 # monitor only allows 8 breakpoints; w89k board allows 10, so
552 # break them up into two groups.
553 delete_breakpoints
554 gdb_breakpoint call6i
555 gdb_breakpoint call6j
556 gdb_breakpoint call6k
558 # Continue; should stop at call6i and print actual arguments.
559 # Print backtrace.
561 gdb_continue call6i
563 gdb_test_sequence "backtrace 100" "backtrace from call6i" {
564 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
565 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
566 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
567 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
568 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
569 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
570 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
571 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
572 "\[\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\\) "
573 "\[\r\n\]#9 .* main \\(.*\\) at "
576 # Continue; should stop at call6j and print actual arguments.
577 # Print backtrace.
579 gdb_continue call6j
581 gdb_test_sequence "backtrace 100" "backtrace from call6j" {
582 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
583 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
584 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
585 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
586 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
587 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
588 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
589 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
590 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
591 "\[\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\\) "
592 "\[\r\n\]#10 .* main \\(.*\\) at "
595 # Continue; should stop at call6k and print actual arguments.
596 # Print backtrace.
597 gdb_continue call6k
599 gdb_test_sequence "backtrace 100" "backtrace from call6k" {
600 "\[\r\n\]#0 .* call6k \\(\\) "
601 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
602 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
603 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
604 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
605 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
606 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
607 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
608 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
609 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
610 "\[\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\\) "
611 "\[\r\n\]#11 .* main \\(.*\\) at "
617 # Locate actual args; shuffle round robin and call
620 proc_with_prefix shuffle_round_robin {} {
621 global gdb_prompt
622 global hex
623 global decimal
624 global det_file
625 global gcc_compiled
627 delete_breakpoints
629 gdb_breakpoint call7a
630 gdb_breakpoint call7b
631 gdb_breakpoint call7c
632 gdb_breakpoint call7d
633 gdb_breakpoint call7e
634 gdb_breakpoint call7f
635 gdb_breakpoint call7g
636 gdb_breakpoint call7h
638 # Run; should stop at call7a and print actual arguments.
639 # Print backtrace.
641 gdb_run_cmd
642 gdb_test "" "Breakpoint $decimal, call7a .*" "run to call7a"
644 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
645 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
646 -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 $" {
647 pass "backtrace from call7a"
649 -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 $" {
650 xfail "backtrace from call7a"
654 # Continue; should stop at call7b and print actual arguments.
655 # Print backtrace.
657 gdb_continue call7b
659 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
661 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
662 "\[\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'\\) "
663 "\[\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\\) "
664 "\[\r\n\]#2 .* main \\(.*\\) at "
667 # Continue; should stop at call7c and print actual arguments.
668 # Print backtrace.
670 gdb_continue call7c
672 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
673 "\[\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\\) "
674 "\[\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'\\) "
675 "\[\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\\) "
676 "\[\r\n\]#3 .* main \\(.*\\) at "
679 # Continue; should stop at call7d and print actual arguments.
680 # Print backtrace.
682 gdb_continue call7d
684 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
685 "\[\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\\) "
686 "\[\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\\) "
687 "\[\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'\\) "
688 "\[\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\\) "
689 "\[\r\n\]#4 .* main \\(.*\\) at "
692 gdb_continue call7e
694 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
695 "\[\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\\) "
696 "\[\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\\) "
697 "\[\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\\) "
698 "\[\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'\\) "
699 "\[\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\\) "
700 "\[\r\n\]#5 .* main \\(.*\\) at "
703 # Continue; should stop at call7f and print actual arguments.
704 # Print backtrace.
706 gdb_continue call7f
708 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
709 "\[\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\\) "
710 "\[\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\\) "
711 "\[\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\\) "
712 "\[\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\\) "
713 "\[\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'\\) "
714 "\[\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\\) "
715 "\[\r\n\]#6 .* main \\(.*\\) at "
718 # Continue; should stop at call7g and print actual arguments.
719 # Print backtrace.
721 gdb_continue call7g
723 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
724 "\[\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'\\) "
725 "\[\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\\) "
726 "\[\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\\) "
727 "\[\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\\) "
728 "\[\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\\) "
729 "\[\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'\\) "
730 "\[\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\\) "
731 "\[\r\n\]#7 .* main \\(.*\\) at "
734 gdb_continue call7h
736 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
737 "\[\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\\) "
738 "\[\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'\\) "
739 "\[\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\\) "
740 "\[\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\\) "
741 "\[\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\\) "
742 "\[\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\\) "
743 "\[\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'\\) "
744 "\[\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\\) "
745 "\[\r\n\]#8 .* main \\(.*\\) at "
748 # monitor only allows 8 breakpoints; w89k board allows 10, so
749 # break them up into two groups.
750 delete_breakpoints
751 gdb_breakpoint call7i
752 gdb_breakpoint call7j
753 gdb_breakpoint call7k
755 # Continue; should stop at call7i and print actual arguments.
756 # Print backtrace.
758 gdb_continue call7i
760 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
761 "\[\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\\) "
762 "\[\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\\) "
763 "\[\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'\\) "
764 "\[\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\\) "
765 "\[\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\\) "
766 "\[\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\\) "
767 "\[\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\\) "
768 "\[\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'\\) "
769 "\[\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\\) "
770 "\[\r\n\]#9 .* main \\(.*\\) at "
773 # Continue; should stop at call7j and print actual arguments.
774 # Print backtrace.
776 gdb_continue call7j
778 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
779 "\[\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\\) "
780 "\[\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\\) "
781 "\[\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\\) "
782 "\[\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'\\) "
783 "\[\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\\) "
784 "\[\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\\) "
785 "\[\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\\) "
786 "\[\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\\) "
787 "\[\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'\\) "
788 "\[\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\\) "
789 "\[\r\n\]#10 .* main \\(.*\\) at "
792 # Continue; should stop at call7k and print actual arguments.
793 # Print backtrace.
795 gdb_continue call7k
797 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
798 "\[\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\\) "
799 "\[\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\\) "
800 "\[\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\\) "
801 "\[\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\\) "
802 "\[\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'\\) "
803 "\[\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\\) "
804 "\[\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\\) "
805 "\[\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\\) "
806 "\[\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\\) "
807 "\[\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'\\) "
808 "\[\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\\) "
809 "\[\r\n\]#11 .* main \\(.*\\) at "
814 # Locate actual args; recursive passing of structs by value
817 proc_with_prefix recursive_structs_by_value {} {
818 global gdb_prompt
819 global hex
820 global decimal
821 global det_file
823 delete_breakpoints
825 gdb_breakpoint hitbottom
827 # Run; should stop at hitbottom and print actual arguments.
828 # Print backtrace.
829 gdb_run_cmd
830 gdb_test "" "Breakpoint $decimal, hitbottom .*" "run to hitbottom"
832 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
833 "\[\r\n\]#0 .* hitbottom \\(\\) "
834 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
835 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
836 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
837 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
838 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
839 "\[\r\n\]#6 .* test_struct_args \\(\\) "
840 "\[\r\n\]#7 .* main \\(.*\\) at "
845 # Test for accessing local stack variables in functions which call alloca
847 proc_with_prefix localvars_after_alloca { } {
848 global gdb_prompt
849 global hex
850 global decimal
851 global gcc_compiled
853 if { ![runto localvars_after_alloca] } {
854 return
857 # Print each arg as a double check to see if we can print
858 # them here as well as with backtrace.
860 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
861 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
862 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
863 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
864 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
865 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
867 # Lame regexp.
868 gdb_test "next" ".*" "next in localvars_after_alloca()"
870 # Print each arg as a double check to see if we can print
871 # them here as well as with backtrace.
873 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
874 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
875 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
876 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
878 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
881 proc_with_prefix call_after_alloca { } {
882 global gdb_prompt
883 global hex
884 global decimal
885 global gcc_compiled
887 if { ![runto call_after_alloca_subr] } {
888 return
891 # Print each arg as a double check to see if we can print
892 # them here as well as with backtrace.
894 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
895 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
896 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
897 gdb_test "print s" " = 1" "print s in call_after_alloca"
898 gdb_test "print i" " = 2" "print i in call_after_alloca"
899 gdb_test "print l" " = 3" "print l in call_after_alloca"
901 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
902 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"
906 # Test for accessing local stack variables, backtraces, finish,
907 # and finally stepping into indirect calls. The point is that on the PA
908 # these use a funky `dyncall' mechanism which GDB needs to know about.
910 proc_with_prefix localvars_in_indirect_call { } {
911 global gdb_prompt
912 global hex
913 global decimal
914 global gcc_compiled
916 # Can not use "runto call0a" as call0a is called several times
917 # during single run. Instead stop in a marker function and
918 # take control from there.
919 if { ![runto marker_indirect_call] } {
920 return
923 # break on the next call to call0a, then delete all the breakpoints
924 # and start testing.
925 gdb_breakpoint call0a
926 gdb_continue call0a
927 delete_breakpoints
929 # Print each arg as a double check to see if we can print
930 # them here as well as with backtrace.
932 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
933 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
934 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
935 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
936 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
937 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
939 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
940 gdb_test "backtrace 8" \
941 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
942 "backtrace in indirectly called function"
945 # "finish" brings us back to main. We then will try to step through
946 # the second indirect call.
947 # On some targets (e.g. m68k) gdb will stop from the finish in midline
948 # of the first indirect call. This is due to stack adjustment instructions
949 # after the indirect call. In these cases we will step till we hit the
950 # second indirect call.
953 gdb_test_multiple "finish" "finish from indirectly called function" {
954 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
955 # If the branch instruction is not the last instruction in the
956 # function call line, we'll stop at that line, and need an extra
957 # "step" to continue the test.
958 send_gdb "step\n"
959 exp_continue
961 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
962 pass "finish from indirectly called function"
964 -re ".*$gdb_prompt $" {
965 fail "finish from indirectly called function"
967 default {
968 fail "finish from indirectly called function"
972 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
973 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
974 "stepping into indirectly called function"
978 # Test for stepping into indirect calls which may have trampolines (possibly
979 # cascaded) on both the call path and the gdb_suppress_tests; path.
980 # to handle trampolines.
982 proc_with_prefix stepping_over_trampolines { } {
983 global gdb_prompt
984 global hex
985 global decimal
987 # Stop in a marker function and take control from there.
988 if { ![runto marker_call_with_trampolines] } {
989 return
992 # Cater for gdb stopping in midline, see comment for finish above.
993 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
994 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
995 send_gdb "step\n"
996 exp_continue
998 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
999 pass "finish from marker_call_with_trampolines"
1001 -re ".*$gdb_prompt $" {
1002 fail "finish from marker_call_with_trampolines"
1004 default {
1005 fail "finish from marker_call_with_trampolines"
1009 # Try to step into the target function.
1010 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1011 "stepping into function called with trampolines"
1013 # Make we can backtrace and the argument looks correct. */
1014 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1015 "backtrace through call with trampolines"
1017 # Make sure we can get back to main.
1018 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1019 # or immediately transfer control back to main if optimizations
1020 # are performed.
1021 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1022 -re "main .* at.*$gdb_prompt $" {
1023 pass "stepping back to main from function called with trampolines"
1025 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1026 send_gdb "step\n"
1027 exp_continue
1029 -re ".*$gdb_prompt $" {
1030 fail "stepping back to main from function called with trampolines"
1032 default {
1033 fail "stepping back to main from function called with trampolines"
1038 set prev_timeout $timeout
1039 if [istarget "mips*tx39-*"] {
1040 set timeout 300
1041 } else {
1042 set timeout 60
1045 # Determine expected output for unsigned long variables,
1046 # the output varies with sizeof (unsigned long).
1048 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1049 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1050 set target_sizeof_long 4
1051 # pass silently
1053 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1054 set target_sizeof_long 8
1055 # pass silently
1059 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1060 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1061 set target_sizeof_int 2
1062 # pass silently
1064 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1065 set target_sizeof_int 4
1066 # pass silently
1068 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1069 set target_sizeof_int 8
1070 # pass silently
1074 switch [get_endianness] {
1075 little { set target_bigendian_p 0 }
1076 big { set target_bigendian_p 1 }
1079 # Perform tests
1081 gdb_test_no_output "set print frame-arguments all"
1083 integral_args
1084 unsigned_integral_args
1085 if {!$skip_float_test} {
1086 float_and_integral_args
1089 # Test _Complex type here if supported.
1090 if [support_complex_tests] {
1091 complex_args
1093 complex_integral_args
1095 if {!$skip_float_test} {
1096 complex_float_integral_args
1100 pointer_args
1101 structs_by_reference
1102 structs_by_value
1103 discard_and_shuffle
1104 shuffle_round_robin
1105 recursive_structs_by_value
1106 localvars_after_alloca
1107 call_after_alloca
1108 localvars_in_indirect_call
1109 stepping_over_trampolines
1111 set timeout $prev_timeout