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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [testsuite/] [gdb.chill/] [tests1.exp] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
# Copyright (C) 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 tests various Chill values, expressions, and types.
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
if [skip_chill_tests] then { continue }
27
 
28
set testfile "tests1"
29
set srcfile ${srcdir}/$subdir/${testfile}.ch
30
set binfile ${objdir}/${subdir}/${testfile}.exe
31
if  { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
32
    perror "Couldn't compile ${srcfile}"
33
    return -1
34
}
35
 
36
# Set the current language to chill.  This counts as a test.  If it
37
# fails, then we skip the other tests.
38
 
39
proc set_lang_chill {} {
40
    global gdb_prompt
41
    global binfile objdir subdir
42
 
43
    verbose "loading file '$binfile'"
44
    gdb_load $binfile
45
    send_gdb "set language chill\n"
46
    gdb_expect {
47
        -re ".*$gdb_prompt $" {}
48
        timeout { fail "set language chill (timeout)" ; return 0 }
49
    }
50
 
51
    send_gdb "show language\n"
52
    gdb_expect {
53
        -re ".* source language is \"chill\".*$gdb_prompt $" {
54
            pass "set language to \"chill\""
55
            send_gdb "break dummyfunc\n"
56
            gdb_expect {
57
                -re ".*$gdb_prompt $" {
58
                    send_gdb "run\n"
59
                    gdb_expect -re ".*$gdb_prompt $" {}
60
                    return 1
61
                }
62
                timeout {
63
                    fail "can't set breakpoint (timeout)"
64
                    return 0
65
                }
66
            }
67
        }
68
        -re ".*$gdb_prompt $" {
69
            fail "setting language to \"chill\""
70
            return 0
71
        }
72
        timeout {
73
            fail "can't show language (timeout)"
74
            return 0
75
        }
76
    }
77
}
78
 
79
# Testing printing of a specific value.  Increment passcount for
80
# success or issue fail message for failure.  In both cases, return
81
# a 1 to indicate that more tests can proceed.  However a timeout
82
# is a serious error, generates a special fail message, and causes
83
# a 0 to be returned to indicate that more tests are likely to fail
84
# as well.
85
#
86
# Args are:
87
#
88
#       First one is string to send_gdb to gdb
89
#       Second one is string to match gdb result to
90
#       Third one is an optional message to be printed
91
 
92
proc test_print_accept { args } {
93
    global gdb_prompt
94
    global passcount
95
    global verbose
96
 
97
    if [llength $args]==3 then {
98
        set message [lindex $args 2]
99
    } else {
100
        set message [lindex $args 0]
101
    }
102
    set sendthis [lindex $args 0]
103
    set expectthis [lindex $args 1]
104
    set result [gdb_test $sendthis ".* = ${expectthis}" $message]
105
    if $result==0 {incr passcount}
106
    return $result
107
}
108
 
109
# Testing printing of a specific value.  Increment passcount for
110
# success or issue fail message for failure.  In both cases, return
111
# a 1 to indicate that more tests can proceed.  However a timeout
112
# is a serious error, generates a special fail message, and causes
113
# a 0 to be returned to indicate that more tests are likely to fail
114
# as well.
115
 
