2011-05-30 Yao Qi <yao@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / funcargs.exp
CommitLineData
6aba47ca 1# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
7b6bb8da 2# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
c906108c
SS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c906108c 7# (at your option) any later version.
e22f8b7c 8#
c906108c
SS
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
e22f8b7c 13#
c906108c 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c 16
c906108c
SS
17# This file was written by Fred Fish. (fnf@cygnus.com)
18
19if $tracelevel {
20 strace $tracelevel
21}
22
c906108c
SS
23
24set testfile "funcargs"
25set srcfile ${testfile}.c
26set binfile ${objdir}/${subdir}/${testfile}
e43ec454
YQ
27
28set compile_flags {debug nowarnings quiet}
29if [support_complex_tests] {
30 lappend compile_flags "additional_flags=-DTEST_COMPLEX"
31}
32
33if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } {
b60f0898
JB
34 untested funcargs.exp
35 return -1
c906108c
SS
36}
37
38# Create and source the file that provides information about the compiler
39# used to compile the test case.
40if [get_compiler_info ${binfile}] {
41 return -1;
42}
43
44#
45# Locate actual args; integral types.
46#
47
48proc integral_args {} {
49 global gdb_prompt
50 global det_file
51 global gcc_compiled
52
53 delete_breakpoints
54
55 gdb_breakpoint call0a
56 gdb_breakpoint call0b
57 gdb_breakpoint call0c
58 gdb_breakpoint call0d
59 gdb_breakpoint call0e
60
61 # Run; should stop at call0a and print actual arguments.
c906108c
SS
62 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
63 gdb_run_cmd
64 gdb_expect {
65 -re ".* call0a \\(c=97 'a', s=1, i=2, l=3\\) .*$gdb_prompt $" {
66 pass "run to call0a"
67 }
68 -re "$gdb_prompt $" { fail "run to call0a" ; gdb_suppress_tests }
69 timeout { fail "(timeout) run to call0a" ; gdb_suppress_tests }
70 }
71
72 # Print each arg as a double check to see if we can print
73 # them here as well as with backtrace.
74 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
75 gdb_test "print s" ".* = 1" "print s after run to call0a"
76 gdb_test "print i" ".* = 2" "print i after run to call0a"
77 gdb_test "print l " ".* = 3" "print l after run to call0a"
78
79 # Continue; should stop at call0b and print actual arguments.
80 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
81 gdb_suppress_tests;
82 }
83
84 # Continue; should stop at call0c and print actual arguments.
85 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
86 gdb_suppress_tests;
87 }
88
89 # Continue; should stop at call0d and print actual arguments.
90 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
91 gdb_suppress_tests;
92 }
93
94 # Continue; should stop at call0e and print actual arguments.
95 if [gdb_test "cont" ".* call0e \\(c1=97 'a', l=3, c2=97 'a', i=2, c3=97 'a', s=1, c4=97 'a', c5=97 'a'\\) .*" "continue to call0e" ] {
96 gdb_suppress_tests;
97 }
98 gdb_stop_suppressing_tests;
99}
100
101#
102# Locate actual args; unsigned integral types.
103#
104
105proc unsigned_integral_args {} {
106 global gdb_prompt
107 global det_file
108 global gcc_compiled
109
110 delete_breakpoints
111
112 gdb_breakpoint call1a;
113 gdb_breakpoint call1b;
114 gdb_breakpoint call1c;
115 gdb_breakpoint call1d;
116 gdb_breakpoint call1e;
117
118 # Run; should stop at call1a and print actual arguments.
c906108c
SS
119 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
120 gdb_run_cmd
121 gdb_expect {
122 -re ".* call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*$gdb_prompt $" {
123 pass "run to call1a"
124 }
125 -re "$gdb_prompt $" { fail "run to call1a" ; gdb_suppress_tests; }
126 timeout { fail "(timeout) run to call1a" ; gdb_suppress_tests; }
127 }
128
129 # Print each arg as a double check to see if we can print
130 # them here as well as with backtrace.
131 gdb_test "print uc" ".* = 98 'b'"
132 gdb_test "print us" ".* = 6"
133 gdb_test "print ui" ".* = 7"
134 gdb_test "print ul" ".* = 8"
135
136 # Continue; should stop at call1b and print actual arguments.
137 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
138 gdb_suppress_tests;
139 }
140
141 # Continue; should stop at call1c and print actual arguments.
142 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
143 gdb_suppress_tests;
144 }
145
146 # Continue; should stop at call1d and print actual arguments.
147 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
148 gdb_suppress_tests;
149 }
150
151 # Continue; should stop at call1e and print actual arguments.
152 if [gdb_test "cont" ".* call1e \\(uc1=98 'b', ul=8, uc2=98 'b', ui=7, uc3=98 'b', us=6, uc4=98 'b', uc5=98 'b'\\) .*" "continue to call1e"] {
153 gdb_suppress_tests;
154 }
155 gdb_stop_suppressing_tests;
156}
157
158#
159# Locate actual args; integrals mixed with floating point.
160#
161
162proc float_and_integral_args {} {
163 global gdb_prompt
164 global det_file
165 global gcc_compiled
166
167 delete_breakpoints
168
169 gdb_breakpoint call2a
170 gdb_breakpoint call2b
171 gdb_breakpoint call2c
172 gdb_breakpoint call2d
173 gdb_breakpoint call2e
174 gdb_breakpoint call2f
175 gdb_breakpoint call2g
176 gdb_breakpoint call2h
177
178 # Run; should stop at call2a and print actual arguments.
179
c906108c
SS
180 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
181 gdb_run_cmd
182 gdb_expect {
183 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" }
085dd6e6 184 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" }
c906108c
SS
185 -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; }
186 timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; }
187 }
188
189 # Print each arg as a double check to see if we can print
190 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
191 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
192 gdb_test "print s" ".* = 1" "print s after run to call2a"
193 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
194 gdb_test "print i" ".* = 2" "print i after run to call2a"
195 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
196 gdb_test "print l" ".* = 3" "print l after run to call2a"
197 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
198
199 setup_xfail "rs6000-*-*"
200 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
201 # Continue; should stop at call2b and print actual arguments.
202 if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] {
203 gdb_suppress_tests;
204 }
205
206 # Continue; should stop at call2c and print actual arguments.
207 if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] {
208 gdb_suppress_tests;
209 }
210
211 # Continue; should stop at call2d and print actual arguments.
212 if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] {
213 gdb_suppress_tests;
214 }
215
216 # Continue; should stop at call2e and print actual arguments.
217 if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] {
218 gdb_suppress_tests;
219 }
220
221 # Continue; should stop at call2f and print actual arguments.
222 if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] {
223 gdb_suppress_tests;
224 }
225
226 # Continue; should stop at call2g and print actual arguments.
227 if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] {
228 gdb_suppress_tests;
229 }
230
231 # Continue; should stop at call2h and print actual arguments.
232 if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] {
233 gdb_suppress_tests;
234 }
235
236 # monitor only allows 8 breakpoints; w89k board allows 10, so
237 # break them up into two groups.
238 delete_breakpoints
239 gdb_breakpoint call2i
240
241 # Continue; should stop at call2i and print actual arguments.
242 if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] {
243 gdb_suppress_tests;
244 }
245 gdb_stop_suppressing_tests;
246}
247
e43ec454
YQ
248
249#
250# Locate actual args; _Complex types.
251#
252
253proc complex_args {} {
254 global gdb_prompt
255
256 delete_breakpoints
257
258 gdb_breakpoint callca
259 gdb_breakpoint callcb
260 gdb_breakpoint callcc
261 gdb_breakpoint callcd
262 gdb_breakpoint callce
263 gdb_breakpoint callcf
264
265 # Run; should stop at call1a and print actual arguments.
266 gdb_run_cmd
267 gdb_expect {
268 -re ".* callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\) .*$gdb_prompt $" { pass "run to call2a" }
269 timeout { fail "(timeout) run to callca" ; gdb_suppress_tests; }
270 }
271 gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4 \\* I\\) .*" "continue to callcb"
272 gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\+ 6 \\* I\\) .*" "continue to callcb"
273 gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*" "continue to callcd"
274 gdb_test "cont" ".* callce \\(dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I\\) .*" "continue to callce"
275 gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I\\) .*" "continue to callcf"
276}
277
278
279#
280# Locate actual args; _Complex types and integral.
281#
282proc complex_integral_args {} {
283 global gdb_prompt
284
285 delete_breakpoints
286
287 gdb_breakpoint callc1a
288 gdb_breakpoint callc1b
289
290 # Run; should stop at call1a and print actual arguments.
291 gdb_run_cmd
292 gdb_expect {
293 -re ".* callc1a \\(c=97 'a', s=1, i=2, ui=7, l=3, fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I\\) .*$gdb_prompt $" { pass "run to callc1a" }
294 timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
295 }
296 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"
297}
298
299#
300# Locate actual args; _Complex types and integral/float.
301#
302proc complex_float_integral_args {} {
303 global gdb_prompt
304
305 delete_breakpoints
306
307 gdb_breakpoint callc2a
308 gdb_breakpoint callc2b
309
310 # Run; should stop at call1a and print actual arguments.
311 gdb_run_cmd
312 gdb_expect {
313 -re ".* 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\\) .*$gdb_prompt $" { pass "run to callc2a" }
314 timeout { fail "(timeout) run to callc1a" ; gdb_suppress_tests; }
315 }
316 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"
317}
318
c906108c
SS
319#
320# Locate actual args; dereference pointers to ints and floats.
321#
322
323proc pointer_args {} {
324 global gdb_prompt
325 global hex
326 global det_file
327
328 delete_breakpoints
329
330 gdb_breakpoint call3a
331 gdb_breakpoint call3b
332 gdb_breakpoint call3c
333
334 # Run; should stop at call3a and print actual arguments.
335 # Try dereferencing the arguments.
336
c906108c
SS
337 gdb_run_cmd
338 gdb_expect {
23e37ab1 339 -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_prompt $" { pass "run to call3a" }
c906108c
SS
340 -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; }
341 timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; }
342 }
343
344 gdb_test "print *cp" ".* = 97 'a'"
345 gdb_test "print *sp" ".* = 1"
346 gdb_test "print *ip" ".* = 2"
347 gdb_test "print *lp" ".* = 3"
348
349 # Continue; should stop at call3b and print actual arguments.
350 # Try dereferencing the arguments.
23e37ab1 351 if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=$hex\\) .*" "continue to call3b"] {
c906108c
SS
352 gdb_suppress_tests;
353 }
354
355 gdb_test "print *ucp" ".* = 98 'b'"
356 gdb_test "print *usp" ".* = 6"
357 gdb_test "print *uip" ".* = 7"
358 gdb_test "print *ulp" ".* = 8"
359
360 # Continue; should stop at call3c and print actual arguments.
361 # Try dereferencing the arguments.
362 if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3c"] {
363 gdb_suppress_tests;
364 }
365
366 gdb_test "print *fp" ".* = 4"
367 gdb_test "print *dp" ".* = 5"
368
369# pass "locate actual args, pointer types"
370 gdb_stop_suppressing_tests;
371}
372
373#
374# Locate actual args; structures and unions passed by reference.
375#
376
377proc structs_by_reference {} {
378 global gdb_prompt
379 global hex
380 global det_file
381 global target_sizeof_int
382 global target_sizeof_long
383 global target_bigendian_p
384
385 delete_breakpoints
386
387 gdb_breakpoint call4a
388 gdb_breakpoint call4b
389
390 # Run; should stop at call4a and print actual arguments.
391 # Try dereferencing the arguments.
392
c906108c
SS
393 gdb_run_cmd
394 gdb_expect {
395 -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" {
396 pass "run to call4a"
397 }
398 -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; }
399 timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; }
400 }
401
402 gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}"
403
404 # Continue; should stop at call4b and print actual arguments.
405
406 gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b"
407
408 # Try dereferencing the arguments.
409 if { $target_sizeof_long == $target_sizeof_int } {
410 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
411 "print *unp (sizeof long == sizeof int)"
412 } elseif { ! $target_bigendian_p } {
413 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \
414 "print *unp (little-endian, sizeof long != sizeof int)"
415 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
416 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \
417 "print *unp (big-endian, sizeof long == 8, sizeof int = 4)"
418 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
419 gdb_test "print *unp" ".* = \{u1 = 1, u2 = 65536\}" \
420 "print *unp (big-endian, sizeof long == 4, sizeof int = 2)"
421 } else {
422 fail "print *unp (unknown case)"
423 }
424
425 pass "locate actual args, structs/unions passed by reference"
426 gdb_stop_suppressing_tests;
427}
428
429#
430# Locate actual args; structures and unions passed by value.
431#
432
433proc structs_by_value {} {
434 global gdb_prompt
435 global hex
436 global det_file
437 global target_sizeof_int
438 global target_sizeof_long
439 global target_bigendian_p
440
441 delete_breakpoints
442
443 gdb_breakpoint call5a
444 gdb_breakpoint call5b
445
446 # Run; should stop at call5a and print actual arguments.
447 # Try dereferencing the arguments.
448
c906108c
SS
449 gdb_run_cmd
450 gdb_expect {
451 -re ".* call5a \\(st=\{s1 = 101, s2 = 102\}\\) .*$gdb_prompt $" {
452 pass "run to call5a"
453 }
454 -re "$gdb_prompt $" { fail "run to call5a" ; gdb_suppress_tests; }
455 timeout { fail "(timeout) run to call5a" ; gdb_suppress_tests; }
456 }
457
458 gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}"
459
460 # Continue; should stop at call5b and print actual arguments.
461 if { $target_sizeof_long == $target_sizeof_int } {
462 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
463 "continue to call5b (sizeof long == sizeof int)"
464 } elseif { ! $target_bigendian_p } {
465 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 2\}\\) .*" \
466 "continue to call5b (little-endian, sizeof long != sizeof int)"
467 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
468 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 8589934592\}\\) .*" \
469 "continue to call5b (big-endian, sizeof long == 8, sizeof int = 4)"
470 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
471 gdb_test "cont" ".* call5b \\(un=\{u1 = 2, u2 = 131072\}\\) .*" \
472 "continue to call5b (big-endian, sizeof long == 4, sizeof int = 2)"
473 } else {
474 fail "continue to call5b (unknown case)"
475 }
476
477 # Try dereferencing the arguments.
478 if { $target_sizeof_long == $target_sizeof_int } {
479 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
480 "print un (sizeof long == sizeof int)"
481 } elseif { ! $target_bigendian_p } {
482 gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" \
483 "print un (little-endian, sizeof long != sizeof int)"
484 } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } {
485 gdb_test "print un" ".* = \{u1 = 2, u2 = 8589934592\}" \
486 "print un (big-endian, sizeof long == 8, sizeof int = 4)"
487 } elseif { $target_sizeof_long == 4 && $target_sizeof_int == 2 } {
488 gdb_test "print un" ".* = \{u1 = 2, u2 = 131072\}" \
489 "print un (big-endian, sizeof long == 4, sizeof int = 2)"
490 } else {
491 fail "print un (unknown case)"
492 }
493
494 gdb_stop_suppressing_tests;
495}
496
497#
498# Locate actual args; discard, shuffle, and call
499#
500
501proc discard_and_shuffle {} {
502 global gdb_prompt
503 global hex
504 global decimal
505 global det_file
506 global gcc_compiled
507
508 delete_breakpoints
509
510 gdb_breakpoint call6a
511 gdb_breakpoint call6b
512 gdb_breakpoint call6c
513 gdb_breakpoint call6d
514 gdb_breakpoint call6e
515 gdb_breakpoint call6f
516 gdb_breakpoint call6g
517 gdb_breakpoint call6h
518
519 # Run; should stop at call6a and print actual arguments.
520 # Print backtrace.
521
c906108c
SS
522 gdb_run_cmd
523 gdb_expect {
524 -re ".*Breakpoint $decimal, call6a .*$gdb_prompt $" { pass "run to call6a" }
525 -re "$gdb_prompt $" { fail "run to call6a" ; gdb_suppress_tests; }
526 timeout { fail "(timeout) run to call6a" ; gdb_suppress_tests; }
527 }
528
529 setup_xfail "rs6000-*-*"
530
531 if {!$gcc_compiled} {
532 setup_xfail "mips-sgi-irix5*"
533 }
534
a76e022a
MS
535 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
536 -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 $" {
085dd6e6
JM
537 pass "backtrace from call6a"
538 }
a76e022a 539 -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 $" {
085dd6e6
JM
540 xfail "backtrace from call6a"
541 }
c906108c
SS
542 }
543
544 # Continue; should stop at call6b and print actual arguments.
545 # Print backtrace.
546
547 gdb_continue call6b
548
5fa290c1
DE
549 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
550 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
551 "\[\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\\) "
552 "\[\r\n\]#2 .* main \\(.*\\) at "
11cf8741 553 } ] {
c906108c
SS
554 gdb_suppress_tests;
555 }
556
557 # Continue; should stop at call6c and print actual arguments.
558 # Print backtrace.
559
560 gdb_continue call6c
561
5fa290c1
DE
562 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
563 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
564 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
565 "\[\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\\) "
566 "\[\r\n\]#3 .* main \\(.*\\) at "
11cf8741 567 } ] {
c906108c
SS
568 gdb_suppress_tests;
569 }
570 # Continue; should stop at call6d and print actual arguments.
571 # Print backtrace.
572
573 gdb_continue call6d
574
5fa290c1
DE
575 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
576 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
577 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
578 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
579 "\[\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\\) "
580 "\[\r\n\]#4 .* main \\(.*\\) at "
11cf8741 581 } ] {
c906108c
SS
582 gdb_suppress_tests;
583 }
584
585 # Continue; should stop at call6e and print actual arguments.
586 # Print backtrace.
587
588 gdb_continue call6e
589
5fa290c1
DE
590 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
591 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
592 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
593 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
594 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
595 "\[\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\\) "
596 "\[\r\n\]#5 .* main \\(.*\\) at "
11cf8741 597 } ] {
c906108c
SS
598 gdb_suppress_tests;
599 }
600
601 # Continue; should stop at call6f and print actual arguments.
602 # Print backtrace.
603
604 gdb_continue call6f
605
5fa290c1
DE
606 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
607 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
608 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
609 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
610 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
611 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
612 "\[\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\\) "
613 "\[\r\n\]#6 .* main \\(.*\\) at "
11cf8741 614 } ] {
c906108c
SS
615 gdb_suppress_tests;
616 }
617
618 # Continue; should stop at call6g and print actual arguments.
619 # Print backtrace.
620
621 gdb_continue call6g
622
5fa290c1
DE
623 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
624 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
625 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
626 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
627 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
628 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
629 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
630 "\[\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\\) "
631 "\[\r\n\]#7 .* main \\(.*\\) at "
11cf8741 632 } ] {
c906108c
SS
633 gdb_suppress_tests;
634 }
635
636 # Continue; should stop at call6h and print actual arguments.
637 # Print backtrace.
638
639 gdb_continue call6h
640
5fa290c1
DE
641 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
642 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
643 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
644 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
645 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
646 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
647 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 "\[\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\\) "
650 "\[\r\n\]#8 .* main \\(.*\\) at "
11cf8741 651 } ] {
c906108c
SS
652 gdb_suppress_tests;
653 }
654
655 # monitor only allows 8 breakpoints; w89k board allows 10, so
656 # break them up into two groups.
657 delete_breakpoints
658 gdb_breakpoint call6i
659 gdb_breakpoint call6j
660 gdb_breakpoint call6k
661
662 # Continue; should stop at call6i and print actual arguments.
663 # Print backtrace.
664
665 gdb_continue call6i
666
5fa290c1
DE
667 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
668 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
669 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
670 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
671 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
673 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
674 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
675 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
676 "\[\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\\) "
677 "\[\r\n\]#9 .* main \\(.*\\) at "
11cf8741 678 } ] {
c906108c
SS
679 gdb_suppress_tests;
680 }
681
682 # Continue; should stop at call6j and print actual arguments.
683 # Print backtrace.
684
685 gdb_continue call6j
686
5fa290c1
DE
687 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
688 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
689 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
690 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
691 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
692 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
693 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
694 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
695 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
696 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
697 "\[\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\\) "
698 "\[\r\n\]#10 .* main \\(.*\\) at "
11cf8741 699 } ] {
c906108c
SS
700 gdb_suppress_tests;
701 }
702
703 # Continue; should stop at call6k and print actual arguments.
704 # Print backtrace.
c906108c
SS
705 gdb_continue call6k
706
5fa290c1
DE
707 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
708 "\[\r\n\]#0 .* call6k \\(\\) "
709 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
710 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
711 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
712 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
713 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
714 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
715 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
716 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
717 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
718 "\[\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\\) "
719 "\[\r\n\]#11 .* main \\(.*\\) at "
11cf8741 720 } ] {
c906108c
SS
721 gdb_suppress_tests;
722 }
723 gdb_stop_suppressing_tests;
724}
725
726
727#
728# Locate actual args; shuffle round robin and call
729#
730
731proc shuffle_round_robin {} {
732 global gdb_prompt
733 global hex
734 global decimal
735 global det_file
736 global gcc_compiled
737
738 delete_breakpoints
739
740 gdb_breakpoint call7a
741 gdb_breakpoint call7b
742 gdb_breakpoint call7c
743 gdb_breakpoint call7d
744 gdb_breakpoint call7e
745 gdb_breakpoint call7f
746 gdb_breakpoint call7g
747 gdb_breakpoint call7h
748
749 # Run; should stop at call7a and print actual arguments.
750 # Print backtrace.
751
c906108c
SS
752 gdb_run_cmd
753 gdb_expect {
754 -re ".*Breakpoint $decimal, call7a .*$gdb_prompt $" {
755 pass "run to call7a"
756 }
757 -re "$gdb_prompt $" { fail "run to call7a" ; gdb_suppress_tests; }
758 timeout { fail "(timeout) run to call7a" ; gdb_suppress_tests; }
759 }
760
c906108c 761 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" }
a76e022a
MS
762 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
763 -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 $" {
085dd6e6
JM
764 pass "backtrace from call7a"
765 }
a76e022a 766 -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 $" {
085dd6e6
JM
767 xfail "backtrace from call7a"
768 }
085dd6e6 769 }
c906108c
SS
770
771 # Continue; should stop at call7b and print actual arguments.
772 # Print backtrace.
773
774 gdb_continue call7b
775
776 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
777
5fa290c1
DE
778 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
779 "\[\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'\\) "
780 "\[\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\\) "
781 "\[\r\n\]#2 .* main \\(.*\\) at "
11cf8741 782 }
c906108c
SS
783
784 # Continue; should stop at call7c and print actual arguments.
785 # Print backtrace.
786
787 gdb_continue call7c
788
5fa290c1
DE
789 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
790 "\[\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\\) "
791 "\[\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'\\) "
792 "\[\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\\) "
793 "\[\r\n\]#3 .* main \\(.*\\) at "
11cf8741 794 }
c906108c
SS
795
796 # Continue; should stop at call7d and print actual arguments.
797 # Print backtrace.
798
799 gdb_continue call7d
800
5fa290c1
DE
801 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
802 "\[\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\\) "
803 "\[\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\\) "
804 "\[\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'\\) "
805 "\[\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\\) "
806 "\[\r\n\]#4 .* main \\(.*\\) at "
11cf8741 807 }
c906108c
SS
808
809 gdb_continue call7e
810
5fa290c1
DE
811 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
812 "\[\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\\) "
813 "\[\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\\) "
814 "\[\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\\) "
815 "\[\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'\\) "
816 "\[\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\\) "
817 "\[\r\n\]#5 .* main \\(.*\\) at "
11cf8741 818 }
c906108c
SS
819
820 # Continue; should stop at call7f and print actual arguments.
821 # Print backtrace.
822
823 gdb_continue call7f
824
5fa290c1
DE
825 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
826 "\[\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\\) "
827 "\[\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\\) "
828 "\[\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\\) "
829 "\[\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\\) "
830 "\[\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'\\) "
831 "\[\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\\) "
832 "\[\r\n\]#6 .* main \\(.*\\) at "
11cf8741 833 }
c906108c
SS
834
835 # Continue; should stop at call7g and print actual arguments.
836 # Print backtrace.
837
838 gdb_continue call7g
839
5fa290c1
DE
840 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
841 "\[\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'\\) "
842 "\[\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\\) "
843 "\[\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\\) "
844 "\[\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\\) "
845 "\[\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\\) "
846 "\[\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'\\) "
847 "\[\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\\) "
848 "\[\r\n\]#7 .* main \\(.*\\) at "
11cf8741 849 }
c906108c
SS
850
851 gdb_continue call7h
852
5fa290c1
DE
853 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
854 "\[\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\\) "
855 "\[\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'\\) "
856 "\[\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\\) "
857 "\[\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\\) "
858 "\[\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\\) "
859 "\[\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\\) "
860 "\[\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'\\) "
861 "\[\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\\) "
862 "\[\r\n\]#8 .* main \\(.*\\) at "
11cf8741 863 }
c906108c
SS
864
865 # monitor only allows 8 breakpoints; w89k board allows 10, so
866 # break them up into two groups.
867 delete_breakpoints
868 gdb_breakpoint call7i
869 gdb_breakpoint call7j
870 gdb_breakpoint call7k
871
872 # Continue; should stop at call7i and print actual arguments.
873 # Print backtrace.
874
875 gdb_continue call7i
876
5fa290c1
DE
877 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
878 "\[\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\\) "
879 "\[\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\\) "
880 "\[\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'\\) "
881 "\[\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\\) "
882 "\[\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\\) "
883 "\[\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\\) "
884 "\[\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\\) "
885 "\[\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'\\) "
886 "\[\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\\) "
887 "\[\r\n\]#9 .* main \\(.*\\) at "
11cf8741 888 }
c906108c
SS
889
890 # Continue; should stop at call7j and print actual arguments.
891 # Print backtrace.
892
893 gdb_continue call7j
894
5fa290c1
DE
895 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
896 "\[\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\\) "
897 "\[\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\\) "
898 "\[\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\\) "
899 "\[\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'\\) "
900 "\[\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\\) "
901 "\[\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\\) "
902 "\[\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\\) "
903 "\[\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\\) "
904 "\[\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'\\) "
905 "\[\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\\) "
906 "\[\r\n\]#10 .* main \\(.*\\) at "
11cf8741 907 }
c906108c
SS
908
909 # Continue; should stop at call7k and print actual arguments.
910 # Print backtrace.
911
912 gdb_continue call7k
913
914 if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
5fa290c1
DE
915 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
916 "\[\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\\) "
917 "\[\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\\) "
918 "\[\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\\) "
919 "\[\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\\) "
920 "\[\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'\\) "
921 "\[\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\\) "
922 "\[\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\\) "
923 "\[\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\\) "
924 "\[\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\\) "
925 "\[\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'\\) "
926 "\[\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\\) "
927 "\[\r\n\]#11 .* main \\(.*\\) at "
11cf8741 928 }
c906108c
SS
929 gdb_stop_suppressing_tests;
930}
931
932#
933# Locate actual args; recursive passing of structs by value
934#
935
936proc recursive_structs_by_value {} {
937 global gdb_prompt
938 global hex
939 global decimal
940 global det_file
941
942 delete_breakpoints
943
944 gdb_breakpoint hitbottom
945
946 # Run; should stop at hitbottom and print actual arguments.
947 # Print backtrace.
948 gdb_run_cmd
949 gdb_expect {
950 -re ".*Breakpoint $decimal, hitbottom .*$gdb_prompt $" { pass "run to hitbottom" }
951 -re "$gdb_prompt $" { fail "run to hitbottom" ; gdb_suppress_tests; }
952 timeout { fail "(timeout) run to hitbottom" ; gdb_suppress_tests; }
953 }
954
955 if ![istarget sparclet-*-*] {
5fa290c1
DE
956 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
957 "\[\r\n\]#0 .* hitbottom \\(\\) "
958 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
959 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
960 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
961 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
962 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
963 "\[\r\n\]#6 .* test_struct_args \\(\\) "
964 "\[\r\n\]#7 .* main \\(.*\\) at "
11cf8741 965 }
c906108c
SS
966 } else {
967 fail "recursive passing of structs by value (sparclet)"
968 }
969 gdb_stop_suppressing_tests;
970}
971
972proc funcargs_reload { } {
973 global objdir
974 global subdir
975 global binfile
976 global srcdir
977
978 if [istarget "mips-idt-*"] {
979 # Restart because IDT/SIM runs out of file descriptors.
980 gdb_exit
981 gdb_start
982 gdb_reinitialize_dir $srcdir/$subdir
983 gdb_load ${binfile}
984 }
985}
986
987#
988# Test for accessing local stack variables in functions which call alloca
989#
990proc localvars_after_alloca { } {
991 global gdb_prompt
992 global hex
993 global decimal
994 global gcc_compiled
995
996 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
997
998 # Print each arg as a double check to see if we can print
999 # them here as well as with backtrace.
1000
1001 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1002 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
1003 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1004 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
1005 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
1006 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
1007
1008 # Lame regexp.
1009 gdb_test "next" ".*" "next in localvars_after_alloca()"
1010
1011 # Print each arg as a double check to see if we can print
1012 # them here as well as with backtrace.
1013
1014 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
1015 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
1016 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
1017 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
1018
1019 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
1020 gdb_stop_suppressing_tests;
1021}
1022
1023proc call_after_alloca { } {
1024 global gdb_prompt
1025 global hex
1026 global decimal
1027 global gcc_compiled
1028
1029 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
1030
1031 # Print each arg as a double check to see if we can print
1032 # them here as well as with backtrace.
1033
1034 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1035 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
1036 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1037 gdb_test "print s" " = 1" "print s in call_after_alloca"
1038 gdb_test "print i" " = 2" "print i in call_after_alloca"
1039 gdb_test "print l" " = 3" "print l in call_after_alloca"
1040
1041 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1042 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"
1043 gdb_stop_suppressing_tests;
1044}
1045
1046#
1047# Test for accessing local stack variables, backtraces, finish,
1048# and finally stepping into indirect calls. The point is that on the PA
1049# these use a funky `dyncall' mechanism which GDB needs to know about.
1050#
1051proc localvars_in_indirect_call { } {
1052 global gdb_prompt
1053 global hex
1054 global decimal
1055 global gcc_compiled
1056
1057 # Can not use "runto call0a" as call0a is called several times
1058 # during single run. Instead stop in a marker function and
1059 # take control from there.
1060 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
1061
1062 # break on the next call to call0a, then delete all the breakpoints
1063 # and start testing.
1064 gdb_breakpoint call0a
1065 gdb_continue call0a
1066 delete_breakpoints
1067
1068 # Print each arg as a double check to see if we can print
1069 # them here as well as with backtrace.
1070
1071 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1072 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
1073 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1074 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
1075 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1076 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1077
1078 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1079 gdb_test "backtrace 8" \
1080 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1081 "backtrace in indirectly called function"
1082
1083 #
1084 # "finish" brings us back to main. We then will try to step through
1085 # the second indirect call.
1086 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1087 # of the first indirect call. This is due to stack adjustment instructions
1088 # after the indirect call. In these cases we will step till we hit the
1089 # second indirect call.
1090 #
1091
a76e022a
MS
1092 gdb_test_multiple "finish" "finish from indirectly called function" {
1093 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1094 #On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than
1095 #hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary
1096 #to continue the test.
c906108c
SS
1097 send_gdb "step\n"
1098 exp_continue
1099 }
a76e022a 1100 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
c906108c
SS
1101 pass "finish from indirectly called function"
1102 }
a76e022a 1103 -re ".*$gdb_prompt $" {
c906108c
SS
1104 fail "finish from indirectly called function"
1105 gdb_suppress_tests;
1106 }
a76e022a
MS
1107 default {
1108 fail "finish from indirectly called function"
1109 gdb_suppress_tests;
1110 }
c906108c
SS
1111 }
1112
1113 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1114 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1115 "stepping into indirectly called function"
1116 gdb_stop_suppressing_tests;
1117}
1118
1119#
1120# Test for stepping into indirect calls which may have trampolines (possibly
1121# cascaded) on both the call path and the gdb_suppress_tests; path.
1122# to handle trampolines.
1123#
1124proc test_stepping_over_trampolines { } {
1125 global gdb_prompt
1126 global hex
1127 global decimal
1128
1129 # Stop in a marker function and take control from there.
1130 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1131
1132 # Cater for gdb stopping in midline, see comment for finish above.
a76e022a
MS
1133 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1134 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
c906108c
SS
1135 send_gdb "step\n"
1136 exp_continue
1137 }
a76e022a 1138 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
c906108c
SS
1139 pass "finish from marker_call_with_trampolines"
1140 }
a76e022a 1141 -re ".*$gdb_prompt $" {
c906108c
SS
1142 fail "finish from marker_call_with_trampolines"
1143 }
a76e022a
MS
1144 default {
1145 fail "finish from marker_call_with_trampolines"
1146 gdb_suppress_tests
1147 }
c906108c
SS
1148 }
1149
1150 # Try to step into the target function.
1151 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1152 "stepping into function called with trampolines"
1153
1154 # Make we can backtrace and the argument looks correct. */
1155 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1156 "backtrace through call with trampolines"
1157
1158 # Make sure we can get back to main.
1159 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1160 # or immediately transfer control back to main if optimizations
1161 # are performed.
a76e022a
MS
1162 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1163 -re "main .* at.*$gdb_prompt $" {
1164 pass "stepping back to main from function called with trampolines"
1165 gdb_suppress_tests
c906108c 1166 }
a76e022a 1167 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
c906108c
SS
1168 send_gdb "step\n"
1169 exp_continue
1170 }
a76e022a
MS
1171 -re ".*$gdb_prompt $" {
1172 fail "stepping back to main from function called with trampolines"
1173 }
1174 default {
c906108c 1175 fail "stepping back to main from function called with trampolines"
a76e022a 1176 gdb_suppress_tests
c906108c 1177 }
c906108c
SS
1178 }
1179 gdb_stop_suppressing_tests;
1180}
1181
1182# Start with a fresh gdb.
1183
1184gdb_exit
1185gdb_start
1186gdb_reinitialize_dir $srcdir/$subdir
1187gdb_load ${binfile}
1188
97f2ed50 1189set prev_timeout $timeout
c906108c
SS
1190if [istarget "mips*tx39-*"] {
1191 set timeout 300
c906108c
SS
1192} else {
1193 set timeout 60
1194}
1195
1196# Determine expected output for unsigned long variables,
1197# the output varies with sizeof (unsigned long).
1198
a76e022a
MS
1199gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1200 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1201 set target_sizeof_long 4
1202 # pass silently
1203 }
1204 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1205 set target_sizeof_long 8
1206 # pass silently
c906108c 1207 }
c906108c
SS
1208}
1209
a76e022a
MS
1210gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1211 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1212 set target_sizeof_int 2
1213 # pass silently
1214 }
1215 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1216 set target_sizeof_int 4
1217 # pass silently
1218 }
1219 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1220 set target_sizeof_int 8
1221 # pass silently
c906108c 1222 }
c906108c
SS
1223}
1224
a76e022a
MS
1225gdb_test_multiple "show endian" "getting target endian" {
1226 -re ".*little endian.*$gdb_prompt $" {
1227 set target_bigendian_p 0
1228 # pass silently
1229 }
1230 -re ".*big endian.*$gdb_prompt $" {
1231 set target_bigendian_p 1
1232 # pass silently
c906108c 1233 }
c906108c
SS
1234}
1235
1236# Perform tests
1237
27d3a1a2 1238gdb_test_no_output "set print frame-arguments all"
f8a8dce6 1239
c906108c
SS
1240integral_args
1241funcargs_reload
1242unsigned_integral_args
1243funcargs_reload
9e086581
JM
1244if {![target_info exists gdb,skip_float_tests]} {
1245 float_and_integral_args
1246}
e43ec454
YQ
1247
1248# Test _Complex type here if supported.
1249if [support_complex_tests] {
1250 funcargs_reload
1251 complex_args
1252
1253 funcargs_reload
1254 complex_integral_args
1255
1256 if {![target_info exists gdb,skip_float_tests]} {
1257 funcargs_reload
1258 complex_float_integral_args
1259 }
1260}
1261
c906108c
SS
1262funcargs_reload
1263pointer_args
1264funcargs_reload
1265structs_by_reference
1266funcargs_reload
1267structs_by_value
1268funcargs_reload
1269discard_and_shuffle
1270funcargs_reload
1271shuffle_round_robin
1272funcargs_reload
1273recursive_structs_by_value
1274funcargs_reload
1275localvars_after_alloca
1276funcargs_reload
1277call_after_alloca
1278funcargs_reload
1279localvars_in_indirect_call
1280funcargs_reload
1281test_stepping_over_trampolines
97f2ed50
DJ
1282
1283set timeout $prev_timeout
This page took 1.114498 seconds and 4 git commands to generate.