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