1 # Copyright (C) 1992, 1994 Free Software Foundation, Inc.
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.
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
20 # This file was written by Fred Fish. (fnf@cygnus.com)
29 set binfile "funcargs"
30 set srcfile $binfile.c
32 if ![file exists $objdir/$subdir/$binfile] then {
33 perror "$objdir/$subdir/$binfile does not exist."
38 # Locate actual args; integral types.
41 proc integral_args {} {
47 send "break call0a\n" ; expect -re ".*$prompt $"
48 send "break call0b\n" ; expect -re ".*$prompt $"
49 send "break call0c\n" ; expect -re ".*$prompt $"
50 send "break call0d\n" ; expect -re ".*$prompt $"
51 send "break call0e\n" ; expect -re ".*$prompt $"
53 # Run; should stop at call0a and print actual arguments.
54 # The a29k fails all of these tests, perhaps because the prologue
56 setup_xfail "a29k-*-udi"
59 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
63 -re ".* call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+ .*$prompt $" {}
64 -re "$prompt $" { fail "run to call0a" ; return }
65 timeout { fail "(timeout) run to call0a" ; return }
68 # Print each arg as a double check to see if we can print
69 # them here as well as with backtrace.
70 if [gdb_test "print c" ".* = 97 'a'" ""] {
71 fail "print c"; return
73 if [gdb_test "print s" ".* = 1" ""] {
74 fail "print s"; return
76 if [gdb_test "print i" ".* = 2" ""] {
77 fail "print i"; return
79 if [gdb_test "print l" ".* = 3" ""] {
80 fail "print l"; return
83 # Continue; should stop at call0b and print actual arguments.
84 if [gdb_test "cont" ".* call0b \[(\]+s=1, i=2, l=3, c=97 'a'\[)\]+ " ""] {
85 fail "continue to call0b"; return
88 # Continue; should stop at call0c and print actual arguments.
89 if [gdb_test "cont" ".* call0c \[(\]+i=2, l=3, c=97 'a', s=1\[)\]+ " ""] {
90 fail "continue to call0c"; return
93 # Continue; should stop at call0d and print actual arguments.
94 if [gdb_test "cont" ".* call0d \[(\]+l=3, c=97 'a', s=1, i=2\[)\]+ " ""] {
95 fail "continue to call0d"; return
98 # Continue; should stop at call0e and print actual arguments.
99 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'\[)\]+ " "" ] {
100 fail "continue to call0e"; return
103 pass "locate actual args, signed integral types"
107 # Locate actual args; unsigned integral types.
110 proc unsigned_integral_args {} {
116 send "break call1a\n" ; expect -re ".*$prompt $"
117 send "break call1b\n" ; expect -re ".*$prompt $"
118 send "break call1c\n" ; expect -re ".*$prompt $"
119 send "break call1d\n" ; expect -re ".*$prompt $"
120 send "break call1e\n" ; expect -re ".*$prompt $"
122 # Run; should stop at call1a and print actual arguments.
123 # The a29k fails all of these tests, perhaps because the prologue
125 setup_xfail "a29k-*-udi"
128 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
132 -re ".* call1a \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*$prompt $" {}
133 -re "$prompt $" { fail "run to call1a" ; return }
134 timeout { fail "(timeout) run to call1a" ; return }
137 # Print each arg as a double check to see if we can print
138 # them here as well as with backtrace.
139 if [gdb_test "print uc" ".* = 98 'b'" ""] {
140 fail "print uc"; return
142 if [gdb_test "print us" ".* = 6" ""] {
143 fail "print us"; return
145 if [gdb_test "print ui" ".* = 7" ""] {
146 fail "print ui"; return
148 if [gdb_test "print ul" ".* = 8" ""] {
149 fail "print ul"; return
152 # Continue; should stop at call1b and print actual arguments.
153 if [gdb_test "cont" ".* call1b \[(\]+us=6, ui=7, ul=8, uc=98 'b'\[)\]+ " ""] {
154 fail "continue to call1b"; return
157 # Continue; should stop at call1c and print actual arguments.
158 if [gdb_test "cont" ".* call1c \[(\]+ui=7, ul=8, uc=98 'b', us=6\[)\]+ " ""] {
159 fail "continue to call1c"; return
162 # Continue; should stop at call1d and print actual arguments.
163 if [gdb_test "cont" ".* call1d \[(\]+ul=8, uc=98 'b', us=6, ui=7\[)\]+ " ""] {
164 fail "continue to call1d"; return
167 # Continue; should stop at call1e and print actual arguments.
168 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'\[)\]+ " ""] {
169 fail "continue to call1e"; return
172 pass "locate actual args, unsigned integral types"
176 # Locate actual args; integrals mixed with floating point.
179 proc float_and_integral_args {} {
185 send "break call2a\n" ; expect -re ".*$prompt $"
186 send "break call2b\n" ; expect -re ".*$prompt $"
187 send "break call2c\n" ; expect -re ".*$prompt $"
188 send "break call2d\n" ; expect -re ".*$prompt $"
189 send "break call2e\n" ; expect -re ".*$prompt $"
190 send "break call2f\n" ; expect -re ".*$prompt $"
191 send "break call2g\n" ; expect -re ".*$prompt $"
192 send "break call2h\n" ; expect -re ".*$prompt $"
193 send "break call2i\n" ; expect -re ".*$prompt $"
195 # Run; should stop at call2a and print actual arguments.
197 setup_xfail "i960-*-*" 1813
198 # The a29k fails all of these tests, perhaps because the prologue
200 setup_xfail "a29k-*-udi"
203 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
207 -re ".* call2a \[(\]+c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\[)\]+ .*$prompt $" {}
208 -re "$prompt $" { fail "run to call2a" ; return }
209 timeout { fail "(timeout) run to call2a" ; return }
212 # Print each arg as a double check to see if we can print
214 if [gdb_test "print c" ".* = 97 'a'" ""] {
215 fail "print c"; return
217 if [gdb_test "print f1" ".* = 4" ""] {
218 fail "print f1"; return
220 if [gdb_test "print s" ".* = 1" ""] {
221 fail "print s"; return
223 if [gdb_test "print d1" ".* = 5" ""] {
224 fail "print d1"; return
226 if [gdb_test "print i" ".* = 2" ""] {
227 fail "print i"; return
229 if [gdb_test "print f2" ".* = 4" ""] {
230 fail "print f2"; return
232 if [gdb_test "print l" ".* = 3" ""] {
233 fail "print l"; return
235 if [gdb_test "print d2" ".* = 5" ""] {
236 fail "print d2"; return
239 # Continue; should stop at call2b and print actual arguments.
240 if [gdb_test "cont" ".* call2b \[(\]+f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\[)\]+ " ""] {
241 fail "continue to call2b"; return
244 # Continue; should stop at call2c and print actual arguments.
245 if [gdb_test "cont" ".* call2c \[(\]+s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\[)\]+ " ""] {
246 fail "continue to call2c"; return
249 # Continue; should stop at call2d and print actual arguments.
250 if [gdb_test "cont" ".* call2d \[(\]+d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\[)\]+ " ""] {
251 fail "continue to call2d"; return
254 # Continue; should stop at call2e and print actual arguments.
255 if [gdb_test "cont" ".* call2e \[(\]+i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\[)\]+ " ""] {
256 fail "continue to call2e"; return
259 # Continue; should stop at call2f and print actual arguments.
260 if [gdb_test "cont" ".* call2f \[(\]+f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\[)\]+ " ""] {
261 fail "continue to call2f"; return
264 # Continue; should stop at call2g and print actual arguments.
265 if [gdb_test "cont" ".* call2g \[(\]+l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\[)\]+ " ""] {
266 fail "continue to call2g"; return
269 # Continue; should stop at call2h and print actual arguments.
270 if [gdb_test "cont" ".* call2h \[(\]+d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\[)\]+ " ""] {
271 fail "continue to call2h"; return
274 # Continue; should stop at call2i and print actual arguments.
275 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\[)\]+ " ""] {
276 fail "continue to call2i"; return
279 pass "locate actual args, mixed integral and float types"
283 # Locate actual args; dereference pointers to ints and floats.
286 proc pointer_args {} {
293 send "break call3a\n" ; expect -re ".*$prompt $"
294 send "break call3b\n" ; expect -re ".*$prompt $"
295 send "break call3c\n" ; expect -re ".*$prompt $"
297 # Run; should stop at call3a and print actual arguments.
298 # Try dereferencing the arguments.
301 # The a29k fails all of these tests, perhaps because the prologue
303 setup_xfail "a29k-*-udi"
305 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
309 -re ".* call3a \[(\]+cp=$hex \"a\", sp=$hex, ip=$hex, lp=$hex\[)\]+ .*$prompt $" {}
310 -re "$prompt $" { fail "run to call3a" ; return }
311 timeout { fail "(timeout) run to call3a" ; return }
314 if [gdb_test "print *cp" ".* = 97 'a'" ""] {
315 fail "print *cp"; return
317 if [gdb_test "print *sp" ".* = 1" ""] {
318 fail "print *sp"; return
320 if [gdb_test "print *ip" ".* = 2" ""] {
321 fail "print *ip"; return
323 if [gdb_test "print *lp" ".* = 3" ""] {
324 fail "print *lp"; return
327 # Continue; should stop at call3b and print actual arguments.
328 # Try dereferencing the arguments.
329 if [gdb_test "cont" ".* call3b \[(\]+ucp=$hex \"b\", usp=$hex, uip=$hex, ulp=$hex\[)\]+ " ""] {
330 fail "continue to call3b"; return
333 if [gdb_test "print *ucp" ".* = 98 'b'" ""] {
334 fail "print *ucp"; return
336 if [gdb_test "print *usp" ".* = 6" ""] {
337 fail "print *usp"; return
339 if [gdb_test "print *uip" ".* = 7" ""] {
340 fail "print *uip"; return
342 if [gdb_test "print *ulp" ".* = 8" ""] {
343 fail "print *ulp"; return
346 # Continue; should stop at call3c and print actual arguments.
347 # Try dereferencing the arguments.
348 if [gdb_test "cont" ".* call3c \[(\]+fp=$hex, dp=$hex\[)\]+ " ""] {
349 fail "continue to call3c"; return
352 if [gdb_test "print *fp" ".* = 4" ""] {
353 fail "print *fp"; return
355 if [gdb_test "print *dp" ".* = 5" ""] {
356 fail "print *dp"; return
359 pass "locate actual args, pointer types"
363 # Locate actual args; structures and unions passed by reference.
366 proc structs_by_reference {} {
373 send "break call4a\n" ; expect -re ".*$prompt $"
374 send "break call4b\n" ; expect -re ".*$prompt $"
376 # Run; should stop at call4a and print actual arguments.
377 # Try dereferencing the arguments.
379 # The a29k fails all of these tests, perhaps because the prologue
381 setup_xfail "a29k-*-udi"
384 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
388 -re ".* call4a \[(\]+stp=$hex\[)\]+ .*$prompt $" {}
389 -re "$prompt $" { fail "run to call4a" ; return }
390 timeout { fail "(timeout) run to call4a" ; return }
393 if [gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}" ""] {
394 fail "print *stp"; return
397 # Continue; should stop at call4b and print actual arguments.
398 # Try dereferencing the arguments.
400 if [gdb_test "cont" ".* call4b \[(\]+unp=$hex\[)\]+ " ""] {
401 fail "continue to call4b"; return
404 if [gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" ""] {
405 fail "print *unp"; return
408 pass "locate actual args, structs/unions passed by reference"
412 # Locate actual args; structures and unions passed by value.
415 proc structs_by_value {} {
422 send "break call5a\n" ; expect -re ".*$prompt $"
423 send "break call5b\n" ; expect -re ".*$prompt $"
425 # Run; should stop at call5a and print actual arguments.
426 # Try dereferencing the arguments.
428 # The a29k fails all of these tests, perhaps because the prologue
430 setup_xfail "a29k-*-udi"
433 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
437 -re ".* call5a \[(\]+st=\{s1 = 101, s2 = 102\}\[)\]+ .*$prompt $" {}
438 -re "$prompt $" { fail "run to call5a" ; return }
439 timeout { fail "(timeout) run to call5a" ; return }
442 if [gdb_test "print st" ".* = \{s1 = 101, s2 = 102\}" ""] {
443 fail "print st"; return
446 # Continue; should stop at call5b and print actual arguments.
447 # Try dereferencing the arguments.
448 if [gdb_test "cont" ".* call5b \[(\]+un=\{u1 = 2, u2 = 2\}\[)\]+ " ""] {
449 fail "continue to call5b"; return
452 if [gdb_test "print un" ".* = \{u1 = 2, u2 = 2\}" ""] {
453 fail "print un"; return
456 pass "locate actual args, structs/unions passed by value"
460 # Locate actual args; discard, shuffle, and call
463 proc discard_and_shuffle {} {
471 send "break call6a\n" ; expect -re ".*$prompt $"
472 send "break call6b\n" ; expect -re ".*$prompt $"
473 send "break call6c\n" ; expect -re ".*$prompt $"
474 send "break call6d\n" ; expect -re ".*$prompt $"
475 send "break call6e\n" ; expect -re ".*$prompt $"
476 send "break call6f\n" ; expect -re ".*$prompt $"
477 send "break call6g\n" ; expect -re ".*$prompt $"
478 send "break call6h\n" ; expect -re ".*$prompt $"
479 send "break call6i\n" ; expect -re ".*$prompt $"
480 send "break call6j\n" ; expect -re ".*$prompt $"
481 send "break call6k\n" ; expect -re ".*$prompt $"
483 # Run; should stop at call6a and print actual arguments.
486 # The a29k fails all of these tests, perhaps because the prologue
488 setup_xfail "a29k-*-udi"
491 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
495 -re ".*Breakpoint $decimal, call6a .*$prompt $" {}
496 -re "$prompt $" { fail "run to call6a" ; return }
497 timeout { fail "(timeout) run to call6a" ; return }
500 send "backtrace 100\n"
503 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
504 .* main \[(\]+.*\[)\]+ .*\r
506 -re "$prompt $" { fail "backtrace from call6a" ; return }
507 timeout { fail "(timeout) backtrace from call6a" ; return }
510 # Continue; should stop at call6b and print actual arguments.
515 -re ".*Breakpoint $decimal, call6b .*$prompt $" {}
516 -re "$prompt $" { fail "continue to call6b" ; return }
517 timeout { fail "(timeout) continue to call6b" ; return }
520 send "backtrace 100\n"
523 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
524 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
525 .* main \[(\]+.*\[)\]+ .*\r
527 -re "$prompt $" { fail "backtrace from call6b" ; return }
528 timeout { fail "(timeout) backtrace from call6b" ; return }
531 # Continue; should stop at call6c and print actual arguments.
536 -re ".*Breakpoint $decimal, call6c .*$prompt $" {}
537 -re "$prompt $" { fail "continue to call6c" ; return }
538 timeout { fail "(timeout) continue to call6c" ; return }
541 send "backtrace 100\n"
544 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
545 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
546 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
547 .* main \[(\]+.*\[)\]+ .*\r
549 -re "$prompt $" { fail "backtrace from call6c" ; return }
550 timeout { fail "(timeout) backtrace from call6c" ; return }
553 # Continue; should stop at call6d and print actual arguments.
558 -re ".*Breakpoint $decimal, call6d .*$prompt $" {}
559 -re "$prompt $" { fail "continue to call6d" ; return }
560 timeout { fail "(timeout) continue to call6d" ; return }
563 send "backtrace 100\n"
566 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
567 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
568 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
569 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
570 .* main \[(\]+.*\[)\]+ .*\r
572 -re "$prompt $" { fail "backtrace from call6d" ; return }
573 timeout { fail "(timeout) backtrace from call6d" ; return }
576 # Continue; should stop at call6e and print actual arguments.
581 -re ".*Breakpoint $decimal, call6e .*$prompt $" {}
582 -re "$prompt $" { fail "continue to call6e" ; return }
583 timeout { fail "(timeout) continue to call6e" ; return }
586 send "backtrace 100\n"
589 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
590 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
591 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
592 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
593 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
594 .* main \[(\]+.*\[)\]+ .*\r
596 -re "$prompt $" { fail "backtrace from call6e" ; return }
597 timeout { fail "(timeout) backtrace from call6e" ; return }
600 # Continue; should stop at call6f and print actual arguments.
605 -re ".*Breakpoint $decimal, call6f .*$prompt $" {}
606 -re "$prompt $" { fail "continue to call6f" ; return }
607 timeout { fail "(timeout) continue to call6f" ; return }
610 send "backtrace 100\n"
613 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
614 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
615 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
616 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
617 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
618 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
619 .* main \[(\]+.*\[)\]+ .*\r
621 -re "$prompt $" { fail "backtrace from call6f" ; return }
622 timeout { fail "(timeout) backtrace from call6f" ; return }
625 # Continue; should stop at call6g and print actual arguments.
630 -re ".*Breakpoint $decimal, call6g .*$prompt $" {}
631 -re "$prompt $" { fail "continue to call6g" ; return }
632 timeout { fail "(timeout) continue to call6g" ; return }
635 send "backtrace 100\n"
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
647 -re "$prompt $" { fail "backtrace from call6g" ; return }
648 timeout { fail "(timeout) backtrace from call6g" ; return }
651 # Continue; should stop at call6h and print actual arguments.
656 -re ".*Breakpoint $decimal, call6h .*$prompt $" {}
657 -re "$prompt $" { fail "continue to call6h" ; return }
658 timeout { fail "(timeout) continue to call6h" ; return }
661 send "backtrace 100\n"
664 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
665 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
666 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
667 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
668 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
669 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
670 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
671 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
672 .* main \[(\]+.*\[)\]+ .*\r
674 -re "$prompt $" { fail "backtrace from call6h" ; return }
675 timeout { fail "(timeout) backtrace from call6h" ; return }
678 # Continue; should stop at call6i and print actual arguments.
683 -re ".*Breakpoint $decimal, call6i .*$prompt $" {}
684 -re "$prompt $" { fail "continue to call6i" ; return }
685 timeout { fail "(timeout) continue to call6i" ; return }
688 send "backtrace 100\n"
691 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
692 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
693 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
694 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
695 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
696 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
697 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
698 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
699 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
700 .* main \[(\]+.*\[)\]+ .*\r
702 -re "$prompt $" { fail "backtrace from call6i" ; return }
703 timeout { fail "(timeout) backtrace from call6i" ; return }
706 # Continue; should stop at call6j and print actual arguments.
711 -re ".*Breakpoint $decimal, call6j .*$prompt $" {}
712 -re "$prompt $" { fail "continue to call6j" ; return }
713 timeout { fail "(timeout) continue to call6j" ; return }
716 send "backtrace 100\n"
719 .* call6j \[(\]+ul=8\[)\]+ .*\r
720 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
721 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
722 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
723 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
724 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
725 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
726 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
727 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
728 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
729 .* main \[(\]+.*\[)\]+ .*\r
731 -re "$prompt $" { fail "backtrace from call6j" ; return }
732 timeout { fail "(timeout) backtrace from call6j" ; return }
735 # Continue; should stop at call6k and print actual arguments.
737 # This fails on i960-*-vxworks because gdb gets confused by
738 # breakpoints on adjacent instructions.
739 setup_xfail "i960-*-vxworks" 1786
742 -re ".*Breakpoint $decimal, call6k .*$prompt $" {}
743 -re "$prompt $" { fail "continue to call6k"; return }
744 timeout { fail "(timeout) continue to call6k"; return }
747 send "backtrace 100\n"
750 .* call6k \[(\]+\[)\]+ .*\r
751 .* call6j \[(\]+ul=8\[)\]+ .*\r
752 .* call6i \[(\]+ui=7, ul=8\[)\]+ .*\r
753 .* call6h \[(\]+us=6, ui=7, ul=8\[)\]+ .*\r
754 .* call6g \[(\]+uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
755 .* call6f \[(\]+d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
756 .* call6e \[(\]+f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
757 .* call6d \[(\]+l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
758 .* call6c \[(\]+i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
759 .* call6b \[(\]+s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
760 .* call6a \[(\]+c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\[)\]+ .*\r
761 .* main \[(\]+.*\[)\]+ .*\r
763 -re "$prompt $" { fail "backtrace from call6k" ; return }
764 timeout { fail "(timeout) backtrace from call6k" ; return }
767 pass "locate actual args, discard, shuffle, and call"
771 # Locate actual args; shuffle round robin and call
774 proc shuffle_round_robin {} {
782 send "break call7a\n" ; expect -re ".*$prompt $"
783 send "break call7b\n" ; expect -re ".*$prompt $"
784 send "break call7c\n" ; expect -re ".*$prompt $"
785 send "break call7d\n" ; expect -re ".*$prompt $"
786 send "break call7e\n" ; expect -re ".*$prompt $"
787 send "break call7f\n" ; expect -re ".*$prompt $"
788 send "break call7g\n" ; expect -re ".*$prompt $"
789 send "break call7h\n" ; expect -re ".*$prompt $"
790 send "break call7i\n" ; expect -re ".*$prompt $"
791 send "break call7j\n" ; expect -re ".*$prompt $"
792 send "break call7k\n" ; expect -re ".*$prompt $"
794 # Run; should stop at call7a and print actual arguments.
797 # The a29k fails all of these tests, perhaps because the prologue
799 setup_xfail "a29k-*-udi"
802 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
806 -re ".*Breakpoint $decimal, call7a .*$prompt $" {}
807 -re "$prompt $" { fail "run to call7a" ; return }
808 timeout { fail "(timeout) run to call7a" ; return }
811 setup_xfail "i960-*-*" 1813
812 send "backtrace 100\n"
815 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
816 .* main \[(\]+.*\[)\]+ .*\r
818 -re "$prompt $" { fail "backtrace from call7a" ; return }
819 timeout { fail "(timeout) backtrace from call7a" ; return }
822 # Continue; should stop at call7b and print actual arguments.
827 -re ".*Breakpoint $decimal, call7b .*$prompt $" {}
828 -re "$prompt $" { fail "continue to call7b" ; return }
829 timeout { fail "(timeout) continue to call7b" ; return }
832 send "backtrace 100\n"
835 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
836 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
837 .* main \[(\]+.*\[)\]+ .*\r
839 -re "$prompt $" { fail "backtrace from call7b" ; return }
840 timeout { fail "(timeout) backtrace from call7b" ; return }
843 # Continue; should stop at call7c and print actual arguments.
848 -re ".*Breakpoint $decimal, call7c .*$prompt $" {}
849 -re "$prompt $" { fail "continue to call7c" ; return }
850 timeout { fail "(timeout) continue to call7c" ; return }
853 send "backtrace 100\n"
856 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
857 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
858 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
859 .* main \[(\]+.*\[)\]+ .*\r
861 -re "$prompt $" { fail "backtrace from call7c" ; return }
862 timeout { fail "(timeout) backtrace from call7c" ; return }
865 # Continue; should stop at call7d and print actual arguments.
870 -re ".*Breakpoint $decimal, call7d .*$prompt $" {}
871 -re "$prompt $" { fail "continue to call7d" ; return }
872 timeout { fail "(timeout) continue to call7d" ; return }
875 send "backtrace 100\n"
878 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
879 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
880 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
881 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
882 .* main \[(\]+.*\[)\]+ .*\r
884 -re "$prompt $" { fail "backtrace from call7d" ; return }
885 timeout { fail "(timeout) backtrace from call7d" ; return }
888 # Continue; should stop at call7e and print actual arguments.
893 -re "Breakpoint $decimal, call7e .*$prompt $" {}
894 -re "$prompt $" { fail "continue to call7e" ; return }
895 timeout { fail "(timeout) continue to call7e" ; return }
898 send "backtrace 100\n"
901 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
902 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
903 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
904 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
905 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
906 .* main \[(\]+.*\[)\]+ .*\r
908 -re "$prompt $" { fail "backtrace from call7e" ; return }
909 timeout { fail "(timeout) backtrace from call7e" ; return }
912 # Continue; should stop at call7f and print actual arguments.
917 -re ".*Breakpoint $decimal, call7f .*$prompt $" {}
918 -re "$prompt $" { fail "continue to call7f" ; return }
919 timeout { fail "(timeout) continue to call7f" ; return }
922 send "backtrace 100\n"
925 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
926 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
927 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
928 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
929 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
930 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
931 .* main \[(\]+.*\[)\]+ .*\r
933 -re "$prompt $" { fail "backtrace from call7f" ; return }
934 timeout { fail "(timeout) backtrace from call7f" ; return }
937 # Continue; should stop at call7g and print actual arguments.
942 -re ".*Breakpoint $decimal, call7g .*$prompt $" {}
943 -re "$prompt $" { fail "continue to call7g" ; return }
944 timeout { fail "(timeout) continue to call7g" ; return }
947 send "backtrace 100\n"
950 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
951 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
952 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
953 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
954 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
955 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
956 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
957 .* main \[(\]+.*\[)\]+ .*\r
959 -re "$prompt $" { fail "backtrace from call7g" ; return }
960 timeout { fail "(timeout) backtrace from call7g" ; return }
963 # Continue; should stop at call7h and print actual arguments.
968 -re ".*Breakpoint $decimal, call7h .*$prompt $" {}
969 -re "$prompt $" { fail "continue to call7h" ; return }
970 timeout { fail "(timeout) continue to call7h" ; return }
973 send "backtrace 100\n"
976 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
977 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
978 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
979 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
980 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
981 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
982 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
983 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
984 .* main \[(\]+.*\[)\]+ .*\r
986 -re "$prompt $" { fail "backtrace from call7h" ; return }
987 timeout { fail "(timeout) backtrace from call7h" ; return }
990 # Continue; should stop at call7i and print actual arguments.
995 -re ".*Breakpoint $decimal, call7i .*$prompt $" {}
996 -re "$prompt $" { fail "continue to call7i" ; return }
997 timeout { fail "(timeout) continue to call7i" ; return }
1000 send "backtrace 100\n"
1002 -re "backtrace 100\r
1003 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1004 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1005 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1006 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1007 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1008 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1009 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1010 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1011 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1012 .* main \[(\]+.*\[)\]+ .*\r
1014 -re "$prompt $" { fail "backtrace from call7i" ; return }
1015 timeout { fail "(timeout) backtrace from call7i" ; return }
1018 # Continue; should stop at call7j and print actual arguments.
1023 -re ".*Breakpoint $decimal, call7j .*$prompt $" {}
1024 -re "$prompt $" { fail "continue to call7j" ; return }
1025 timeout { fail "(timeout) continue to call7j" ; return }
1028 send "backtrace 100\n"
1030 -re "backtrace 100\r
1031 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1032 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1033 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1034 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1035 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1036 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1037 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1038 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1039 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1040 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1041 .* main \[(\]+.*\[)\]+ .*\r
1043 -re "$prompt $" { fail "backtrace from call7j" ; return }
1044 timeout { fail "(timeout) backtrace from call7j" ; return }
1047 # Continue; should stop at call7k and print actual arguments.
1052 -re ".*Breakpoint $decimal, call7k .*$prompt $" {}
1053 -re "$prompt $" { fail "continue to call7k" ; return }
1054 timeout { fail "(timeout) continue to call7k" ; return }
1057 send "backtrace 100\n"
1059 -re "backtrace 100\r
1060 .* call7k \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1061 .* call7j \[(\]+ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\[)\]+ .*\r
1062 .* call7i \[(\]+ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\[)\]+ .*\r
1063 .* call7h \[(\]+us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\[)\]+ .*\r
1064 .* call7g \[(\]+d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\[)\]+ .*\r
1065 .* call7f \[(\]+uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\[)\]+ .*\r
1066 .* call7e \[(\]+f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\[)\]+ .*\r
1067 .* call7d \[(\]+l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\[)\]+ .*\r
1068 .* call7c \[(\]+s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\[)\]+ .*\r
1069 .* call7b \[(\]+i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\[)\]+ .*\r
1070 .* call7a \[(\]+c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\[)\]+ .*\r
1071 .* main \[(\]+.*\[)\]+ .*\r
1073 -re "$prompt $" { fail "backtrace from call7k" ; return }
1074 timeout { fail "(timeout) backtrace from call7k" ; return }
1077 pass "locate actual args, shuffle round robin and call"
1081 # Locate actual args; recursive passing of structs by value
1084 proc recursive_structs_by_value {} {
1092 send "break hitbottom\n" ; expect -re ".*$prompt $"
1094 # Run; should stop at hitbottom and print actual arguments.
1099 -re "The program .* has been started already.* \[(\]+y or n\[)\]+ $" {
1103 -re ".*Breakpoint $decimal, hitbottom .*$prompt $" {}
1104 -re "$prompt $" { fail "run to hitbottom" ; return }
1105 timeout { fail "(timeout) run to hitbottom" ; return }
1108 # The a29k fails all of these tests, perhaps because the prologue
1110 setup_xfail "a29k-*-udi"
1111 send "backtrace 100\n"
1113 -re "backtrace 100\r
1114 .* hitbottom \[(\]+\[)\]+ .*\r
1115 .* recurse \[(\]+a=\{s = 0, i = 0, l = 0\}, depth=0\[)\]+ .*\r
1116 .* recurse \[(\]+a=\{s = 1, i = 1, l = 1\}, depth=1\[)\]+ .*\r
1117 .* recurse \[(\]+a=\{s = 2, i = 2, l = 2\}, depth=2\[)\]+ .*\r
1118 .* recurse \[(\]+a=\{s = 3, i = 3, l = 3\}, depth=3\[)\]+ .*\r
1119 .* recurse \[(\]+a=\{s = 4, i = 4, l = 4\}, depth=4\[)\]+ .*\r
1120 .* test_struct_args \[(\]+\[)\]+ .*\r
1121 .* main \[(\]+.*\[)\]+ .*\r
1123 -re "$prompt $" { fail "recursive passing of structs by value" ; return }
1124 timeout { fail "(timeout) recursive passing of structs by value" ; return }
1127 pass "locate actual args, recursive structs by value"
1130 proc funcargs_reload { } {
1136 if [istarget "mips-idt-*"] then {
1137 # Restart because IDT/SIM runs out of file descriptors.
1140 gdb_reinitialize_dir $srcdir/$subdir
1141 gdb_load $objdir/$subdir/$binfile
1146 # Test for accessing local stack variables in functions which call alloca
1148 proc localvars_after_alloca { } {
1153 if { ! [ runto localvars_after_alloca ] } then { return 0 }
1155 # Print each arg as a double check to see if we can print
1156 # them here as well as with backtrace.
1158 gdb_test "print c" " = 97 'a'"
1159 gdb_test "print s" " = 1"
1160 gdb_test "print i" " = 2"
1161 gdb_test "print l" " = 3"
1165 -re ".*$prompt $" {}
1166 timeout { fail "next in localvars_after_alloca()" ; return }
1169 # Print each arg as a double check to see if we can print
1170 # them here as well as with backtrace.
1172 gdb_test "print c" " = 97 'a'"
1173 gdb_test "print s" " = 1"
1174 gdb_test "print i" " = 2"
1175 gdb_test "print l" " = 3"
1177 gdb_test "backtrace 8" "#0.*localvars_after_alloca \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace after alloca"
1181 # Test for accessing local stack variables, backtraces, finish,
1182 # and finally stepping into indirect calls. The point is that on the PA
1183 # these use a funky `dyncall' mechanism which GDB needs to know about.
1185 proc localvars_in_indirect_call { } {
1190 # Can not use "runto call0a" as call0a is called several times
1191 # during single run. Instead stop in a marker function and
1192 # take control from there.
1193 if { ! [ runto marker_indirect_call ] } then { return 0 }
1195 # break on the next call to call0a, then delete all the breakpoints
1196 # and start testing.
1197 gdb_test "break call0a" "Breakpoint .*"
1198 gdb_test "continue" "call0a .*"
1201 # Print each arg as a double check to see if we can print
1202 # them here as well as with backtrace.
1204 gdb_test "print c" " = 97 'a'"
1205 gdb_test "print s" " = 1"
1206 gdb_test "print i" " = 2"
1207 gdb_test "print l" " = 3"
1209 gdb_test "backtrace 8" "#0.*call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+.*#1.*main" "backtrace in indirectly called function"
1212 # "finish" brings us back to main. We then will try to step through
1213 # the second indirect call.
1214 # On some targets (e.g. m68k) gdb will stop from the finish in midline
1215 # of the first indirect call. This is due to stack adjustment instructions
1216 # after the indirect call. In these cases we will step till we hit the
1217 # second indirect call.
1222 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*First.*$prompt $" {
1226 -re "\[(\]+\[*\]+pointer_to_call0a\[)\]+ \[(\]+c, s, i, l\[)\]+;.*Second.*$prompt $" {
1227 pass "finish from indirectly called function"
1229 default { fail "finish from indirectly called function" ; return }
1232 gdb_test "step" "call0a \[(\]+c=97 'a', s=1, i=2, l=3\[)\]+" \
1233 "stepping into indirectly called function"
1236 # Start with a fresh gdb.
1238 # Test for stepping into indirect calls which may have trampolines (possibly
1239 # cascaded) on both the call path and the return path.
1240 # to handle trampolines.
1242 proc test_stepping_over_trampolines { } {
1247 # Stop in a marker function and take control from there.
1248 if { ! [ runto marker_call_with_trampolines ] } then { return 0 }
1250 # Cater for gdb stopping in midline, see comment for finish above.
1253 -re "marker_call_with_trampolines ..;.*$prompt $" {
1257 -re "pointer_to_call_with_trampolines.*$prompt $" {
1258 pass "finish from marker_call_with_trampolines"
1261 fail "finish from marker_call_with_trampolines"
1263 default { fail "finish from marker_call_with_trampolines" ; return 0 }
1266 # Try to step into the target function.
1267 gdb_test "step" "call_with_trampolines \[(\]+d1=5\[)\]+" \
1268 "stepping into function called with trampolines"
1270 # Make we can backtrace and the argument looks correct. */
1271 gdb_test "backtrace 8" "#0.*call_with_trampolines \[(\]+d1=5\[)\]+.*1.*main" "backtrace through call with trampolines"
1273 # Make sure we can get back to main.
1274 # Stepping back to main might stop again after the return statement
1275 # or immediately transfer control back to main if optimizations
1279 -re "main .* at.*$prompt $" {
1280 pass "stepping back to main from function called with trampolines" ;
1283 -re "\}.*End of call_with_trampolines.*$prompt $" {
1288 fail "stepping back to main from function called with trampolines"
1290 default { fail "stepping back to main from function called with trampolines" ; return 0 }
1294 # Start with a fresh gdb.
1298 gdb_reinitialize_dir $srcdir/$subdir
1299 gdb_load $objdir/$subdir/$binfile
1301 set oldtimeout $timeout
1306 unsigned_integral_args
1308 float_and_integral_args
1312 structs_by_reference
1320 recursive_structs_by_value
1322 localvars_after_alloca
1324 localvars_in_indirect_call
1326 test_stepping_over_trampolines
1328 catch "set timeout $oldtimeout"