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