116
# various tests if modes are treated correctly
117
# using ptype
118
proc test_modes {} {
119
    global passcount
120
 
121
    verbose "testing chill modes"
122
    set passcount 0
123
 
124
    # discrete modes
125
    test_print_accept "ptype BYTE" "byte"
126
    test_print_accept "ptype UBYTE" "ubyte"
127
    test_print_accept "ptype INT" "int"
128
    test_print_accept "ptype UINT" "uint"
129
    test_print_accept "ptype LONG" "long"
130
    test_print_accept "ptype ULONG" "ulong"
131
    test_print_accept "ptype BOOL" "bool"
132
    test_print_accept "ptype CHAR" "char"
133
 
134
    test_print_accept "ptype set1" "SET \[(\]aaa, bbb, ccc\[)\]" \
135
        "print unnumbered set mode"
136
    test_print_accept "ptype nset1" "SET \[(\]na = 1, nb = 34, nc = 20\[)\]" \
137
        "print numbered set mode"
138
 
139
    # mp:
140
    # display maybe in hex values ?
141
    #
142
    test_print_accept "ptype r11" "ubyte \\(0:255\\)" \
143
        "print ubyte range mode"
144
    test_print_accept "ptype r12" "uint \\(0:65535\\)" \
145
        "print uint range mode"
146
#    test_print_accept "ptype r13" "ulong \\(0:4294967295\\)" \
147
#       "print ulong range mode"
148
    test_print_accept "ptype r14" "byte \\(-128:127\\)" \
149
        "print byte range mode"
150
    test_print_accept "ptype r15" "int \\(-32768:32767\\)" \
151
        "print int range mode"
152
    test_print_accept "ptype r16" "long \\(-2147483648:2147483647\\)" \
153
        "print long range mode"
154
 
155
    test_print_accept "ptype r2" "set1 \\(bbb:ccc\\)" \
156
        "print unnumbered set range mode"
157
    test_print_accept "ptype r3" "nset1 \\(na:na\\)" \
158
        "print numbered set range mode"
159
    # really this order ?
160
    # I'm not sure what should happen for the next two tests.
161
    setup_xfail "*-*-*"
162
    test_print_accept "ptype r4" "nset1 \\(nb = 34:nc = 20\\)" \
163
        "print numbered set range mode"
164
    setup_xfail "*-*-*"
165
    test_print_accept "ptype r5" "nset1 \\(na = 1, nb = 34, nc = 20\\)" \
166
        "print numbered set range mode"
167
 
168
    # powerset modes
169
    test_print_accept "ptype pm1" \
170
        "POWERSET SET \[(\]p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\[)\]" \
171
        "print powerset mode 1"
172
    test_print_accept "ptype pm2" "POWERSET byte \\(1:8\\)" \
173
        "print powerset mode 2"
174
    test_print_accept "ptype pm3" "POWERSET int \\(-32768:32767\\)" \
175
        "print powerset mode 3"
176
    test_print_accept "ptype pm4" "POWERSET long \\(-32768:32768\\)" \
177
        "print powerset mode 4"
178
    test_print_accept "ptype pm5" \
179
        "POWERSET long \\(-2147483648:2147483647\\)" \
180
        "print powerset mode 5"
181
 
182
    # reference modes
183
    test_print_accept "ptype ref1" "REF pm1" \
184
        "print reference to powerset mode"
185
    test_print_accept "ptype ref2" "REF byte" \
186
        "print reference to byte"
187
    test_print_accept "ptype ref3" "PTR" \
188
        "print free reference type"
189
 
190
    # procedure modes
191
    # FIXME: we have to talk about this ...
192
    test_print_accept "ptype prm1" \
193
        "REF PROC \[(\]\[)\]" \
194
        "print procedure mode 1"
195
    setup_xfail "*-*-*"
196
    test_print_accept "ptype prm2" \
197
        "REF PROC \[(\]bool in, int out long inout\[)\] RETURNS \[(\]char\[)\]" \
198
        "print procedure mode 2"
199
    setup_xfail "*-*-*"
200
    test_print_accept "ptype prm3" \
201
        "REF PROC \[(\]pm1, ref loc\[)\] RETURNS \[(\]ref3\[)\]" \
202
        "print procedure mode 3"
203
    setup_xfail "*-*-*"
204
    test_print_accept "ptype prm4" \
205
        "\[(\] \[)\] EXCEPTIONS \[(\]ex1, ex2, ex3\[)\]" \
206
        "print procedure mode 4"
207
    setup_xfail "*-*-*"
208
    test_print_accept "ptype prm5" \
209
        "REF PROC \[(\]r11, r16 inout, r5 out\[)\] RETURNS \[(\]r2\[)\] EXCEPTIONS \[(\]ex1\[)\]" \
210
        "print procedure mode 5"
211
 
212
    # synchronization modes
213
    # FIXME: since gdb doesn't process events & buffers so far, this has be
214
    #        filled later...
215
    xfail "synchronization mode handling"
216
 
217
    # timing modes
218
    test_print_accept "ptype DURATION" "duration"
219
    test_print_accept "ptype TIME" "time"
220
 
221
    # string modes
222
    # some tests are done in chillvars.exp
223
    test_print_accept "ptype strm1" "CHARS \\(5\\)" "print char string mode"
224
    test_print_accept "ptype strm2" "CHARS \[(\]7\[)\] VARYING" \
225
        "print varying char string mode"
226
    test_print_accept "ptype bstr1" "BOOLS \\(20\\)" "print bit string mode"
227
 
228
    test_print_accept "ptype B'000'" "BOOLS \\(3\\)" "bit string literal"
229
    test_print_accept "ptype B'11110000'" "BOOLS \\(8\\)" "bit string literal"
230
    # FIXME: adjust error message
231
    gdb_test "ptype B'00110211'" {.*Too-large digit.*[.]} \
232
        "reject invalid bitstring"
233
 
234
    # array modes
235
    # some tests are done in chillvars.exp
236
    test_print_accept "ptype arr1m" "ARRAY \\(1:100\\) set1" \
237
        "print array mode 1"
238
    test_print_accept "ptype arr2m" "ARRAY \\(1:100\\) ARRAY \\(1:100\\) set1"\
239
        "print array mode 2"
240
    test_print_accept "ptype arr3m" "ARRAY \\(0:255\\) ARRAY \\(0:65535\\) ARRAY \\(-128:127\\) set1" \
241
        "print array mode 3"
242
    setup_xfail "*-*-*"
243
    test_print_accept "ptype arr4m" "ARRAY \\(b:c\\) ARRAY \\(na = 1:na = 1\\) ARRAY \\(nc:nb\\) ARRAY \\(na = 1:nc = 20\\) POWERSET SET \[(\]p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\[)\]" \
244
        "print array mode 4"
245
 
246
    # structure modes
247
    # some checks are in chillvars.exp
248
    # setup_xfail "*-*-*"
249
    test_print_accept "ptype stru1m" "STRUCT \\(.*a long,.*b long,.*CASE OF.*:.*ch1 CHARS \\(20\\).*:.*ch2 CHARS \\(10\\).*ELSE.*ch3 CHARS \\(1\\).*ESAC.*\\)" \
250
        "print structure mode 1"
251
    #setup_xfail "*-*-*"
252
    test_print_accept "ptype stru2m" "STRUCT \\(.*f set1,.*CASE OF.*:.*ch1 CHARS \\(20\\).*:.*ch2 CHARS \\(10\\) VARYING.*ELSE.*ch3 CHARS \\(0\\) VARYING.*ESAC.*\\)" \
253
        "print structure mode 2"
254
    #setup_xfail "*-*-*"
255
    test_print_accept "ptype stru3m" "STRUCT \\(.*f r3,.*CASE OF.*:.*ch1 CHARS \\(20\\).*ESAC.*\\)" \
256
        "print structure mode 3"
257
    # setup_xfail "*-*-*"
258
    test_print_accept "ptype stru4m" "STRUCT \\(.*i long,.*CASE OF.*:.*i1 int,.*i11 int,.*b1 bool,.*c1 char.*:.*i2 long,.*i22 long,.*bs2 BOOLS \\(10\\).*:.*s3 STRUCT \\(.*i3 int,.*CASE OF.*:.*foo long.*ELSE.*bar char.*ESAC.*\\).*ELSE.*x stru2m.*ESAC,.*y stru3m.*\\)" \
259
        "print structure mode 4"
260
 
261
 
262
    if $passcount then {
263
        pass "$passcount correct modes printed"
264
    }
265
}
266
 
