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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.base/] [funcargs.exp] - Blame information for rev 1774

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

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

powered by: WebSVN 2.1.0

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