6a2a03ab8f1d8ec9bc0f9340b123a2212a86a18a
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / funcargs.exp
1 # Copyright 1992-2019 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 set skip_float_test [gdb_skip_float_test]
33
34 if {[prepare_for_testing "failed to prepare" $testfile $srcfile $compile_flags]} {
35 return -1
36 }
37
38 #
39 # Locate actual args; integral types.
40 #
41
42 proc integral_args {} {
43 global gdb_prompt
44 global det_file
45 global gcc_compiled
46
47 delete_breakpoints
48
49 gdb_breakpoint call0a
50 gdb_breakpoint call0b
51 gdb_breakpoint call0c
52 gdb_breakpoint call0d
53 gdb_breakpoint call0e
54
55 # Run; should stop at call0a and print actual arguments.
56 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
57 gdb_run_cmd
58 gdb_test "" " call0a \\(c=97 'a', s=1, i=2, l=3\\) .*" "run to call0a"
59
60 # Print each arg as a double check to see if we can print
61 # them here as well as with backtrace.
62 gdb_test "print c" ".* = 97 'a'" "print c after run to call0a"
63 gdb_test "print s" ".* = 1" "print s after run to call0a"
64 gdb_test "print i" ".* = 2" "print i after run to call0a"
65 gdb_test "print l " ".* = 3" "print l after run to call0a"
66
67 # Continue; should stop at call0b and print actual arguments.
68 if [gdb_test "cont" ".* call0b \\(s=1, i=2, l=3, c=97 'a'\\) .*" "continue to call0b"] {
69 gdb_suppress_tests
70 }
71
72 # Continue; should stop at call0c and print actual arguments.
73 if [gdb_test "cont" ".* call0c \\(i=2, l=3, c=97 'a', s=1\\) .*" "continue to call0c"] {
74 gdb_suppress_tests
75 }
76
77 # Continue; should stop at call0d and print actual arguments.
78 if [gdb_test "cont" ".* call0d \\(l=3, c=97 'a', s=1, i=2\\) .*" "continue to call0d";] {
79 gdb_suppress_tests
80 }
81
82 # Continue; should stop at call0e and print actual arguments.
83 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" ] {
84 gdb_suppress_tests
85 }
86 gdb_stop_suppressing_tests
87 }
88
89 #
90 # Locate actual args; unsigned integral types.
91 #
92
93 proc unsigned_integral_args {} {
94 global gdb_prompt
95 global det_file
96 global gcc_compiled
97
98 delete_breakpoints
99
100 gdb_breakpoint call1a
101 gdb_breakpoint call1b
102 gdb_breakpoint call1c
103 gdb_breakpoint call1d
104 gdb_breakpoint call1e
105
106 # Run; should stop at call1a and print actual arguments.
107 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
108 gdb_run_cmd
109 gdb_test "" " call1a \\(uc=98 'b', us=6, ui=7, ul=8\\) .*" "run to call1a"
110
111 # Print each arg as a double check to see if we can print
112 # them here as well as with backtrace.
113 gdb_test "print uc" ".* = 98 'b'"
114 gdb_test "print us" ".* = 6"
115 gdb_test "print ui" ".* = 7"
116 gdb_test "print ul" ".* = 8"
117
118 # Continue; should stop at call1b and print actual arguments.
119 if [gdb_test "cont" ".* call1b \\(us=6, ui=7, ul=8, uc=98 'b'\\) .*" "continue to call1b"] {
120 gdb_suppress_tests
121 }
122
123 # Continue; should stop at call1c and print actual arguments.
124 if [gdb_test "cont" ".* call1c \\(ui=7, ul=8, uc=98 'b', us=6\\) .*" "continue to call1c"] {
125 gdb_suppress_tests
126 }
127
128 # Continue; should stop at call1d and print actual arguments.
129 if [gdb_test "cont" ".* call1d \\(ul=8, uc=98 'b', us=6, ui=7\\) .*" "continue to call1d"] {
130 gdb_suppress_tests
131 }
132
133 # Continue; should stop at call1e and print actual arguments.
134 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"] {
135 gdb_suppress_tests
136 }
137 gdb_stop_suppressing_tests
138 }
139
140 #
141 # Locate actual args; integrals mixed with floating point.
142 #
143
144 proc float_and_integral_args {} {
145 global gdb_prompt
146 global det_file
147 global gcc_compiled
148
149 delete_breakpoints
150
151 gdb_breakpoint call2a
152 gdb_breakpoint call2b
153 gdb_breakpoint call2c
154 gdb_breakpoint call2d
155 gdb_breakpoint call2e
156 gdb_breakpoint call2f
157 gdb_breakpoint call2g
158 gdb_breakpoint call2h
159
160 # Run; should stop at call2a and print actual arguments.
161
162 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
163 gdb_run_cmd
164 set test "run to call2a"
165 gdb_test_multiple "" $test {
166 -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
167 pass $test
168 }
169 -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" {
170 xfail $test
171 }
172 }
173
174 # Print each arg as a double check to see if we can print
175 gdb_test "print c" ".* = 97 'a'" "print c after run to call2a"
176 gdb_test "print f1" ".* = 4" "print f1 after run to call2a"
177 gdb_test "print s" ".* = 1" "print s after run to call2a"
178 gdb_test "print d1" ".* = 5" "print d1 after run to call2a"
179 gdb_test "print i" ".* = 2" "print i after run to call2a"
180 gdb_test "print f2" ".* = 4" "print f2 after run to call2a"
181 gdb_test "print l" ".* = 3" "print l after run to call2a"
182 gdb_test "print d2" ".* = 5" "print d2 after run to call2a"
183
184 setup_xfail "rs6000-*-*"
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 gdb_test_multiple "backtrace 100" "backtrace from call6a" {
490 -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 $" {
491 pass "backtrace from call6a"
492 }
493 -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 $" {
494 xfail "backtrace from call6a"
495 }
496 }
497
498 # Continue; should stop at call6b and print actual arguments.
499 # Print backtrace.
500
501 gdb_continue call6b
502
503 if [gdb_test_sequence "backtrace 100" "backtrace from call6b" {
504 "\[\r\n\]#0 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
505 "\[\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\\) "
506 "\[\r\n\]#2 .* main \\(.*\\) at "
507 } ] {
508 gdb_suppress_tests
509 }
510
511 # Continue; should stop at call6c and print actual arguments.
512 # Print backtrace.
513
514 gdb_continue call6c
515
516 if [gdb_test_sequence "backtrace 100" "backtrace from call6c" {
517 "\[\r\n\]#0 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
518 "\[\r\n\]#1 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
519 "\[\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\\) "
520 "\[\r\n\]#3 .* main \\(.*\\) at "
521 } ] {
522 gdb_suppress_tests
523 }
524 # Continue; should stop at call6d and print actual arguments.
525 # Print backtrace.
526
527 gdb_continue call6d
528
529 if [gdb_test_sequence "backtrace 100" "backtrace from call6d" {
530 "\[\r\n\]#0 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
531 "\[\r\n\]#1 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
532 "\[\r\n\]#2 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
533 "\[\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\\) "
534 "\[\r\n\]#4 .* main \\(.*\\) at "
535 } ] {
536 gdb_suppress_tests
537 }
538
539 # Continue; should stop at call6e and print actual arguments.
540 # Print backtrace.
541
542 gdb_continue call6e
543
544 if [gdb_test_sequence "backtrace 100" "backtrace from call6e" {
545 "\[\r\n\]#0 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
546 "\[\r\n\]#1 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
547 "\[\r\n\]#2 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
548 "\[\r\n\]#3 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
549 "\[\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\\) "
550 "\[\r\n\]#5 .* main \\(.*\\) at "
551 } ] {
552 gdb_suppress_tests
553 }
554
555 # Continue; should stop at call6f and print actual arguments.
556 # Print backtrace.
557
558 gdb_continue call6f
559
560 if [gdb_test_sequence "backtrace 100" "backtrace from call6f" {
561 "\[\r\n\]#0 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
562 "\[\r\n\]#1 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
563 "\[\r\n\]#2 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
564 "\[\r\n\]#3 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
565 "\[\r\n\]#4 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
566 "\[\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\\) "
567 "\[\r\n\]#6 .* main \\(.*\\) at "
568 } ] {
569 gdb_suppress_tests
570 }
571
572 # Continue; should stop at call6g and print actual arguments.
573 # Print backtrace.
574
575 gdb_continue call6g
576
577 if [gdb_test_sequence "backtrace 100" "backtrace from call6g" {
578 "\[\r\n\]#0 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
579 "\[\r\n\]#1 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
580 "\[\r\n\]#2 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
581 "\[\r\n\]#3 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
582 "\[\r\n\]#4 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
583 "\[\r\n\]#5 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
584 "\[\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\\) "
585 "\[\r\n\]#7 .* main \\(.*\\) at "
586 } ] {
587 gdb_suppress_tests
588 }
589
590 # Continue; should stop at call6h and print actual arguments.
591 # Print backtrace.
592
593 gdb_continue call6h
594
595 if [gdb_test_sequence "backtrace 100" "backtrace from call6h" {
596 "\[\r\n\]#0 .* call6h \\(us=6, ui=7, ul=8\\) "
597 "\[\r\n\]#1 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
598 "\[\r\n\]#2 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
599 "\[\r\n\]#3 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
600 "\[\r\n\]#4 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
601 "\[\r\n\]#5 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
602 "\[\r\n\]#6 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
603 "\[\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\\) "
604 "\[\r\n\]#8 .* main \\(.*\\) at "
605 } ] {
606 gdb_suppress_tests
607 }
608
609 # monitor only allows 8 breakpoints; w89k board allows 10, so
610 # break them up into two groups.
611 delete_breakpoints
612 gdb_breakpoint call6i
613 gdb_breakpoint call6j
614 gdb_breakpoint call6k
615
616 # Continue; should stop at call6i and print actual arguments.
617 # Print backtrace.
618
619 gdb_continue call6i
620
621 if [gdb_test_sequence "backtrace 100" "backtrace from call6i" {
622 "\[\r\n\]#0 .* call6i \\(ui=7, ul=8\\) "
623 "\[\r\n\]#1 .* call6h \\(us=6, ui=7, ul=8\\) "
624 "\[\r\n\]#2 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
625 "\[\r\n\]#3 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
626 "\[\r\n\]#4 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
627 "\[\r\n\]#5 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
628 "\[\r\n\]#6 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
629 "\[\r\n\]#7 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
630 "\[\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\\) "
631 "\[\r\n\]#9 .* main \\(.*\\) at "
632 } ] {
633 gdb_suppress_tests
634 }
635
636 # Continue; should stop at call6j and print actual arguments.
637 # Print backtrace.
638
639 gdb_continue call6j
640
641 if [gdb_test_sequence "backtrace 100" "backtrace from call6j" {
642 "\[\r\n\]#0 .* call6j \\(ul=8\\) "
643 "\[\r\n\]#1 .* call6i \\(ui=7, ul=8\\) "
644 "\[\r\n\]#2 .* call6h \\(us=6, ui=7, ul=8\\) "
645 "\[\r\n\]#3 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
646 "\[\r\n\]#4 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
647 "\[\r\n\]#5 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
648 "\[\r\n\]#6 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
649 "\[\r\n\]#7 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
650 "\[\r\n\]#8 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
651 "\[\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\\) "
652 "\[\r\n\]#10 .* main \\(.*\\) at "
653 } ] {
654 gdb_suppress_tests
655 }
656
657 # Continue; should stop at call6k and print actual arguments.
658 # Print backtrace.
659 gdb_continue call6k
660
661 if [gdb_test_sequence "backtrace 100" "backtrace from call6k" {
662 "\[\r\n\]#0 .* call6k \\(\\) "
663 "\[\r\n\]#1 .* call6j \\(ul=8\\) "
664 "\[\r\n\]#2 .* call6i \\(ui=7, ul=8\\) "
665 "\[\r\n\]#3 .* call6h \\(us=6, ui=7, ul=8\\) "
666 "\[\r\n\]#4 .* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) "
667 "\[\r\n\]#5 .* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
668 "\[\r\n\]#6 .* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
669 "\[\r\n\]#7 .* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
670 "\[\r\n\]#8 .* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
671 "\[\r\n\]#9 .* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) "
672 "\[\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\\) "
673 "\[\r\n\]#11 .* main \\(.*\\) at "
674 } ] {
675 gdb_suppress_tests
676 }
677 gdb_stop_suppressing_tests
678 }
679
680
681 #
682 # Locate actual args; shuffle round robin and call
683 #
684
685 proc shuffle_round_robin {} {
686 global gdb_prompt
687 global hex
688 global decimal
689 global det_file
690 global gcc_compiled
691
692 delete_breakpoints
693
694 gdb_breakpoint call7a
695 gdb_breakpoint call7b
696 gdb_breakpoint call7c
697 gdb_breakpoint call7d
698 gdb_breakpoint call7e
699 gdb_breakpoint call7f
700 gdb_breakpoint call7g
701 gdb_breakpoint call7h
702
703 # Run; should stop at call7a and print actual arguments.
704 # Print backtrace.
705
706 gdb_run_cmd
707 gdb_test "" "Breakpoint $decimal, call7a .*" "run to call7a"
708
709 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
710 gdb_test_multiple "backtrace 100" "backtrace from call7a" {
711 -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 $" {
712 pass "backtrace from call7a"
713 }
714 -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 $" {
715 xfail "backtrace from call7a"
716 }
717 }
718
719 # Continue; should stop at call7b and print actual arguments.
720 # Print backtrace.
721
722 gdb_continue call7b
723
724 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
725
726 gdb_test_sequence "backtrace 100" "backtrace from call7b" {
727 "\[\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'\\) "
728 "\[\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\\) "
729 "\[\r\n\]#2 .* main \\(.*\\) at "
730 }
731
732 # Continue; should stop at call7c and print actual arguments.
733 # Print backtrace.
734
735 gdb_continue call7c
736
737 gdb_test_sequence "backtrace 100" "backtrace from call7c" {
738 "\[\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\\) "
739 "\[\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'\\) "
740 "\[\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\\) "
741 "\[\r\n\]#3 .* main \\(.*\\) at "
742 }
743
744 # Continue; should stop at call7d and print actual arguments.
745 # Print backtrace.
746
747 gdb_continue call7d
748
749 gdb_test_sequence "backtrace 100" "backtrace from call7d" {
750 "\[\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\\) "
751 "\[\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\\) "
752 "\[\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'\\) "
753 "\[\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\\) "
754 "\[\r\n\]#4 .* main \\(.*\\) at "
755 }
756
757 gdb_continue call7e
758
759 gdb_test_sequence "backtrace 100" "backtrace from call7e" {
760 "\[\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\\) "
761 "\[\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\\) "
762 "\[\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\\) "
763 "\[\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'\\) "
764 "\[\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\\) "
765 "\[\r\n\]#5 .* main \\(.*\\) at "
766 }
767
768 # Continue; should stop at call7f and print actual arguments.
769 # Print backtrace.
770
771 gdb_continue call7f
772
773 gdb_test_sequence "backtrace 100" "backtrace from call7f" {
774 "\[\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\\) "
775 "\[\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\\) "
776 "\[\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\\) "
777 "\[\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\\) "
778 "\[\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'\\) "
779 "\[\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\\) "
780 "\[\r\n\]#6 .* main \\(.*\\) at "
781 }
782
783 # Continue; should stop at call7g and print actual arguments.
784 # Print backtrace.
785
786 gdb_continue call7g
787
788 gdb_test_sequence "backtrace 100" "backtrace from call7g" {
789 "\[\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'\\) "
790 "\[\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\\) "
791 "\[\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\\) "
792 "\[\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\\) "
793 "\[\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\\) "
794 "\[\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'\\) "
795 "\[\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\\) "
796 "\[\r\n\]#7 .* main \\(.*\\) at "
797 }
798
799 gdb_continue call7h
800
801 gdb_test_sequence "backtrace 100" "backtrace from call7h" {
802 "\[\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\\) "
803 "\[\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'\\) "
804 "\[\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\\) "
805 "\[\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\\) "
806 "\[\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\\) "
807 "\[\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\\) "
808 "\[\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'\\) "
809 "\[\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\\) "
810 "\[\r\n\]#8 .* main \\(.*\\) at "
811 }
812
813 # monitor only allows 8 breakpoints; w89k board allows 10, so
814 # break them up into two groups.
815 delete_breakpoints
816 gdb_breakpoint call7i
817 gdb_breakpoint call7j
818 gdb_breakpoint call7k
819
820 # Continue; should stop at call7i and print actual arguments.
821 # Print backtrace.
822
823 gdb_continue call7i
824
825 gdb_test_sequence "backtrace 100" "backtrace from call7i" {
826 "\[\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\\) "
827 "\[\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\\) "
828 "\[\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'\\) "
829 "\[\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\\) "
830 "\[\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\\) "
831 "\[\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\\) "
832 "\[\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\\) "
833 "\[\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'\\) "
834 "\[\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\\) "
835 "\[\r\n\]#9 .* main \\(.*\\) at "
836 }
837
838 # Continue; should stop at call7j and print actual arguments.
839 # Print backtrace.
840
841 gdb_continue call7j
842
843 gdb_test_sequence "backtrace 100" "backtrace from call7j" {
844 "\[\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\\) "
845 "\[\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\\) "
846 "\[\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\\) "
847 "\[\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'\\) "
848 "\[\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\\) "
849 "\[\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\\) "
850 "\[\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\\) "
851 "\[\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\\) "
852 "\[\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'\\) "
853 "\[\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\\) "
854 "\[\r\n\]#10 .* main \\(.*\\) at "
855 }
856
857 # Continue; should stop at call7k and print actual arguments.
858 # Print backtrace.
859
860 gdb_continue call7k
861
862 gdb_test_sequence "backtrace 100" "backtrace from call7k" {
863 "\[\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\\) "
864 "\[\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\\) "
865 "\[\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\\) "
866 "\[\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\\) "
867 "\[\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'\\) "
868 "\[\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\\) "
869 "\[\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\\) "
870 "\[\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\\) "
871 "\[\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\\) "
872 "\[\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'\\) "
873 "\[\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\\) "
874 "\[\r\n\]#11 .* main \\(.*\\) at "
875 }
876 gdb_stop_suppressing_tests
877 }
878
879 #
880 # Locate actual args; recursive passing of structs by value
881 #
882
883 proc recursive_structs_by_value {} {
884 global gdb_prompt
885 global hex
886 global decimal
887 global det_file
888
889 delete_breakpoints
890
891 gdb_breakpoint hitbottom
892
893 # Run; should stop at hitbottom and print actual arguments.
894 # Print backtrace.
895 gdb_run_cmd
896 gdb_test "" "Breakpoint $decimal, hitbottom .*" "run to hitbottom"
897
898 gdb_test_sequence "backtrace 100" "recursive passing of structs by value" {
899 "\[\r\n\]#0 .* hitbottom \\(\\) "
900 "\[\r\n\]#1 .* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) "
901 "\[\r\n\]#2 .* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) "
902 "\[\r\n\]#3 .* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) "
903 "\[\r\n\]#4 .* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) "
904 "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) "
905 "\[\r\n\]#6 .* test_struct_args \\(\\) "
906 "\[\r\n\]#7 .* main \\(.*\\) at "
907 }
908 gdb_stop_suppressing_tests
909 }
910
911 #
912 # Test for accessing local stack variables in functions which call alloca
913 #
914 proc localvars_after_alloca { } {
915 global gdb_prompt
916 global hex
917 global decimal
918 global gcc_compiled
919
920 if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; }
921
922 # Print each arg as a double check to see if we can print
923 # them here as well as with backtrace.
924
925 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
926 gdb_test "print c" " = 97 'a'" "print c after runto localvars_after_alloca"
927 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
928 gdb_test "print s" " = 1" "print s after runto localvars_after_alloca"
929 gdb_test "print i" " = 2" "print i after runto localvars_after_alloca"
930 gdb_test "print l" " = 3" "print l after runto localvars_after_alloca"
931
932 # Lame regexp.
933 gdb_test "next" ".*" "next in localvars_after_alloca()"
934
935 # Print each arg as a double check to see if we can print
936 # them here as well as with backtrace.
937
938 gdb_test "print c" " = 97 'a'" "print c in localvars_after_alloca"
939 gdb_test "print s" " = 1" "print s in localvars_after_alloca"
940 gdb_test "print i" " = 2" "print i in localvars_after_alloca"
941 gdb_test "print l" " = 3" "print l in localvars_after_alloca"
942
943 gdb_test "backtrace 8" "#0.*localvars_after_alloca \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" "backtrace after alloca"
944 gdb_stop_suppressing_tests
945 }
946
947 proc call_after_alloca { } {
948 global gdb_prompt
949 global hex
950 global decimal
951 global gcc_compiled
952
953 if { ! [ runto call_after_alloca_subr ] } then { gdb_suppress_tests; }
954
955 # Print each arg as a double check to see if we can print
956 # them here as well as with backtrace.
957
958 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
959 gdb_test "print c" " = 97 'a'" "print c in call_after_alloca"
960 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
961 gdb_test "print s" " = 1" "print s in call_after_alloca"
962 gdb_test "print i" " = 2" "print i in call_after_alloca"
963 gdb_test "print l" " = 3" "print l in call_after_alloca"
964
965 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
966 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"
967 gdb_stop_suppressing_tests
968 }
969
970 #
971 # Test for accessing local stack variables, backtraces, finish,
972 # and finally stepping into indirect calls. The point is that on the PA
973 # these use a funky `dyncall' mechanism which GDB needs to know about.
974 #
975 proc localvars_in_indirect_call { } {
976 global gdb_prompt
977 global hex
978 global decimal
979 global gcc_compiled
980
981 # Can not use "runto call0a" as call0a is called several times
982 # during single run. Instead stop in a marker function and
983 # take control from there.
984 if { ! [ runto marker_indirect_call ] } then { gdb_suppress_tests; }
985
986 # break on the next call to call0a, then delete all the breakpoints
987 # and start testing.
988 gdb_breakpoint call0a
989 gdb_continue call0a
990 delete_breakpoints
991
992 # Print each arg as a double check to see if we can print
993 # them here as well as with backtrace.
994
995 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
996 gdb_test "print c" " = 97 'a'" "print c in localvars_in_indirect_call"
997 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
998 gdb_test "print s" " = 1" "print s in localvars_in_indirect_call"
999 gdb_test "print i" " = 2" "print i in localvars_in_indirect_call"
1000 gdb_test "print l" " = 3" "print l in localvars_in_indirect_call"
1001
1002 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1003 gdb_test "backtrace 8" \
1004 "#0.*call0a \\(c=97 'a', s=1, i=2, l=3\\).*#1.*main.*" \
1005 "backtrace in indirectly called function"
1006
1007 #
1008 # "finish" brings us back to main. We then will try to step through
1009 # the second indirect call.
1010 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1011 # of the first indirect call. This is due to stack adjustment instructions
1012 # after the indirect call. In these cases we will step till we hit the
1013 # second indirect call.
1014 #
1015
1016 gdb_test_multiple "finish" "finish from indirectly called function" {
1017 -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" {
1018 # If the branch instruction is not the last instruction in the
1019 # function call line, we'll stop at that line, and need an extra
1020 # "step" to continue the test.
1021 send_gdb "step\n"
1022 exp_continue
1023 }
1024 -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" {
1025 pass "finish from indirectly called function"
1026 }
1027 -re ".*$gdb_prompt $" {
1028 fail "finish from indirectly called function"
1029 gdb_suppress_tests
1030 }
1031 default {
1032 fail "finish from indirectly called function"
1033 gdb_suppress_tests
1034 }
1035 }
1036
1037 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" }
1038 gdb_test "step" "call0a \\(c=97 'a', s=1, i=2, l=3\\).*" \
1039 "stepping into indirectly called function"
1040 gdb_stop_suppressing_tests
1041 }
1042
1043 #
1044 # Test for stepping into indirect calls which may have trampolines (possibly
1045 # cascaded) on both the call path and the gdb_suppress_tests; path.
1046 # to handle trampolines.
1047 #
1048 proc test_stepping_over_trampolines { } {
1049 global gdb_prompt
1050 global hex
1051 global decimal
1052
1053 # Stop in a marker function and take control from there.
1054 if { ! [ runto marker_call_with_trampolines ] } then { gdb_suppress_tests; }
1055
1056 # Cater for gdb stopping in midline, see comment for finish above.
1057 gdb_test_multiple "finish" "finish from marker_call_with_trampolines" {
1058 -re "marker_call_with_trampolines ..;.*$gdb_prompt $" {
1059 send_gdb "step\n"
1060 exp_continue
1061 }
1062 -re "pointer_to_call_with_trampolines.*$gdb_prompt $" {
1063 pass "finish from marker_call_with_trampolines"
1064 }
1065 -re ".*$gdb_prompt $" {
1066 fail "finish from marker_call_with_trampolines"
1067 }
1068 default {
1069 fail "finish from marker_call_with_trampolines"
1070 gdb_suppress_tests
1071 }
1072 }
1073
1074 # Try to step into the target function.
1075 gdb_test "step" "call_with_trampolines \\(d1=5\\).*" \
1076 "stepping into function called with trampolines"
1077
1078 # Make we can backtrace and the argument looks correct. */
1079 gdb_test "backtrace 8" "#0.*call_with_trampolines \\(d1=5\\).*1.*main.*" \
1080 "backtrace through call with trampolines"
1081
1082 # Make sure we can get back to main.
1083 # Stepping back to main might stop again after the gdb_suppress_tests; statement
1084 # or immediately transfer control back to main if optimizations
1085 # are performed.
1086 gdb_test_multiple "step" "stepping back to main from function called with trampolines" {
1087 -re "main .* at.*$gdb_prompt $" {
1088 pass "stepping back to main from function called with trampolines"
1089 gdb_suppress_tests
1090 }
1091 -re "\}.*End of call_with_trampolines.*$gdb_prompt $" {
1092 send_gdb "step\n"
1093 exp_continue
1094 }
1095 -re ".*$gdb_prompt $" {
1096 fail "stepping back to main from function called with trampolines"
1097 }
1098 default {
1099 fail "stepping back to main from function called with trampolines"
1100 gdb_suppress_tests
1101 }
1102 }
1103 gdb_stop_suppressing_tests
1104 }
1105
1106 set prev_timeout $timeout
1107 if [istarget "mips*tx39-*"] {
1108 set timeout 300
1109 } else {
1110 set timeout 60
1111 }
1112
1113 # Determine expected output for unsigned long variables,
1114 # the output varies with sizeof (unsigned long).
1115
1116 gdb_test_multiple "print sizeof (long)" "getting sizeof long" {
1117 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1118 set target_sizeof_long 4
1119 # pass silently
1120 }
1121 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1122 set target_sizeof_long 8
1123 # pass silently
1124 }
1125 }
1126
1127 gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
1128 -re ".\[0-9\]* = 2.*$gdb_prompt $" {
1129 set target_sizeof_int 2
1130 # pass silently
1131 }
1132 -re ".\[0-9\]* = 4.*$gdb_prompt $" {
1133 set target_sizeof_int 4
1134 # pass silently
1135 }
1136 -re ".\[0-9\]* = 8.*$gdb_prompt $" {
1137 set target_sizeof_int 8
1138 # pass silently
1139 }
1140 }
1141
1142 switch [get_endianness] {
1143 little { set target_bigendian_p 0 }
1144 big { set target_bigendian_p 1 }
1145 }
1146
1147 # Perform tests
1148
1149 gdb_test_no_output "set print frame-arguments all"
1150
1151 integral_args
1152 unsigned_integral_args
1153 if {!$skip_float_test} {
1154 float_and_integral_args
1155 }
1156
1157 # Test _Complex type here if supported.
1158 if [support_complex_tests] {
1159 complex_args
1160
1161 complex_integral_args
1162
1163 if {!$skip_float_test} {
1164 complex_float_integral_args
1165 }
1166 }
1167
1168 pointer_args
1169 structs_by_reference
1170 structs_by_value
1171 discard_and_shuffle
1172 shuffle_round_robin
1173 recursive_structs_by_value
1174 localvars_after_alloca
1175 call_after_alloca
1176 localvars_in_indirect_call
1177 test_stepping_over_trampolines
1178
1179 set timeout $prev_timeout
This page took 0.052861 seconds and 3 git commands to generate.