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

Subversion Repositories openrisc_me

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

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

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

powered by: WebSVN 2.1.0

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