267
# various tests if locations are treated correctly
268
# read access using ptype, print, whatis
269
proc test_locations {} {
270
    global passcount
271
 
272
    set passcount 0
273
    verbose "testing read access to locations"
274
    # various location tests can be found in chillvars.exp
275
 
276
    # set locations
277
    test_print_accept "ptype s1l" "SET \\(aaa, bbb, ccc\\)" \
278
        "print mode of set location"
279
    test_print_accept "whatis s1l" "set1" \
280
        "print modename of set location"
281
    test_print_accept "print s1l" "ccc" "print set location"
282
    test_print_accept "ptype s2l" "SET \\(na = 1, nb = 34, nc = 20\\)" \
283
        "print mode of numbered set location"
284
    test_print_accept "whatis s2l" "nset1" \
285
        "print mode name of numbered set location"
286
    test_print_accept "print s2l" "nb" "print numberes set location"
287
 
288
    # range modes
289
    test_print_accept "ptype rl1" "ubyte \\(0:255\\)" \
290
        "print mode of range location"
291
    test_print_accept "whatis rl1" "r11" \
292
        "print mode name of range location"
293
    test_print_accept "print rl1" "3" \
294
        "print range location"
295
 
296
    test_print_accept "ptype rl2" "ubyte \\(0:255\\)" \
297
        "print mode of range location"
298
    test_print_accept "whatis rl2" "r11" \
299
        "print mode name of range location"
300
    test_print_accept "print rl2" "0" \
301
        "print range location"
302
 
303
    test_print_accept "ptype rl3" "ubyte \\(0:255\\)" \
304
        "print mode of range location"
305
    test_print_accept "whatis rl3" "r11" \
306
        "print mode name of range location"
307
    test_print_accept "print rl3" "255" \
308
        "print range location"
309
 
310
    test_print_accept "ptype rl5" "uint \\(0:65535\\)" \
311
        "print mode of range location"
312
    test_print_accept "whatis rl5" "r12" \
313
        "print mode name of range location"
314
    test_print_accept "print rl5" "65530" \
315
        "print range location"
316
 
317
    test_print_accept "ptype rl6" "uint \\(0:65535\\)" \
318
        "print mode of range location"
319
    test_print_accept "whatis rl6" "r12" \
320
        "print mode name of range location"
321
    test_print_accept "print rl6" "0" \
322
        "print range location"
323
 
324
    test_print_accept "ptype rl7" "uint \\(0:65535\\)" \
325
        "print mode of range location"
326
    test_print_accept "whatis rl7" "r12" \
327
        "print mode name of range location"
328
    test_print_accept "print rl7" "65535" \
329
        "print range location"
330
 
331
#     test_print_accept "ptype rl9" "ulong \\(0:4294967295\\)" \
332
#       "print mode of range location"
333
#     test_print_accept "whatis rl9" "r13" \
334
#       "print mode name of range location"
335
#     test_print_accept "print rl9" "128" \
336
#       "print range location"
337
 
338
#     test_print_accept "ptype rl10" "ulong \\(0:4294967295\\)" \
339
#       "print mode of range location"
340
#     test_print_accept "whatis rl10" "r13" \
341
#       "print mode name of range location"
342
#     test_print_accept "print rl10" "0" \
343
#       "print range location"
344
 
345
#     test_print_accept "ptype rl11" "ulong \\(0:4294967295\\)" \
346
#       "print mode of range location"
347
#     test_print_accept "whatis rl11" "r13" \
348
#       "print mode name of range location"
349
#     test_print_accept "print rl11" "4294967295" \
350
#       "print range location"
351
 
352
    test_print_accept "ptype rl13" "byte \\(-128:127\\)" \
353
        "print mode of range location"
354
    test_print_accept "whatis rl13" "r14" \
355
        "print mode name of range location"
356
    test_print_accept "print rl13" "-121" \
357
        "print range location"
358
 
359
    test_print_accept "ptype rl14" "byte \\(-128:127\\)" \
360
        "print mode of range location"
361
    test_print_accept "whatis rl14" "r14" \
362
        "print mode name of range location"
363
    test_print_accept "print rl14" "-128" \
364
        "print range location"
365
 
366
    test_print_accept "ptype rl15" "byte \\(-128:127\\)" \
367
        "print mode of range location"
368
    test_print_accept "whatis rl15" "r14" \
369
        "print mode name of range location"
370
    test_print_accept "print rl15" "127" \
371
        "print range location"
372
 
373
    test_print_accept "ptype rl17" "int \\(-32768:32767\\)" \
374
        "print mode of range location"
375
    test_print_accept "whatis rl17" "r15" \
376
        "print mode name of range location"
377
    test_print_accept "print rl17" "-32720" \
378
        "print range location"
379
 
380
    test_print_accept "ptype rl18" "int \\(-32768:32767\\)" \
381
        "print mode of range location"
382
    test_print_accept "whatis rl18" "r15" \
383
        "print mode name of range location"
384
    test_print_accept "print rl18" "-32768" \
385
        "print range location"
386
 
387
    test_print_accept "ptype rl19" "int \\(-32768:32767\\)" \
388
        "print mode of range location"
389
    test_print_accept "whatis rl19" "r15" \
390
        "print mode name of range location"
391
    test_print_accept "print rl19" "32767" \
392
        "print range location"
393
 
394
    test_print_accept "ptype rl21" "long \\(-2147483648:2147483647\\)" \
395
        "print mode of range location"
396
    test_print_accept "whatis rl21" "r16" \
397
        "print mode name of range location"
398
    test_print_accept "print rl21" "2147483643" \
399
        "print range location"
400
 
401
    test_print_accept "ptype rl22" "long \\(-2147483648:2147483647\\)" \
402
        "print mode of range location"
403
    test_print_accept "whatis rl22" "r16" \
404
        "print mode name of range location"
405
    test_print_accept "print rl22" "-2147483648" \
406
        "print range location"
407
 
408
    test_print_accept "ptype rl23" "long \\(-2147483648:2147483647\\)" \
409
        "print mode of range location"
410
    test_print_accept "whatis rl23" "r16" \
411
        "print mode name of range location"
412
    test_print_accept "print rl23" "2147483647" \
413
        "print range location"
414
 
415
    # powerset locations
416
    test_print_accept "ptype pl1" \
417
        "POWERSET SET \\(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\\)" \
418
        "print mode of powerset location 1"
419
    test_print_accept "whatis pl1" "pm1" \
420
        "print mode mode name of powerset location"
421
    test_print_accept "print pl1" \
422
        "\[\[\]p1:p10\[\]\]" \
423
        "print powerset location 1"
424
    test_print_accept "print pl2" {\[\]} \
425
        "print powerset location 2"
426
    test_print_accept "print pl3" "\[\[\]p1, p10\[\]\]" \
427
        "print powerset location 3"
428
    test_print_accept "print pl4" {\[p1:p2, p4:p6, p8:p10\]} \
429
        "print powerset location 4"
430
    test_print_accept "print pl5" {\[p1:p4, p6, p8:p10\]} \
431
        "print powerset location 5"
432
    test_print_accept "print pl6" {\[p1, p3:p8, p10\]} \
433
        "print powerset location 6"
434
 
435
    test_print_accept "ptype pl7" \
436
        "POWERSET byte \\(1:8\\)" \
437
        "print mode of byte powerset location"
438
    test_print_accept "whatis pl7" "pm2" \
439
        "print modename of byte powerset location"
440
    test_print_accept "print pl7" {\[1:8\]} \
441
        "print powerset location 7"
442
 
443
    test_print_accept "ptype pl8" \
444
        "POWERSET int \\(-32768:32767\\)" \
445
        "print mode of int powerset location"
446
    test_print_accept "whatis pl8" "pm3" \
447
        "print modename of int powerset location"
448
    test_print_accept "print pl8" {\[-32768:32767\]} \
449
        "print powerset location 8"
450
 
451
#    test_print_accept "ptype pl9" \
452
#       "POWERSET long \\(-2147483648:2147483647\\)" \
453
#       "print mode of long powerset location"
454
#    test_print_accept "whatis pl9" "pm5" \
455
#       "print modename of long powerset location"
456
#    test_print_accept "print pl9" {\[-2147483648:2147483647\]} \
457
#       "print powerset location 9"
458
 
459
    # reference modes
460
    test_print_accept "ptype ref3l" "PTR" "print mode of reference location"
461
    # setup_xfail "*-*-*"
462
    test_print_accept "whatis ref3l" "ref3" \
463
        "print modename of reference location"
464
    # setup_xfail "*-*-*"
465
    test_print_accept "print ref3l" "ref3\\(H'.*\\)" \
466
        "print reference location"
467
    test_print_accept "ptype ref4l" "PTR" "print mode of reference location"
468
    # setup_xfail "*-*-*"
469
    test_print_accept "whatis ref4l" "ref4" \
470
        "print modename of reference location"
471
    # setup_xfail "*-*-*"
472
    test_print_accept "print ref4l" "ref4\\(H'.*\\)" \
473
        "print reference location"
474
    test_print_accept "ptype ref5l" "PTR" "print mode of reference location"
475
    test_print_accept "whatis ref5l" "PTR" \
476
        "print modename of reference location"
477
    test_print_accept "print ref5l" "PTR\\(H'.*\\)" \
478
        "print reference location"
479
 
480
    # dereference a little bit..
481
    test_print_accept "print ref6l->syn_int" "42" \
482
        "dereference reference to synmode location"
483
    test_print_accept "print ref7l->int" "-42" \
484
        "dereference reference to predefined mode location"
485
    test_print_accept "print ref8l->pm1" \
486
        "\[\[\]p1:p10\[\]\]" \
487
        "dereference reference to newmode location"
488
 
489
    # synchronization mode locations
490
    # FIXME: synchronization modes are not supported so far...
491
    xfail "no synchronization mode location support, not implemented yet"
492
 
493
    # timing mode locations
494
    # FIXME: callbacks to abstime, inttime not implemented
495
    xfail "timing modes not implemented properly yet"
496
 
497
    # char string locations
498
    # some tests are don in chillvars.exp
499
    test_print_accept "ptype strl1" \
500
        "CHARS \\(7\\) VARYING" \
501
        "print varying string location"
502
    test_print_accept "whatis strl1" "strm2" \
503
        "print string locationa mode name"
504
    test_print_accept "print strl1" \
505
        {\"hansi\^\(0\)\"} \
506
        "print string location"
507
    # string elements
508
    test_print_accept "print strl1(0)" "\'h\'" \
509
        "print string element 1"
510
    test_print_accept "print strl1(5)" {'\^[(]0[)]'} \
511
        "print string element 2"
512
    test_print_accept "print strl1(3)" "\'s\'" \
513
        "print string element 3"
514
    test_print_accept "ptype strl1(0)" "char" \
515
        "print mode of string element"
516
    # slices
517
    test_print_accept "print strl1(3:4)" "\"si\"" \
518
        "print string slice 1"
519
    test_print_accept "print strl1(0:5)" \
520
        {\"hansi\^\(0\)\"} \
521
        "print string slice 2"
522
    test_print_accept "print strl1(0:0)" "\"h\"" \
523
        "print string slice 3"
524
    test_print_accept "print strl1(0 up 6)" \
525
        {\"hansi\^\(0\)\"} \
526
        "print string slice 4"
527
    # FIXME: adjust error message, when implented
528
    gdb_test "print strl1(6 up 1)" \
529
        ".*slice.*out of range.*" \
530
        "print invalid string slice length"
531
    gdb_test "print strl1(-1 up 5)" \
532
        ".*slice.*out of range.*" \
533
        "print invalid string slice length"
534
    gdb_test "print strl1(-1:5)" \
535
        ".*slice.*out of range.*" \
536
        "print invalid string slice"
537
    gdb_test "print strl1(-1:7)" \
538
        ".*slice.*out of range.*" \
539
        "print invalid string slice"
540
    gdb_test "print strl1(0 up -1)" \
541
        ".*slice.*out of range.*" \
542
        "print invalid string slice length"
543
    gdb_test "print strl1(0 up 0)" {""}
544
 
545
    # bitstring locations
546
    test_print_accept "ptype bstr1" \
547
        "BOOLS \\(20\\)" \
548
        "print mode of bitstring location"
549
    test_print_accept "whatis bstrl1" "bstr1" \
550
        "print mode name of bitstring location"
551
    test_print_accept "print bstrl1" \
552
        "B'10101010101010101010'" \
553
        "print bitstring location"
554
 
555
    test_print_accept "ptype bstrl1(0)" "bool|BOOL" \
556
        "print mode of bitstring element"
557
    test_print_accept "print bstrl1(0)" "TRUE" \
558
        "print bitstring element 1"
559
    test_print_accept "print bstrl1(19)" "FALSE" \
560
        "print bitstring element 2"
561
    test_print_accept "print bstrl1(10)" "TRUE" \
562
        "print bitstring element 3"
563
 
564
    test_print_accept "print bstrl1(0:19)" \
565
        "B'10101010101010101010'" \
566
        "print bitstring location slice 1"
567
    test_print_accept "print bstrl1(0:0)" \
568
        "B'1'" \
569
        "print bitstring location slice 2"
570
    test_print_accept "print bstrl1(3:9)" \
571
        "B'0101010'" \
572
        "print bitstring location slice 3"
573
    test_print_accept "print bstrl1(0 up 20)" \
574
        "B'10101010101010101010'" \
575
        "print bitstring location slice 4"
576
    test_print_accept "print bstrl1(19 up 1)" \
577
        "B'0'" \
578
        "print bitstring location slice 5"
579
    gdb_test "print bstrl1(20 up 1)" \
580
        ".*slice out of range.*" \
581
        "print invalid bitstring slice (20 up 1)"
582
    gdb_test "print bstrl1(-4:5)" \
583
        ".*slice out of range.*" \
584
        "print invalid bitstring slice (-4:5)"
585
    gdb_test "print bstrl1(-1:up 1)" \
586
        ".*invalid expression syntax.*" \
587
        "print invalid bitstring slice (-1:ip 1)"
588
    gdb_test "print bstrl1(-1:20)" \
589
        ".*slice out of range.*" \
590
        "print invalid bitstring slice (-1:20)"
591
    gdb_test "print bstrl1(0 up -1)" \
592
        ".*slice out of range.*" \
593
        "print invalid bitstring slice (0 up -1)"
594
    test_print_accept "print bstrl1(4 up 0)" "B''"
595
 
596
    # array mode locations
597
    gdb_test_exact "ptype arrl1" \
598
        "ARRAY (1:100) set1" \
599
        "print mode of array location"
600
    gdb_test "whatis arrl1" "arr1m" \
601
        "print mode name of array location"
602
    gdb_test_exact "print arrl1" {[(1:100): aaa]} \
603
        "print array location"
604
    test_print_accept "ptype arrl1(1)" \
605
        "SET \\(aaa, bbb, ccc\\)" \
606
        "print mode of array element"
607
    gdb_test_exact "print arrl3" \
608
        {[(1:5): [(1:3): [(1:2): -2147483648]]]} \
609
        "print array location 2"
610
    gdb_test_exact "print arrl3(1)" \
611
        {[(1:3): [(1:2): -2147483648]]} \
612
        "print array location 3"
613
    gdb_test_exact "ptype arrl3(1)" \
614
        {ARRAY (1:3) ARRAY (1:2) long} \
615
        "print mode of array element"
616
    test_print_accept "print arrl3(5)" \
617
        {\[\(1:3\): \[\(1:2\): -2147483648\]\]} \
618
        "print array location 4"
619
    test_print_accept "print arrl3(1,1)" \
620
        {\[\(1:2\): -2147483648\]} \
621
        "print array location 5"
622
    test_print_accept "ptype arrl3(1,1)" \
623
        {ARRAY \(1:2\) long} \
624
        "print mode of array element"
625
    test_print_accept "print arrl3(5,3)" \
626
        {\[\(1:2\): -2147483648\]} \
627
        "print array location 6"
628
    test_print_accept "print arrl3(1,1,1)" \
629
        "-2147483648" \
630
        "print array location 7"
631
    test_print_accept "print arrl3(5,3,2)" \
632
        "-2147483648" \
633
        "print array location 8"
634
    test_print_accept "print arrl3(1)(3)(2)" \
635
        "-2147483648" \
636
        "print array location 9"
637
 
638
    # reject the following range fails
639
    # FIXME: adjust error messages
640
    gdb_test "print arrl3(-1)" \
641
        ".*out of range.*" \
642
        "check invalid array indices 1"
643
    gdb_test "print arrl3(6)" \
644
        ".*out of range.*" \
645
        "check invalid array indices 2"
646
    gdb_test "print arrl3(0,0)" \
647
        ".*out of range.*" \
648
        "check invalid array indices 3"
649
    gdb_test "print arrl3(1,0)" \
650
        ".*out of range.*" \
651
        "check invalid array indices 4"
652
    gdb_test "print arrl3(1,4)" \
653
        ".*out of range.*" \
654
        "check invalid array indices 5"
655
    gdb_test "print arrl3(6,4)" \
656
        ".*out of range.*" \
657
        "check invalid array indices 6"
658
    gdb_test "print arrl3(1,1,0)" \
659
        ".*out of range.*" \
660
        "check invalid array indices 7"
661
    gdb_test "print arrl3(6,4,0)" \
662
        ".*out of range.*" \
663
        "check invalid array indices 8"
664
    gdb_test "print arrl3(1,1,3)" \
665
        ".*out of range.*" \
666
        "check invalid array indices 9"
667
 
668
    gdb_test "print arrl3(0)(0)" \
669
        ".* array or string index out of range.*" \
670
        "check invalid array indices 10"
671
    gdb_test "print arrl3(1)(0)" \
672
        ".* array or string index out of range.*" \
673
        "check invalid array indices 11"
674
    gdb_test "print arrl3(1)(4)" \
675
        ".* array or string index out of range.*" \
676
        "check invalid array indices 12"
677
    gdb_test "print arrl3(6)(4)" \
678
        ".* array or string index out of range.*" \
679
        "check invalid array indices 13"
680
    gdb_test "print arrl3(1)(1)(0)" \
681
        ".* array or string index out of range.*" \
682
        "check invalid array indices 14"
683
    gdb_test "print arrl3(6)(4)(0)" \
684
        ".* array or string index out of range.*" \
685
        "check invalid array indices 15"
686
    gdb_test "print arrl3(1)(1)(3)" \
687
        ".* array or string index out of range.*" \
688
        "check invalid array indices 16"
689
 
690
    # slices
691
    test_print_accept "print arrl4(1:3)" \
692
        {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\]\]} \
693
        "print array slice 1"
694
    test_print_accept "ptype arrl4(1:3)" \
695
        {ARRAY \(1:3\) ARRAY \(1:3\) ARRAY \(1:2\) long} \
696
        "print mode of array slice"
697
# The next one is bogus:
698
#    test_print_accept "print arrl4(5, 2:3, 1)" \
699
#       # FIXME: maybe the '(1): ' in the inner tupel should be omitted ? \
700
#       {\[(2): \[\(1\): 100\], \(3\):\[\(1\): 100\]\]} \
701
#       "print array slice 2"
702
    test_print_accept "print arrl4(1 up 4)" \
703
        {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\], \(4\): \[\(1:3\): \[\(1:2\): -2147483648\]\]\]} \
