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