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