704
        "print array slice 3"
705
# The next two are bogus:
706
#    test_print_accept "print arrl4(3, 2 up 1)" \
707
#       {\[\(2:3\): \[\(1:2\): 100\]\]} \
708
#       "print array slice 4"
709
#    test_print_accept "print arrl4(1:2, 1 up 1, 2)" \
710
#       {\[\(1\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\], \(2\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\]\]} \
711
#       "print array slice 4"
712
    # reject invalid slices
713
    # FIXME: adjust error messages
714
    gdb_test "print arrl4(5:6)" \
715
        ".*slice out of range.*" \
716
        "check invalid range 1"
717
    gdb_test "print arrl4(0:1)" \
718
        ".*slice out of range.*" \
719
        "check invalid range 2"
720
    gdb_test "print arrl4(0:6)" \
721
        ".*slice out of range.*" \
722
        "check invalid range 3"
723
    gdb_test "print arrl4(3:2)" \
724
        ".*slice out of range.*" \
725
        "check invalid range 4"
726
    gdb_test "print arrl4(1,3:4)" \
727
        ".*syntax error.*" \
728
        "check invalid range 5"
729
    gdb_test "print arrl4(1,0:1)" \
730
        ".*syntax error.*" \
731
        "check invalid range 6"
732
    gdb_test "print arrl4(1,0:4)" \
