* tests1.exp, tests2.exp (test_print_reject): Remove; causes
[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
134 test_print_accept "ptype set1" "SET \[(\]a, b, c\[)\]" \
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 \\(b:c\\)" \
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 b OF.*\\(42\\):.*ch1 CHARS\\(20\\),.*\\(52\\):.*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\\(a, b, c\\),.*CASE f OF.*\\(a\\):.*ch1 CHARS\\(20\\),.*\\(b\\):.*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 nset1\\(na = 1, na = 1\\),.*CASE f OF.*\\(na\\):.*ch1 CHARS\\(20\\).*ESAC.*\\)" \
256 "print structure mode 3"
257
258
259 if $passcount then {
260 pass "$passcount correct modes printed"
261 }
262}
263
264# various tests if locations are treated correctly
265# read access using ptype, print, whatis
266proc test_locations {} {
267 global passcount
268
269 set passcount 0
270 verbose "testing read access to locations"
271 # various location tests can be found in chillvars.exp
272
273 # set locations
274 test_print_accept "ptype s1l" "SET \\(a, b, c\\)" \
275 "print mode of set location"
276 test_print_accept "whatis s1l" "set1" \
277 "print modename of set location"
278 test_print_accept "print s1l" "c" "print set location"
279 test_print_accept "ptype s2l" "SET \\(na = 1, nb = 34, nc = 20\\)" \
280 "print mode of numbered set location"
281 test_print_accept "whatis s2l" "nset1" \
282 "print mode name of numbered set location"
283 test_print_accept "print s2l" "nb" "print numberes set location"
284
285 # range modes
286 test_print_accept "ptype rl1" "ubyte \\(0:255\\)" \
287 "print mode of range location"
288 test_print_accept "whatis rl1" "r11" \
289 "print mode name of range location"
290 test_print_accept "print rl1" "3" \
291 "print range location"
292
293 test_print_accept "ptype rl2" "ubyte \\(0:255\\)" \
294 "print mode of range location"
295 test_print_accept "whatis rl2" "r11" \
296 "print mode name of range location"
297 test_print_accept "print rl2" "0" \
298 "print range location"
299
300 test_print_accept "ptype rl3" "ubyte \\(0:255\\)" \
301 "print mode of range location"
302 test_print_accept "whatis rl3" "r11" \
303 "print mode name of range location"
304 test_print_accept "print rl3" "255" \
305 "print range location"
306
307 test_print_accept "ptype rl5" "uint \\(0:65535\\)" \
308 "print mode of range location"
309 test_print_accept "whatis rl5" "r12" \
310 "print mode name of range location"
311 test_print_accept "print rl5" "65530" \
312 "print range location"
313
314 test_print_accept "ptype rl6" "uint \\(0:65535\\)" \
315 "print mode of range location"
316 test_print_accept "whatis rl6" "r12" \
317 "print mode name of range location"
318 test_print_accept "print rl6" "0" \
319 "print range location"
320
321 test_print_accept "ptype rl7" "uint \\(0:65535\\)" \
322 "print mode of range location"
323 test_print_accept "whatis rl7" "r12" \
324 "print mode name of range location"
325 test_print_accept "print rl7" "65535" \
326 "print range location"
327
328# test_print_accept "ptype rl9" "ulong \\(0:4294967295\\)" \
329# "print mode of range location"
330# test_print_accept "whatis rl9" "r13" \
331# "print mode name of range location"
332# test_print_accept "print rl9" "128" \
333# "print range location"
334
335# test_print_accept "ptype rl10" "ulong \\(0:4294967295\\)" \
336# "print mode of range location"
337# test_print_accept "whatis rl10" "r13" \
338# "print mode name of range location"
339# test_print_accept "print rl10" "0" \
340# "print range location"
341
342# test_print_accept "ptype rl11" "ulong \\(0:4294967295\\)" \
343# "print mode of range location"
344# test_print_accept "whatis rl11" "r13" \
345# "print mode name of range location"
346# test_print_accept "print rl11" "4294967295" \
347# "print range location"
348
349 test_print_accept "ptype rl13" "byte \\(-128:127\\)" \
350 "print mode of range location"
351 test_print_accept "whatis rl13" "r14" \
352 "print mode name of range location"
353 test_print_accept "print rl13" "-121" \
354 "print range location"
355
356 test_print_accept "ptype rl14" "byte \\(-128:127\\)" \
357 "print mode of range location"
358 test_print_accept "whatis rl14" "r14" \
359 "print mode name of range location"
360 test_print_accept "print rl14" "-128" \
361 "print range location"
362
363 test_print_accept "ptype rl15" "byte \\(-128:127\\)" \
364 "print mode of range location"
365 test_print_accept "whatis rl15" "r14" \
366 "print mode name of range location"
367 test_print_accept "print rl15" "127" \
368 "print range location"
369
370 test_print_accept "ptype rl17" "int \\(-32768:32767\\)" \
371 "print mode of range location"
372 test_print_accept "whatis rl17" "r15" \
373 "print mode name of range location"
374 test_print_accept "print rl17" "-32720" \
375 "print range location"
376
377 test_print_accept "ptype rl18" "int \\(-32768:32767\\)" \
378 "print mode of range location"
379 test_print_accept "whatis rl18" "r15" \
380 "print mode name of range location"
381 test_print_accept "print rl18" "-32768" \
382 "print range location"
383
384 test_print_accept "ptype rl19" "int \\(-32768:32767\\)" \
385 "print mode of range location"
386 test_print_accept "whatis rl19" "r15" \
387 "print mode name of range location"
388 test_print_accept "print rl19" "32767" \
389 "print range location"
390
391 test_print_accept "ptype rl21" "long \\(-2147483648:2147483647\\)" \
392 "print mode of range location"
393 test_print_accept "whatis rl21" "r16" \
394 "print mode name of range location"
395 test_print_accept "print rl21" "2147483643" \
396 "print range location"
397
398 test_print_accept "ptype rl22" "long \\(-2147483648:2147483647\\)" \
399 "print mode of range location"
400 test_print_accept "whatis rl22" "r16" \
401 "print mode name of range location"
402 test_print_accept "print rl22" "-2147483648" \
403 "print range location"
404
405 test_print_accept "ptype rl23" "long \\(-2147483648:2147483647\\)" \
406 "print mode of range location"
407 test_print_accept "whatis rl23" "r16" \
408 "print mode name of range location"
409 test_print_accept "print rl23" "2147483647" \
410 "print range location"
411
412 # powerset locations
413 test_print_accept "ptype pl1" \
414 "POWERSET SET \\(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\\)" \
415 "print mode of powerset location 1"
416 test_print_accept "whatis pl1" "pm1" \
417 "print mode mode name of powerset location"
418 test_print_accept "print pl1" \
419 "\[\[\]p1:p10\[\]\]" \
420 "print powerset location 1"
421 test_print_accept "print pl2" {\[\]} \
422 "print powerset location 2"
423 test_print_accept "print pl3" "\[\[\]p1, p10\[\]\]" \
424 "print powerset location 3"
425 test_print_accept "print pl4" {\[p1:p2, p4:p6, p8:p10\]} \
426 "print powerset location 4"
427 test_print_accept "print pl5" {\[p1:p4, p6, p8:p10\]} \
428 "print powerset location 5"
429 test_print_accept "print pl6" {\[p1, p3:p8, p10\]} \
430 "print powerset location 6"
431
432 test_print_accept "ptype pl7" \
433 "POWERSET byte \\(1:8\\)" \
434 "print mode of byte powerset location"
435 test_print_accept "whatis pl7" "pm2" \
436 "print modename of byte powerset location"
437 test_print_accept "print pl7" {\[1:8\]} \
438 "print powerset location 7"
439
440 test_print_accept "ptype pl8" \
441 "POWERSET int \\(-32768:32767\\)" \
442 "print mode of int powerset location"
443 test_print_accept "whatis pl8" "pm3" \
444 "print modename of int powerset location"
445 test_print_accept "print pl8" {\[-32768:32767\]} \
446 "print powerset location 8"
447
448# test_print_accept "ptype pl9" \
449# "POWERSET long \\(-2147483648:2147483647\\)" \
450# "print mode of long powerset location"
451# test_print_accept "whatis pl9" "pm5" \
452# "print modename of long powerset location"
453# test_print_accept "print pl9" {\[-2147483648:2147483647\]} \
454# "print powerset location 9"
455
456 # reference modes
457 test_print_accept "ptype ref3l" "PTR" "print mode of reference location"
458 test_print_accept "whatis ref3l" "ref3" \
459 "print modename of reference location"
460 test_print_accept "print ref3l" "ref3\\(H'.*\\)" \
461 "print reference location"
462 test_print_accept "ptype ref4l" "PTR" "print mode of reference location"
463 test_print_accept "whatis ref4l" "ref4" \
464 "print modename of reference location"
465 test_print_accept "print ref4l" "ref4\\(H'.*\\)" \
466 "print reference location"
467 test_print_accept "ptype ref5l" "PTR" "print mode of reference location"
468 test_print_accept "whatis ref5l" "PTR" \
469 "print modename of reference location"
470 test_print_accept "print ref5l" "PTR\\(H'.*\\)" \
471 "print reference location"
472
473 # dereference a little bit..
474 test_print_accept "print ref6l->syn_int" "42" \
475 "dereference reference to synmode location"
476 test_print_accept "print ref7l->int" "-42" \
477 "dereference reference to predefined mode location"
478 test_print_accept "print ref8l->pm1" \
479 "\[\[\]p1:p10\[\]\]" \
480 "dereference reference to newmode location"
481
482 # synchronization mode locations
483 # FIXME: synchronization modes are not supported so far...
484 xfail "no synchronization mode location support, not implemented yet"
485
486 # timing mode locations
487 # FIXME: callbacks to abstime, inttime not implemented
488 xfail "timing modes not implemented properly yet"
489
490 # char string locations
491 # some tests are don in chillvars.exp
492 test_print_accept "ptype strl1" \
493 "CHARS \\(7\\) VARYING" \
494 "print varying string location"
495 test_print_accept "whatis strl1" "strm2" \
496 "print string locationa mode name"
497 test_print_accept "print strl1" \
498 "\"hansi\"//c\"00\"" \
499 "print string location"
500 # string elements
501 test_print_accept "print strl1(0)" "\'h\'" \
502 "print string element 1"
503 test_print_accept "print strl1(5)" "C\'00\'" \
504 "print string element 2"
505 test_print_accept "print strl1(3)" "\'s\'" \
506 "print string element 3"
507 test_print_accept "ptype strl1(0)" "char" \
508 "print mode of string element"
509 # slices
510 test_print_accept "print strl1(3:4)" "\"si\"" \
511 "print string slice 1"
512 test_print_accept "print strl1(0:5)" \
513 "\"hansi\"//c\"00\"" \
514 "print string slice 2"
515 test_print_accept "print strl1(0:0)" "\"h\"" \
516 "print string slice 3"
517 test_print_accept "print strl1(0 up 6)" \
518 "\"hansi\"//c\"00\"" \
519 "print string slice 4"
520 # FIXME: adjust error message, when implented
521 gdb_test "print strl1(6 up 1)" \
522 ".*slice.*out of range.*" \
523 "print invalid string slice length"
524 gdb_test "print strl1(-1 up 5)" \
525 ".*slice.*out of range.*" \
526 "print invalid string slice length"
527 gdb_test "print strl1(-1:5)" \
528 ".*slice.*out of range.*" \
529 "print invalid string slice"
d9eb60c6 530 gdb_test "print strl1(-1:7)" \
da2cfeb0
PB
531 ".*slice.*out of range.*" \
532 "print invalid string slice"
533 gdb_test "print strl1(0 up -1)" \
534 ".*slice.*out of range.*" \
535 "print invalid string slice length"
536 gdb_test "print strl1(0 up 0)" {""}
537
538 # bitstring locations
539 test_print_accept "ptype bstr1" \
540 "BOOLS \\(20\\)" \
541 "print mode of bitstring location"
542 test_print_accept "whatis bstrl1" "bstr1" \
543 "print mode name of bitstring location"
544 test_print_accept "print bstrl1" \
545 "B'10101010101010101010'" \
546 "print bitstring location"
547
548 test_print_accept "ptype bstrl1(0)" "bool|BOOL" \
549 "print mode of bitstring element"
550 test_print_accept "print bstrl1(0)" "TRUE" \
551 "print bitstring element 1"
552 test_print_accept "print bstrl1(19)" "FALSE" \
553 "print bitstring element 2"
554 test_print_accept "print bstrl1(10)" "TRUE" \
555 "print bitstring element 3"
556
557 test_print_accept "print bstrl1(0:19)" \
558 "B'10101010101010101010'" \
559 "print bitstring location slice 1"
560 test_print_accept "print bstrl1(0:0)" \
561 "B'1'" \
562 "print bitstring location slice 2"
563 test_print_accept "print bstrl1(3:9)" \
564 "B'0101010'" \
565 "print bitstring location slice 3"
566 test_print_accept "print bstrl1(0 up 20)" \
567 "B'10101010101010101010'" \
568 "print bitstring location slice 4"
569 test_print_accept "print bstrl1(19 up 1)" \
570 "B'0'" \
571 "print bitstring location slice 5"
572 gdb_test "print bstrl1(20 up 1)" \
573 ".*slice out of range.*" \
574 "print invalid bitstring slice (20 up 1)"
575 gdb_test "print bstrl1(-4:5)" \
576 ".*slice out of range.*" \
577 "print invalid bitstring slice (-4:5)"
578 gdb_test "print bstrl1(-1:up 1)" \
579 ".*invalid expression syntax.*" \
580 "print invalid bitstring slice (-1:ip 1)"
581 gdb_test "print bstrl1(-1:20)" \
582 ".*slice out of range.*" \
583 "print invalid bitstring slice (-1:20)"
584 gdb_test "print bstrl1(0 up -1)" \
585 ".*slice out of range.*" \
586 "print invalid bitstring slice (0 up -1)"
587 test_print_accept "print bstrl1(4 up 0)" "B''"
588
589 # array mode locations
590 gdb_test_exact "ptype arrl1" \
591 "ARRAY (1:100) set1" \
592 "print mode of array location"
593 gdb_test "whatis arrl1" "arr1m" \
594 "print mode name of array location"
595 gdb_test_exact "print arrl1" {[(1:100): a]} \
596 "print array location"
597 test_print_accept "ptype arrl1(1)" \
598 "SET \\(a, b, c\\)" \
599 "print mode of array element"
600 gdb_test_exact "print arrl3" \
601 {[(1:5): [(1:3): [(1:2): -2147483648]]]} \
602 "print array location 2"
603 gdb_test_exact "print arrl3(1)" \
604 {[(1:3): [(1:2): -2147483648]]} \
605 "print array location 3"
606 gdb_test_exact "ptype arrl3(1)" \
607 {ARRAY (1:3) ARRAY (1:2) long} \
608 "print mode of array element"
609 test_print_accept "print arrl3(5)" \
610 {\[\(1:3\): \[\(1:2\): -2147483648\]\]} \
611 "print array location 4"
612 test_print_accept "print arrl3(1,1)" \
613 {\[\(1:2\): -2147483648\]} \
614 "print array location 5"
615 test_print_accept "ptype arrl3(1,1)" \
616 {ARRAY \(1:2\) long} \
617 "print mode of array element"
618 test_print_accept "print arrl3(5,3)" \
619 {\[\(1:2\): -2147483648\]} \
620 "print array location 6"
621 test_print_accept "print arrl3(1,1,1)" \
622 "-2147483648" \
623 "print array location 7"
624 test_print_accept "print arrl3(5,3,2)" \
625 "-2147483648" \
626 "print array location 8"
627 test_print_accept "print arrl3(1)(3)(2)" \
628 "-2147483648" \
629 "print array location 9"
630
631 # reject the following range fails
632 # FIXME: adjust error messages
d9eb60c6
PB
633 gdb_test "print arrl3(-1)" \
634 ".*out of range.*" \
da2cfeb0 635 "check invalid array indices 1"
d9eb60c6
PB
636 gdb_test "print arrl3(6)" \
637 ".*out of range.*" \
da2cfeb0 638 "check invalid array indices 2"
d9eb60c6
PB
639 gdb_test "print arrl3(0,0)" \
640 ".*out of range.*" \
da2cfeb0 641 "check invalid array indices 3"
d9eb60c6
PB
642 gdb_test "print arrl3(1,0)" \
643 ".*out of range.*" \
da2cfeb0 644 "check invalid array indices 4"
d9eb60c6
PB
645 gdb_test "print arrl3(1,4)" \
646 ".*out of range.*" \
da2cfeb0 647 "check invalid array indices 5"
d9eb60c6
PB
648 gdb_test "print arrl3(6,4)" \
649 ".*out of range.*" \
da2cfeb0 650 "check invalid array indices 6"
d9eb60c6
PB
651 gdb_test "print arrl3(1,1,0)" \
652 ".*out of range.*" \
da2cfeb0 653 "check invalid array indices 7"
d9eb60c6
PB
654 gdb_test "print arrl3(6,4,0)" \
655 ".*out of range.*" \
da2cfeb0 656 "check invalid array indices 8"
d9eb60c6
PB
657 gdb_test "print arrl3(1,1,3)" \
658 ".*out of range.*" \
da2cfeb0
PB
659 "check invalid array indices 9"
660
d9eb60c6 661 gdb_test "print arrl3(0)(0)" \
da2cfeb0
PB
662 ".* array or string index out of range.*" \
663 "check invalid array indices 10"
d9eb60c6 664 gdb_test "print arrl3(1)(0)" \
da2cfeb0
PB
665 ".* array or string index out of range.*" \
666 "check invalid array indices 11"
d9eb60c6 667 gdb_test "print arrl3(1)(4)" \
da2cfeb0
PB
668 ".* array or string index out of range.*" \
669 "check invalid array indices 12"
d9eb60c6 670 gdb_test "print arrl3(6)(4)" \
da2cfeb0
PB
671 ".* array or string index out of range.*" \
672 "check invalid array indices 13"
d9eb60c6 673 gdb_test "print arrl3(1)(1)(0)" \
da2cfeb0
PB
674 ".* array or string index out of range.*" \
675 "check invalid array indices 14"
d9eb60c6 676 gdb_test "print arrl3(6)(4)(0)" \
da2cfeb0
PB
677 ".* array or string index out of range.*" \
678 "check invalid array indices 15"
d9eb60c6 679 gdb_test "print arrl3(1)(1)(3)" \
da2cfeb0
PB
680 ".* array or string index out of range.*" \
681 "check invalid array indices 16"
682
683 # slices
684 test_print_accept "print arrl4(1:3)" \
685 {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\]\]} \
686 "print array slice 1"
687 test_print_accept "ptype arrl4(1:3)" \
688 {ARRAY \(1:3\) ARRAY \(1:3\) ARRAY \(1:2\) long} \
689 "print mode of array slice"
690# The next one is bogus:
691# test_print_accept "print arrl4(5, 2:3, 1)" \
692# # FIXME: maybe the '(1): ' in the inner tupel should be omitted ? \
693# {\[(2): \[\(1\): 100\], \(3\):\[\(1\): 100\]\]} \
694# "print array slice 2"
695 test_print_accept "print arrl4(1 up 4)" \
696 {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\], \(4\): \[\(1:3\): \[\(1:2\): -2147483648\]\]\]} \
697 "print array slice 3"
698# The next two are bogus:
699# test_print_accept "print arrl4(3, 2 up 1)" \
700# {\[\(2:3\): \[\(1:2\): 100\]\]} \
701# "print array slice 4"
702# test_print_accept "print arrl4(1:2, 1 up 1, 2)" \
703# {\[\(1\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\], \(2\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\]\]} \
704# "print array slice 4"
705 # reject invalid slices
706 # FIXME: adjust error messages
d9eb60c6 707 gdb_test "print arrl4(5:6)" \
da2cfeb0
PB
708 ".*slice out of range.*" \
709 "check invalid range 1"
d9eb60c6 710 gdb_test "print arrl4(0:1)" \
da2cfeb0
PB
711 ".*slice out of range.*" \
712 "check invalid range 2"
d9eb60c6 713 gdb_test "print arrl4(0:6)" \
da2cfeb0
PB
714 ".*slice out of range.*" \
715 "check invalid range 3"
716 gdb_test "print arrl4(3:2)" \
717 ".*slice out of range.*" \
718 "check invalid range 4"
719 gdb_test "print arrl4(1,3:4)" \
720 ".*syntax error.*" \
721 "check invalid range 5"
722 gdb_test "print arrl4(1,0:1)" \
723 ".*syntax error.*" \
724 "check invalid range 6"
725 gdb_test "print arrl4(1,0:4)" \
726 ".*syntax error.*" \
727 "check invalid range 7"
728 gdb_test "print arrl4(1,3:2)" \
729 ".*syntax error.*" \
730 "check invalid range 8"
731 gdb_test "print arrl4(5 up 2)" \
732 ".*slice out of range.*" \
733 "check invalid range 9"
734 gdb_test "print arrl4(-1 up 1)" \
735 ".*slice out of range.*" \
736 "check invalid range 10"
737 gdb_test "print arrl4(-1 up 7)" \
738 ".*slice out of range.*" \
739 "check invalid range 11"
740 gdb_test "print arrl4(1 up 0)" \
741 ".*slice out of range.*" \
742 "check invalid range 12"
743 gdb_test "print arrl4(1,3 up 1)" \
744 ".*syntax error.*" \
745 "check invalid range 13"
746 gdb_test "print arrl4(1,-1 up 1)" \
747 ".*syntax error.*" \
748 "check invalid range 14"
749 gdb_test "print arrl4(1,-1 up 5)" \
750 ".*syntax error.*" \
751 "check invalid range 15"
752 gdb_test "print arrl4(1,2 up 0)" \
753 ".*syntax error.*" \
754 "check invalid range 16"
755
756 # structure modes
757 # some tests are in chillvars.exp
758 # FIXME: no tag processing implemented do maybe adjust these tests
759 setup_xfail "*-*-*"
760 test_print_accept "ptype stru1m" \
761 "STRUCT \\(.*a long,.*b long,.*CASE b OF.*\\(42\\):.*ch1 CHARS\\(20\\),.*\\(52\\):.*ch2 CHARS\\(10\\).*ELSE.*ch3 CHARS\\(1\\).*ESAC.*\\)" \
762 "print mode of structure location 1"
763 test_print_accept "whatis strul1" "stru1m" \
764 "print mode name of structure location 1"
765 setup_xfail "*-*-*"
766 test_print_accept "print strul1" \
767 {\[\.a: -2147483648, \.b: 42, \.\(b\): \{\(42\) = \[\.ch1: \"12345678900987654321\"\], \(52\) = \[\.ch2: \"1234567890\"\], (else) = \[\.ch3: \"1\"\]\}\]} \
768 "print structure location 1"
769 test_print_accept "print strul1.a" \
770 "-2147483648" \
771 "print field of structure location 1"
772 test_print_accept "print strul1.b" "42" \
773 "print field of structure location 1"
774 test_print_accept "print strul1.ch1" \
775 "\"12345678900987654321\"" \
776 "print field of structure location 1"
777 setup_xfail "*-*-*"
778 test_print_accept "print strul1.ch2" \
779 "\"1234567890\".*warning: tag field value does'nt match" \
780 "print field of structure location 1"
781 setup_xfail "*-*-*"
782 test_print_accept "print strul1.ch3" \
783 "\"1\".*warning: tag field value does'nt match" \
784 "print field of structure location 1"
785
786 if $passcount then {
787 pass "$passcount correct locations printed"
788 }
789}
790
791# Start with a fresh gdb.
792
793gdb_exit
794gdb_start
795gdb_reinitialize_dir $srcdir/$subdir
796
797send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
798
799if [set_lang_chill] then {
800 test_modes
801 test_locations
802} else {
803 warning "$test_name tests suppressed."
804}
This page took 0.052351 seconds and 4 git commands to generate.