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