733
        ".*syntax error.*" \
734
        "check invalid range 7"
735
    gdb_test "print arrl4(1,3:2)" \
736
        ".*syntax error.*" \
737
        "check invalid range 8"
738
    gdb_test "print arrl4(5 up 2)" \
739
        ".*slice out of range.*" \
740
        "check invalid range 9"
741
    gdb_test "print arrl4(-1 up 1)" \
742
        ".*slice out of range.*" \
743
        "check invalid range 10"
744
    gdb_test "print arrl4(-1 up 7)" \
745
        ".*slice out of range.*" \
746
        "check invalid range 11"
747
    gdb_test "print arrl4(1 up 0)" \
748
        ".*slice out of range.*" \
749
        "check invalid range 12"
750
    gdb_test "print arrl4(1,3 up 1)" \
751
        ".*syntax error.*" \
752
        "check invalid range 13"
753
    gdb_test "print arrl4(1,-1 up 1)" \
754
        ".*syntax error.*" \
755
        "check invalid range 14"
756
    gdb_test "print arrl4(1,-1 up 5)" \
757
        ".*syntax error.*" \
758
        "check invalid range 15"
759
    gdb_test "print arrl4(1,2 up 0)" \
760
        ".*syntax error.*" \
761
        "check invalid range 16"
