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