OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.base/] [funcargs.exp] - Blame information for rev 394

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.