762
 
763
    # structure modes
764
    # some tests are in chillvars.exp
765
    # FIXME: no tag processing implemented do maybe adjust these tests
766
    setup_xfail "*-*-*"
767
    test_print_accept "ptype stru1m" \
768
        "STRUCT \\(.*a long,.*b long,.*CASE b OF.*\\(42\\):.*ch1 CHARS\\(20\\),.*\\(52\\):.*ch2 CHARS\\(10\\).*ELSE.*ch3 CHARS\\(1\\).*ESAC.*\\)" \
769
        "print mode of structure location 1"
770
    test_print_accept "whatis strul1" "stru1m" \
771
        "print mode name of structure location 1"
772
    setup_xfail "*-*-*"
773
    test_print_accept "print strul1" \
774
        {\[\.a: -2147483648, \.b: 42, \.\(b\): \{\(42\) = \[\.ch1: \"12345678900987654321\"\], \(52\) = \[\.ch2: \"1234567890\"\], (else) = \[\.ch3: \"1\"\]\}\]} \
775
        "print structure location 1"
776
    test_print_accept "print strul1.a" \
777
        "-2147483648" \
778
        "print field of structure location 1"
779
    test_print_accept "print strul1.b" "42" \
780
        "print field of structure location 1"
781
    test_print_accept "print strul1.ch1" \
782
        "\"12345678900987654321\"" \
783
        "print field of structure location 1"
784
    # setup_xfail "*-*-*"
785
    test_print_accept "print strul1.ch2" \
786
        "\"1234567890\"" \
787
        "print field of structure location 1"
788
    # setup_xfail "*-*-*"
789
    test_print_accept "print strul1.ch3" \
790
        "\"1\"" \
791
        "print field of structure location 1"
792
 
793
    if $passcount then {
794
        pass "$passcount correct locations printed"
795
    }
796
}
797
 
798
# This is chill/9434
799
 
800
proc test_9434 {} {
801
    global passcount
802
 
803
    verbose "testing pr-9434"
804
 
805
    test_print_accept "ptype m_xyzmode" "STRUCT \\(.*next REF m_xyzmode,.*i long.*\\)"
806
}
807
 
808
# Start with a fresh gdb.
809
 
810
gdb_exit
811
gdb_start
812
gdb_reinitialize_dir $srcdir/$subdir
813
 
814
gdb_test "set print sevenbit-strings" ".*"
815
 
816
if [set_lang_chill] then {
817
    test_modes
818
    test_locations
819
    test_9434
820
} else {
821
    warning "$test_name tests suppressed."
822
}

powered by: WebSVN 2.1.0

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