aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-12-01 08:17:13 +0000
committerPer Bothner <per@bothner.com>1995-12-01 08:17:13 +0000
commitda2cfeb098806854f2bb6da085cfba0f37892c16 (patch)
tree4d3b083f041713bce263ba4ea6f711b2228540e7 /gdb
parenta366d882c09d3fb36aafca0d3f9cc7aa1aa46dfe (diff)
downloadgdb-da2cfeb098806854f2bb6da085cfba0f37892c16.zip
gdb-da2cfeb098806854f2bb6da085cfba0f37892c16.tar.gz
gdb-da2cfeb098806854f2bb6da085cfba0f37892c16.tar.bz2
* tests1.ch, tests1.exp, tests2.ch, tests2.exp, Makefile.in:
New (extensive) test cases. * chexp.exp: Fix relations to return TRUE or FALSE.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.chill/.Sanitize4
-rw-r--r--gdb/testsuite/gdb.chill/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.chill/Makefile.in3
-rw-r--r--gdb/testsuite/gdb.chill/chexp.exp104
-rw-r--r--gdb/testsuite/gdb.chill/tests1.ch220
-rw-r--r--gdb/testsuite/gdb.chill/tests1.exp891
-rw-r--r--gdb/testsuite/gdb.chill/tests2.ch193
-rw-r--r--gdb/testsuite/gdb.chill/tests2.exp362
8 files changed, 1730 insertions, 53 deletions
diff --git a/gdb/testsuite/gdb.chill/.Sanitize b/gdb/testsuite/gdb.chill/.Sanitize
index 2e4d8b7..9062748 100644
--- a/gdb/testsuite/gdb.chill/.Sanitize
+++ b/gdb/testsuite/gdb.chill/.Sanitize
@@ -60,6 +60,10 @@ result.ch
result.exp
string.ch
string.exp
+tests1.ch
+tests1.exp
+tests2.ch
+tests2.exp
tuples.ch
tuples.exp
diff --git a/gdb/testsuite/gdb.chill/ChangeLog b/gdb/testsuite/gdb.chill/ChangeLog
index 7c009b3..aff2ce3 100644
--- a/gdb/testsuite/gdb.chill/ChangeLog
+++ b/gdb/testsuite/gdb.chill/ChangeLog
@@ -1,3 +1,9 @@
+Fri Dec 1 00:08:37 1995 Per Bothner <bothner@kalessin.cygnus.com>
+
+ * tests1.ch, tests1.exp, tests2.ch, tests2.exp, Makefile.in:
+ New (extensive) test cases.
+ * chexp.exp: Fix relations to return TRUE or FALSE.
+
Wed Nov 29 19:28:13 1995 Per Bothner <bothner@kalessin.cygnus.com>
* Makefile.in: Add .exp.check rule.
diff --git a/gdb/testsuite/gdb.chill/Makefile.in b/gdb/testsuite/gdb.chill/Makefile.in
index f8c0dc6..3189910 100644
--- a/gdb/testsuite/gdb.chill/Makefile.in
+++ b/gdb/testsuite/gdb.chill/Makefile.in
@@ -1,7 +1,8 @@
srcdir = @srcdir@
VPATH = @srcdir@
-PROGS = callch.exe chillvars.exe misc.exe result.exe string.exe tuples.exe \
+PROGS = callch.exe chillvars.exe misc.exe result.exe string.exe \
+ tests1.exe tests2.exe tuples.exe \
pr-4975.exe pr-5016.exe pr-5020.exe pr-5022.exe pr-5646.exe \
pr-5984.exe pr-6292.exe pr-6632.exe pr-8136.exe
diff --git a/gdb/testsuite/gdb.chill/chexp.exp b/gdb/testsuite/gdb.chill/chexp.exp
index 39a83fd..831c537 100644
--- a/gdb/testsuite/gdb.chill/chexp.exp
+++ b/gdb/testsuite/gdb.chill/chexp.exp
@@ -190,59 +190,59 @@ proc test_float_literals_accepted {} {
# Test various floating point formats
- gdb_test "p .44 < .45" " = 1"
- gdb_test "p .44 > .45" " = 0"
- gdb_test "p 0.44 < 0.45" " = 1"
- gdb_test "p 0.44 > 0.45" " = 0"
- gdb_test "p 44. < 45." " = 1"
- gdb_test "p 44. > 45." " = 0"
- gdb_test "p 44.0 < 45.0" " = 1"
- gdb_test "p 44.0 > 45.0" " = 0"
- gdb_test "p 10D20 < 10D21" " = 1"
- gdb_test "p 10D20 > 10D21" " = 0"
- gdb_test "p 10d20 < 10d21" " = 1"
- gdb_test "p 10d20 > 10d21" " = 0"
- gdb_test "p 10E20 < 10E21" " = 1"
- gdb_test "p 10E20 > 10E21" " = 0"
- gdb_test "p 10e20 < 10e21" " = 1"
- gdb_test "p 10e20 > 10e21" " = 0"
- gdb_test "p 10.D20 < 10.D21" " = 1"
- gdb_test "p 10.D20 > 10.D21" " = 0"
- gdb_test "p 10.d20 < 10.d21" " = 1"
- gdb_test "p 10.d20 > 10.d21" " = 0"
- gdb_test "p 10.E20 < 10.E21" " = 1"
- gdb_test "p 10.E20 > 10.E21" " = 0"
- gdb_test "p 10.e20 < 10.e21" " = 1"
- gdb_test "p 10.e20 > 10.e21" " = 0"
- gdb_test "p 10.0D20 < 10.0D21" " = 1"
- gdb_test "p 10.0D20 > 10.0D21" " = 0"
- gdb_test "p 10.0d20 < 10.0d21" " = 1"
- gdb_test "p 10.0d20 > 10.0d21" " = 0"
- gdb_test "p 10.0E20 < 10.0E21" " = 1"
- gdb_test "p 10.0E20 > 10.0E21" " = 0"
- gdb_test "p 10.0e20 < 10.0e21" " = 1"
- gdb_test "p 10.0e20 > 10.0e21" " = 0"
- gdb_test "p 10.0D+20 < 10.0D+21" " = 1"
- gdb_test "p 10.0D+20 > 10.0D+21" " = 0"
- gdb_test "p 10.0d+20 < 10.0d+21" " = 1"
- gdb_test "p 10.0d+20 > 10.0d+21" " = 0"
- gdb_test "p 10.0E+20 < 10.0E+21" " = 1"
- gdb_test "p 10.0E+20 > 10.0E+21" " = 0"
- gdb_test "p 10.0e+20 < 10.0e+21" " = 1"
- gdb_test "p 10.0e+20 > 10.0e+21" " = 0"
- gdb_test "p 10.0D-11 < 10.0D-10" " = 1"
- gdb_test "p 10.0D-11 > 10.0D-10" " = 0"
- gdb_test "p 10.0d-11 < 10.0d-10" " = 1"
- gdb_test "p 10.0d-11 > 10.0d-10" " = 0"
- gdb_test "p 10.0E-11 < 10.0E-10" " = 1"
- gdb_test "p 10.0E-11 > 10.0E-10" " = 0"
- gdb_test "p 10.0e-11 < 10.0e-10" " = 1"
- gdb_test "p 10.0e-11 > 10.0e-10" " = 0"
+ gdb_test "p .44 < .45" " = TRUE"
+ gdb_test "p .44 > .45" " = FALSE"
+ gdb_test "p 0.44 < 0.45" " = TRUE"
+ gdb_test "p 0.44 > 0.45" " = FALSE"
+ gdb_test "p 44. < 45." " = TRUE"
+ gdb_test "p 44. > 45." " = FALSE"
+ gdb_test "p 44.0 < 45.0" " = TRUE"
+ gdb_test "p 44.0 > 45.0" " = FALSE"
+ gdb_test "p 10D20 < 10D21" " = TRUE"
+ gdb_test "p 10D20 > 10D21" " = FALSE"
+ gdb_test "p 10d20 < 10d21" " = TRUE"
+ gdb_test "p 10d20 > 10d21" " = FALSE"
+ gdb_test "p 10E20 < 10E21" " = TRUE"
+ gdb_test "p 10E20 > 10E21" " = FALSE"
+ gdb_test "p 10e20 < 10e21" " = TRUE"
+ gdb_test "p 10e20 > 10e21" " = FALSE"
+ gdb_test "p 10.D20 < 10.D21" " = TRUE"
+ gdb_test "p 10.D20 > 10.D21" " = FALSE"
+ gdb_test "p 10.d20 < 10.d21" " = TRUE"
+ gdb_test "p 10.d20 > 10.d21" " = FALSE"
+ gdb_test "p 10.E20 < 10.E21" " = TRUE"
+ gdb_test "p 10.E20 > 10.E21" " = FALSE"
+ gdb_test "p 10.e20 < 10.e21" " = TRUE"
+ gdb_test "p 10.e20 > 10.e21" " = FALSE"
+ gdb_test "p 10.0D20 < 10.0D21" " = TRUE"
+ gdb_test "p 10.0D20 > 10.0D21" " = FALSE"
+ gdb_test "p 10.0d20 < 10.0d21" " = TRUE"
+ gdb_test "p 10.0d20 > 10.0d21" " = FALSE"
+ gdb_test "p 10.0E20 < 10.0E21" " = TRUE"
+ gdb_test "p 10.0E20 > 10.0E21" " = FALSE"
+ gdb_test "p 10.0e20 < 10.0e21" " = TRUE"
+ gdb_test "p 10.0e20 > 10.0e21" " = FALSE"
+ gdb_test "p 10.0D+20 < 10.0D+21" " = TRUE"
+ gdb_test "p 10.0D+20 > 10.0D+21" " = FALSE"
+ gdb_test "p 10.0d+20 < 10.0d+21" " = TRUE"
+ gdb_test "p 10.0d+20 > 10.0d+21" " = FALSE"
+ gdb_test "p 10.0E+20 < 10.0E+21" " = TRUE"
+ gdb_test "p 10.0E+20 > 10.0E+21" " = FALSE"
+ gdb_test "p 10.0e+20 < 10.0e+21" " = TRUE"
+ gdb_test "p 10.0e+20 > 10.0e+21" " = FALSE"
+ gdb_test "p 10.0D-11 < 10.0D-10" " = TRUE"
+ gdb_test "p 10.0D-11 > 10.0D-10" " = FALSE"
+ gdb_test "p 10.0d-11 < 10.0d-10" " = TRUE"
+ gdb_test "p 10.0d-11 > 10.0d-10" " = FALSE"
+ gdb_test "p 10.0E-11 < 10.0E-10" " = TRUE"
+ gdb_test "p 10.0E-11 > 10.0E-10" " = FALSE"
+ gdb_test "p 10.0e-11 < 10.0e-10" " = TRUE"
+ gdb_test "p 10.0e-11 > 10.0e-10" " = FALSE"
# looks funny, but apparently legal
- gdb_test "p _.1e+10 < _.1e+11" " = 1"
- gdb_test "p _.1e+10 > _.1e+11" " = 0"
- gdb_test "p __.1e-12 < __.1e-11" " = 1"
- gdb_test "p __.1e-12 > __.1e-11" " = 0"
+ gdb_test "p _.1e+10 < _.1e+11" " = TRUE"
+ gdb_test "p _.1e+10 > _.1e+11" " = FALSE"
+ gdb_test "p __.1e-12 < __.1e-11" " = TRUE"
+ gdb_test "p __.1e-12 > __.1e-11" " = FALSE"
}
proc test_convenience_variables {} {
diff --git a/gdb/testsuite/gdb.chill/tests1.ch b/gdb/testsuite/gdb.chill/tests1.ch
new file mode 100644
index 0000000..6f17844
--- /dev/null
+++ b/gdb/testsuite/gdb.chill/tests1.ch
@@ -0,0 +1,220 @@
+-- Copyright (C) 1992, 1995 Free Software Foundation, Inc.
+
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+-- Please email any bugs, comments, and/or additions to this file to:
+-- bug-gdb@prep.ai.mit.edu
+
+--
+-- test program 1 (refer to tests1.exp)
+--
+
+/* These functions are defined in libchill.a */
+
+runtime: SPEC MODULE
+DCL chill_argc long;
+DCL chill_argv REF ARRAY (0:1000) REF CHARS (1000) VARYING;
+__print_event: PROC (arg0 ptr,
+ arg1 ptr) END;
+__print_buffer: PROC (arg0 ptr,
+ arg1 ptr) END;
+GRANT ALL;
+END;
+
+tests1: module;
+
+seize __print_event,
+ __print_buffer;
+
+newmode set1 = set(a, b, c);
+newmode nset1 = set(na = 1, nb = 34, nc = 20);
+newmode r11 = range (0 : upper(ubyte));
+newmode r12 = range (0 : upper(uint));
+--newmode r13 = range (0 : upper(ulong)); -- bug in gnuchill
+newmode r14 = range (lower(byte) : upper(byte));
+newmode r15 = range (lower(int) : upper(int));
+newmode r16 = range (lower(long): upper(long));
+newmode r2 = set1(b : c);
+newmode r3 = nset1(na : na);
+newmode r4 = nset1(nc : nb);
+newmode r5 = nset1(lower(nset1) : upper(nset1));
+
+newmode pm1 = powerset set(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
+newmode pm2 = powerset byte (1:8);
+newmode pm3 = powerset int (-32768:32767);
+newmode pm4 = powerset long (-32768:32768);
+newmode pm5 = powerset long (lower(long):upper(long));
+newmode ref1 = ref pm1;
+newmode ref2 = ref byte;
+newmode ref3 = ptr;
+synmode ref4 = ptr;
+synmode syn_int = int;
+
+newmode prm1 = proc ();
+newmode prm2 = proc (bool in, int out, long inout) returns (char);
+newmode prm3 = proc (pm1, ref1 loc) returns (ref3);
+newmode prm4 = proc () exceptions(ex1, ex2, ex3);
+newmode prm5 = proc (r11, r16 inout, r5 out) returns (r2) exceptions (ex1);
+
+newmode ev1m = event;
+newmode ev2m = event (42);
+
+newmode bu1m = buffer ref1;
+newmode bu2m = buffer (42) ubyte;
+
+newmode strm1 = char (5);
+synmode strm2 = char (7) varying;
+
+synmode bstr1 = bit(20);
+--newmode bstr2 = bit(10) varying;
+
+newmode arr1m = array(1:100) set1;
+newmode arr2m = array(1:100, 1:100) set1;
+newmode arr3m = array(r11, r12, r14) set1;
+newmode arr4m = array(r2) array (r3) array (r4, r5) pm1;
+newmode arr5m = array(1:10) int;
+newmode arr6m = array(1:5, 1:3, 1:2) long;
+
+newmode stru1m = struct (a, b long,
+ case b of
+ (42): ch1 char(20),
+ (52): ch2 char(10)
+ else ch3 char(1)
+ esac);
+
+newmode stru2m = struct (f set1,
+ case f of
+ (a): ch1 char(20),
+ (b): ch2 char(10) varying
+ else ch3 char(0) varying
+ esac);
+newmode stru3m = struct (f r3,
+ case f of
+ (na): ch1 char(20)
+ esac);
+
+-- set mode locations
+dcl s1l set1 := c;
+dcl s2l nset1 := nb;
+
+-- range mode locations
+dcl rl1 r11 := 3;
+dcl rl2 r11 := lower(r11);
+dcl rl3 r11 := upper(r11);
+
+dcl rl5 r12 := 65530;
+dcl rl6 r12 := lower(r12);
+dcl rl7 r12 := upper(r12);
+
+--dcl rl9 r13 := 128;
+--dcl rl10 r13 := lower(r13);
+--dcl rl11 r13 := upper(r13);
+
+dcl rl13 r14 := -121;
+dcl rl14 r14 := lower(r14);
+dcl rl15 r14 := upper(r14);
+
+dcl rl17 r15 := -32720;
+dcl rl18 r15 := lower(r15);
+dcl rl19 r15 := upper(r15);
+
+dcl rl21 r16 := 2147483643;
+dcl rl22 r16 := lower(r16);
+dcl rl23 r16 := upper(r16);
+
+-- powerset mode locations
+dcl pl1 pm1 := [p1:p10];
+dcl pl2 pm1 := [];
+dcl pl3 pm1 := [p1, p10];
+dcl pl4 pm1 := [p1:p2, p4:p6, p8:p10];
+dcl pl5 pm1 := [p1:p4, p6, p8:p10];
+dcl pl6 pm1 := [p1, p3:p8, p10];
+
+dcl pl7 pm2 := [1:8];
+dcl pl8 pm3 := [-32768:32767];
+--dcl pl9 pm5 := [-2147483648:2147483647];
+
+-- reference mode locations
+dcl ref3l ref3;
+dcl ref4l ref4;
+dcl ref5l, ref6l, ref7l, ref8l ptr;
+dcl syn_intl1 syn_int := 42;
+dcl intl1 int := -42;
+
+-- synchronization mode locations
+dcl ev1l ev1m;
+dcl ev2l ev2m;
+dcl bu1l bu1m;
+dcl bu2l bu2m;
+
+-- timing mode locations
+dcl til1 time;
+
+-- string mode locations
+dcl strl1, strl2 strm2;
+dcl bstrl1 bstr1 := B'10101010101010101010';
+
+-- array mode locations
+dcl arrl1 arr1m;
+dcl arrl2 arr5m := [1, -1, 32767, -32768, 0, 10, 11, 12, 13, 42];
+dcl arrl3 arr6m := [(1:5): [(1:3): [(1:2): -2147483648]]];
+dcl arrl4 arr6m := [(1:2): [(1:3): [(1:2): -2147483648]],
+ (3): [(1:3): [(1:2): 100]],
+ (4:5): [(1:3): [(1:2): -2147483648]]];
+dcl arrl5 array(1:10) nset1;
+
+-- structure mode locations
+dcl strul1 stru1m := [-2147483648, 42, "12345678900987654321"];
+
+dummyfunc: proc();
+end dummyfunc;
+
+ref3l:=->pl1; -- newmode ref
+ref4l:=->pl1; -- synmode ref
+ref5l:=->pl1; -- ptr
+
+ref6l:=->syn_intl1; -- ref to synmode
+ref7l:=->intl1; -- ref to predefined mode
+ref8l:=->pl1; -- ref to newmode
+
+strl1 := "ha" // C'6e' // "s" // "i" // C'00';
+strl2 := C'00' // "ope";
+
+__print_event(addr(ev1l), addr("ev1l"));
+__print_event(addr(ev2l), addr("ev2l"));
+__print_buffer(addr(bu1l), addr("bu1m"));
+__print_buffer(addr(bu2l), addr("bu2m"));
+
+til1 := abstime(1970, 3, 12, 10, 43, 0);
+writetext(stdout, "lower(pm3) = %C; upper(pm3) = %C%..%/",
+ lower(pm3), upper(pm3));
+writetext(stdout, "lower(pm5) = %C; upper(pm5) = %C%..%/",
+ lower(pm5), upper(pm5));
+--writetext(stdout, "lower(pl9) = %C; upper(pl9) = %C%..%/",
+-- lower(pl9), upper(pl9));
+writetext(stdout, "date = %C%..%/", til1);
+
+writetext(stdout, "slice1 = %C%..%/", strl1(3 : 5));
+writetext(stdout, "slice2 = %C%..%/", strl2(0 : 3));
+--writetext(stdout, "slice3 = %C%..%/", strl1(0 up 20));
+writetext(stdout, "slice4 = %C%..%/", bstrl1(0));
+--writetext(stdout, "slice5 = %C%..%/", arrl3(1:5));
+
+
+writetext(stdout, "done.%/");
+
+dummyfunc();
+
+end tests1;
diff --git a/gdb/testsuite/gdb.chill/tests1.exp b/gdb/testsuite/gdb.chill/tests1.exp
new file mode 100644
index 0000000..4197608
--- /dev/null
+++ b/gdb/testsuite/gdb.chill/tests1.exp
@@ -0,0 +1,891 @@
+# Copyright (C) 1995 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file tests various Chill values, expressions, and types.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+if [skip_chill_tests] then { continue }
+
+set testfile "tests1"
+set srcfile ${srcdir}/$subdir/${testfile}.ch
+set binfile ${objdir}/${subdir}/${testfile}.exe
+if { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
+ perror "Couldn't compile ${srcfile}"
+ return -1
+}
+
+# Set the current language to chill. This counts as a test. If it
+# fails, then we skip the other tests.
+
+proc set_lang_chill {} {
+ global prompt
+ global binfile objdir subdir
+
+ verbose "loading file '$binfile'"
+ gdb_load $binfile
+ send "set language chill\n"
+ expect {
+ -re ".*$prompt $" {}
+ timeout { fail "set language chill (timeout)" ; return 0 }
+ }
+
+ send "show language\n"
+ expect {
+ -re ".* source language is \"chill\".*$prompt $" {
+ pass "set language to \"chill\""
+ send "break dummyfunc\n"
+ expect {
+ -re ".*$prompt $" {
+ send "run\n"
+ expect -re ".*$prompt $" {}
+ return 1
+ }
+ timeout {
+ fail "can't set breakpoint (timeout)"
+ return 0
+ }
+ }
+ }
+ -re ".*$prompt $" {
+ fail "setting language to \"chill\""
+ return 0
+ }
+ timeout {
+ fail "can't show language (timeout)"
+ return 0
+ }
+ }
+}
+
+# Testing printing of a specific value. Increment passcount for
+# success or issue fail message for failure. In both cases, return
+# a 1 to indicate that more tests can proceed. However a timeout
+# is a serious error, generates a special fail message, and causes
+# a 0 to be returned to indicate that more tests are likely to fail
+# as well.
+#
+# Args are:
+#
+# First one is string to send to gdb
+# Second one is string to match gdb result to
+# Third one is an optional message to be printed
+
+proc test_print_accept { args } {
+ global prompt
+ global passcount
+ global verbose
+
+ if [llength $args]==3 then {
+ set message [lindex $args 2]
+ } else {
+ set message [lindex $args 0]
+ }
+ set sendthis [lindex $args 0]
+ set expectthis [lindex $args 1]
+ set result [gdb_test $sendthis ".* = ${expectthis}" $message]
+ if $result==0 {incr passcount}
+ return $result
+}
+
+
+#
+# same function as above but $expectthis has to match exactly (no '=' is
+# appended in regexp
+#
+proc test_print_accept_exact { args } {
+ global prompt
+ global passcount
+ global verbose
+
+ if [llength $args]==3 then {
+ set message [lindex $args 2]
+ } else {
+ set message [lindex $args 0]
+ }
+ set sendthis [lindex $args 0]
+ set expectthis [lindex $args 1]
+ if $verbose>2 then {
+ send_user "Sending \"$sendthis\" to gdb\n"
+ send_user "Looking to match \"$expectthis\"\n"
+ send_user "Message is \"$message\"\n"
+ }
+ send "$sendthis\n"
+ expect {
+ -re "$expectthis\r\n$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$prompt $" {
+ if ![string match "" $message] then {
+ fail "$sendthis ($message)"
+ } else {
+ fail "$sendthis"
+ }
+ return 1
+ }
+ timeout {
+ fail "$sendthis (timeout)"
+ return 0
+ }
+ }
+}
+
+# Testing printing of a specific value. Increment passcount for
+# success or issue fail message for failure. In both cases, return
+# a 1 to indicate that more tests can proceed. However a timeout
+# is a serious error, generates a special fail message, and causes
+# a 0 to be returned to indicate that more tests are likely to fail
+# as well.
+
+proc test_print_reject { args } {
+ global prompt
+ global passcount
+ global verbose
+
+ if [llength $args]==2 then {
+ set expectthis [lindex $args 1]
+ } else {
+ set expectthis "should never match this bogus string"
+ }
+ set sendthis [lindex $args 0]
+ if $verbose>2 then {
+ send_user "Sending \"$sendthis\" to gdb\n"
+ send_user "Looking to match \"$expectthis\"\n"
+ }
+ send "$sendthis\n"
+ expect {
+ -re ".*A .* in expression.*\\.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*Junk after end of expression.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*No symbol table is loaded.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$expectthis.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$prompt $" {
+ fail "$sendthis not properly rejected"
+ return 1
+ }
+ timeout {
+ fail "$sendthis (timeout)"
+ return 0
+ }
+ }
+}
+
+# various tests if modes are treated correctly
+# using ptype
+proc test_modes {} {
+ global passcount
+
+ verbose "testing chill modes"
+ set passcount 0
+
+ # discrete modes
+ test_print_accept "ptype BYTE" "byte"
+ test_print_accept "ptype UBYTE" "ubyte"
+ test_print_accept "ptype INT" "int"
+ test_print_accept "ptype UINT" "uint"
+ test_print_accept "ptype LONG" "long"
+ test_print_accept "ptype ULONG" "ulong"
+ test_print_accept "ptype BOOL" "bool"
+ test_print_accept "ptype CHAR" "char"
+
+ test_print_accept "ptype set1" "SET \[(\]a, b, c\[)\]" \
+ "print unnumbered set mode"
+ test_print_accept "ptype nset1" "SET \[(\]na = 1, nb = 34, nc = 20\[)\]" \
+ "print numbered set mode"
+
+ # mp:
+ # display maybe in hex values ?
+ #
+ test_print_accept "ptype r11" "ubyte \\(0:255\\)" \
+ "print ubyte range mode"
+ test_print_accept "ptype r12" "uint \\(0:65535\\)" \
+ "print uint range mode"
+# test_print_accept "ptype r13" "ulong \\(0:4294967295\\)" \
+# "print ulong range mode"
+ test_print_accept "ptype r14" "byte \\(-128:127\\)" \
+ "print byte range mode"
+ test_print_accept "ptype r15" "int \\(-32768:32767\\)" \
+ "print int range mode"
+ test_print_accept "ptype r16" "long \\(-2147483648:2147483647\\)" \
+ "print long range mode"
+
+ test_print_accept "ptype r2" "set1 \\(b:c\\)" \
+ "print unnumbered set range mode"
+ test_print_accept "ptype r3" "nset1 \\(na:na\\)" \
+ "print numbered set range mode"
+ # really this order ?
+ # I'm not sure what should happen for the next two tests.
+ setup_xfail "*-*-*"
+ test_print_accept "ptype r4" "nset1 \\(nb = 34:nc = 20\\)" \
+ "print numbered set range mode"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype r5" "nset1 \\(na = 1, nb = 34, nc = 20\\)" \
+ "print numbered set range mode"
+
+ # powerset modes
+ test_print_accept "ptype pm1" \
+ "POWERSET SET \[(\]p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\[)\]" \
+ "print powerset mode 1"
+ test_print_accept "ptype pm2" "POWERSET byte \\(1:8\\)" \
+ "print powerset mode 2"
+ test_print_accept "ptype pm3" "POWERSET int \\(-32768:32767\\)" \
+ "print powerset mode 3"
+ test_print_accept "ptype pm4" "POWERSET long \\(-32768:32768\\)" \
+ "print powerset mode 4"
+ test_print_accept "ptype pm5" \
+ "POWERSET long \\(-2147483648:2147483647\\)" \
+ "print powerset mode 5"
+
+ # reference modes
+ test_print_accept "ptype ref1" "REF pm1" \
+ "print reference to powerset mode"
+ test_print_accept "ptype ref2" "REF byte" \
+ "print reference to byte"
+ test_print_accept "ptype ref3" "PTR" \
+ "print free reference type"
+
+ # procedure modes
+ # FIXME: we have to talk about this ...
+ test_print_accept "ptype prm1" \
+ "REF PROC \[(\]\[)\]" \
+ "print procedure mode 1"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype prm2" \
+ "REF PROC \[(\]bool in, int out long inout\[)\] RETURNS \[(\]char\[)\]" \
+ "print procedure mode 2"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype prm3" \
+ "REF PROC \[(\]pm1, ref loc\[)\] RETURNS \[(\]ref3\[)\]" \
+ "print procedure mode 3"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype prm4" \
+ "\[(\] \[)\] EXCEPTIONS \[(\]ex1, ex2, ex3\[)\]" \
+ "print procedure mode 4"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype prm5" \
+ "REF PROC \[(\]r11, r16 inout, r5 out\[)\] RETURNS \[(\]r2\[)\] EXCEPTIONS \[(\]ex1\[)\]" \
+ "print procedure mode 5"
+
+ # synchronization modes
+ # FIXME: since gdb doesn't process events & buffers so far, this has be
+ # filled later...
+ xfail "synchronization mode handling"
+
+ # timing modes
+ test_print_accept "ptype DURATION" "duration"
+ test_print_accept "ptype TIME" "time"
+
+ # string modes
+ # some tests are done in chillvars.exp
+ test_print_accept "ptype strm1" "CHARS \\(5\\)" "print char string mode"
+ test_print_accept "ptype strm2" "CHARS \[(\]7\[)\] VARYING" \
+ "print varying char string mode"
+ test_print_accept "ptype bstr1" "BOOLS \\(20\\)" "print bit string mode"
+
+ test_print_accept "ptype B'000'" "BOOLS \\(3\\)" "bit string literal"
+ test_print_accept "ptype B'11110000'" "BOOLS \\(8\\)" "bit string literal"
+ # FIXME: adjust error message
+ gdb_test "ptype B'00110211'" {.*Too-large digit.*[.]} \
+ "reject invalid bitstring"
+
+ # array modes
+ # some tests are done in chillvars.exp
+ test_print_accept "ptype arr1m" "ARRAY \\(1:100\\) set1" \
+ "print array mode 1"
+ test_print_accept "ptype arr2m" "ARRAY \\(1:100\\) ARRAY \\(1:100\\) set1"\
+ "print array mode 2"
+ test_print_accept "ptype arr3m" "ARRAY \\(0:255\\) ARRAY \\(0:65535\\) ARRAY \\(-128:127\\) set1" \
+ "print array mode 3"
+ setup_xfail "*-*-*"
+ 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\[)\]" \
+ "print array mode 4"
+
+ # structure modes
+ # some checks are in chillvars.exp
+ setup_xfail "*-*-*"
+ 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.*\\)" \
+ "print structure mode 1"
+ setup_xfail "*-*-*"
+ 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.*\\)" \
+ "print structure mode 2"
+ setup_xfail "*-*-*"
+ test_print_accept "ptype stru3m" "STRUCT \\(.*f nset1\\(na = 1, na = 1\\),.*CASE f OF.*\\(na\\):.*ch1 CHARS\\(20\\).*ESAC.*\\)" \
+ "print structure mode 3"
+
+
+ if $passcount then {
+ pass "$passcount correct modes printed"
+ }
+}
+
+# various tests if locations are treated correctly
+# read access using ptype, print, whatis
+proc test_locations {} {
+ global passcount
+
+ set passcount 0
+ verbose "testing read access to locations"
+ # various location tests can be found in chillvars.exp
+
+ # set locations
+ test_print_accept "ptype s1l" "SET \\(a, b, c\\)" \
+ "print mode of set location"
+ test_print_accept "whatis s1l" "set1" \
+ "print modename of set location"
+ test_print_accept "print s1l" "c" "print set location"
+ test_print_accept "ptype s2l" "SET \\(na = 1, nb = 34, nc = 20\\)" \
+ "print mode of numbered set location"
+ test_print_accept "whatis s2l" "nset1" \
+ "print mode name of numbered set location"
+ test_print_accept "print s2l" "nb" "print numberes set location"
+
+ # range modes
+ test_print_accept "ptype rl1" "ubyte \\(0:255\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl1" "r11" \
+ "print mode name of range location"
+ test_print_accept "print rl1" "3" \
+ "print range location"
+
+ test_print_accept "ptype rl2" "ubyte \\(0:255\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl2" "r11" \
+ "print mode name of range location"
+ test_print_accept "print rl2" "0" \
+ "print range location"
+
+ test_print_accept "ptype rl3" "ubyte \\(0:255\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl3" "r11" \
+ "print mode name of range location"
+ test_print_accept "print rl3" "255" \
+ "print range location"
+
+ test_print_accept "ptype rl5" "uint \\(0:65535\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl5" "r12" \
+ "print mode name of range location"
+ test_print_accept "print rl5" "65530" \
+ "print range location"
+
+ test_print_accept "ptype rl6" "uint \\(0:65535\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl6" "r12" \
+ "print mode name of range location"
+ test_print_accept "print rl6" "0" \
+ "print range location"
+
+ test_print_accept "ptype rl7" "uint \\(0:65535\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl7" "r12" \
+ "print mode name of range location"
+ test_print_accept "print rl7" "65535" \
+ "print range location"
+
+# test_print_accept "ptype rl9" "ulong \\(0:4294967295\\)" \
+# "print mode of range location"
+# test_print_accept "whatis rl9" "r13" \
+# "print mode name of range location"
+# test_print_accept "print rl9" "128" \
+# "print range location"
+
+# test_print_accept "ptype rl10" "ulong \\(0:4294967295\\)" \
+# "print mode of range location"
+# test_print_accept "whatis rl10" "r13" \
+# "print mode name of range location"
+# test_print_accept "print rl10" "0" \
+# "print range location"
+
+# test_print_accept "ptype rl11" "ulong \\(0:4294967295\\)" \
+# "print mode of range location"
+# test_print_accept "whatis rl11" "r13" \
+# "print mode name of range location"
+# test_print_accept "print rl11" "4294967295" \
+# "print range location"
+
+ test_print_accept "ptype rl13" "byte \\(-128:127\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl13" "r14" \
+ "print mode name of range location"
+ test_print_accept "print rl13" "-121" \
+ "print range location"
+
+ test_print_accept "ptype rl14" "byte \\(-128:127\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl14" "r14" \
+ "print mode name of range location"
+ test_print_accept "print rl14" "-128" \
+ "print range location"
+
+ test_print_accept "ptype rl15" "byte \\(-128:127\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl15" "r14" \
+ "print mode name of range location"
+ test_print_accept "print rl15" "127" \
+ "print range location"
+
+ test_print_accept "ptype rl17" "int \\(-32768:32767\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl17" "r15" \
+ "print mode name of range location"
+ test_print_accept "print rl17" "-32720" \
+ "print range location"
+
+ test_print_accept "ptype rl18" "int \\(-32768:32767\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl18" "r15" \
+ "print mode name of range location"
+ test_print_accept "print rl18" "-32768" \
+ "print range location"
+
+ test_print_accept "ptype rl19" "int \\(-32768:32767\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl19" "r15" \
+ "print mode name of range location"
+ test_print_accept "print rl19" "32767" \
+ "print range location"
+
+ test_print_accept "ptype rl21" "long \\(-2147483648:2147483647\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl21" "r16" \
+ "print mode name of range location"
+ test_print_accept "print rl21" "2147483643" \
+ "print range location"
+
+ test_print_accept "ptype rl22" "long \\(-2147483648:2147483647\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl22" "r16" \
+ "print mode name of range location"
+ test_print_accept "print rl22" "-2147483648" \
+ "print range location"
+
+ test_print_accept "ptype rl23" "long \\(-2147483648:2147483647\\)" \
+ "print mode of range location"
+ test_print_accept "whatis rl23" "r16" \
+ "print mode name of range location"
+ test_print_accept "print rl23" "2147483647" \
+ "print range location"
+
+ # powerset locations
+ test_print_accept "ptype pl1" \
+ "POWERSET SET \\(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10\\)" \
+ "print mode of powerset location 1"
+ test_print_accept "whatis pl1" "pm1" \
+ "print mode mode name of powerset location"
+ test_print_accept "print pl1" \
+ "\[\[\]p1:p10\[\]\]" \
+ "print powerset location 1"
+ test_print_accept "print pl2" {\[\]} \
+ "print powerset location 2"
+ test_print_accept "print pl3" "\[\[\]p1, p10\[\]\]" \
+ "print powerset location 3"
+ test_print_accept "print pl4" {\[p1:p2, p4:p6, p8:p10\]} \
+ "print powerset location 4"
+ test_print_accept "print pl5" {\[p1:p4, p6, p8:p10\]} \
+ "print powerset location 5"
+ test_print_accept "print pl6" {\[p1, p3:p8, p10\]} \
+ "print powerset location 6"
+
+ test_print_accept "ptype pl7" \
+ "POWERSET byte \\(1:8\\)" \
+ "print mode of byte powerset location"
+ test_print_accept "whatis pl7" "pm2" \
+ "print modename of byte powerset location"
+ test_print_accept "print pl7" {\[1:8\]} \
+ "print powerset location 7"
+
+ test_print_accept "ptype pl8" \
+ "POWERSET int \\(-32768:32767\\)" \
+ "print mode of int powerset location"
+ test_print_accept "whatis pl8" "pm3" \
+ "print modename of int powerset location"
+ test_print_accept "print pl8" {\[-32768:32767\]} \
+ "print powerset location 8"
+
+# test_print_accept "ptype pl9" \
+# "POWERSET long \\(-2147483648:2147483647\\)" \
+# "print mode of long powerset location"
+# test_print_accept "whatis pl9" "pm5" \
+# "print modename of long powerset location"
+# test_print_accept "print pl9" {\[-2147483648:2147483647\]} \
+# "print powerset location 9"
+
+ # reference modes
+ test_print_accept "ptype ref3l" "PTR" "print mode of reference location"
+ test_print_accept "whatis ref3l" "ref3" \
+ "print modename of reference location"
+ test_print_accept "print ref3l" "ref3\\(H'.*\\)" \
+ "print reference location"
+ test_print_accept "ptype ref4l" "PTR" "print mode of reference location"
+ test_print_accept "whatis ref4l" "ref4" \
+ "print modename of reference location"
+ test_print_accept "print ref4l" "ref4\\(H'.*\\)" \
+ "print reference location"
+ test_print_accept "ptype ref5l" "PTR" "print mode of reference location"
+ test_print_accept "whatis ref5l" "PTR" \
+ "print modename of reference location"
+ test_print_accept "print ref5l" "PTR\\(H'.*\\)" \
+ "print reference location"
+
+ # dereference a little bit..
+ test_print_accept "print ref6l->syn_int" "42" \
+ "dereference reference to synmode location"
+ test_print_accept "print ref7l->int" "-42" \
+ "dereference reference to predefined mode location"
+ test_print_accept "print ref8l->pm1" \
+ "\[\[\]p1:p10\[\]\]" \
+ "dereference reference to newmode location"
+
+ # synchronization mode locations
+ # FIXME: synchronization modes are not supported so far...
+ xfail "no synchronization mode location support, not implemented yet"
+
+ # timing mode locations
+ # FIXME: callbacks to abstime, inttime not implemented
+ xfail "timing modes not implemented properly yet"
+
+ # char string locations
+ # some tests are don in chillvars.exp
+ test_print_accept "ptype strl1" \
+ "CHARS \\(7\\) VARYING" \
+ "print varying string location"
+ test_print_accept "whatis strl1" "strm2" \
+ "print string locationa mode name"
+ test_print_accept "print strl1" \
+ "\"hansi\"//c\"00\"" \
+ "print string location"
+ # string elements
+ test_print_accept "print strl1(0)" "\'h\'" \
+ "print string element 1"
+ test_print_accept "print strl1(5)" "C\'00\'" \
+ "print string element 2"
+ test_print_accept "print strl1(3)" "\'s\'" \
+ "print string element 3"
+ test_print_accept "ptype strl1(0)" "char" \
+ "print mode of string element"
+ # slices
+ test_print_accept "print strl1(3:4)" "\"si\"" \
+ "print string slice 1"
+ test_print_accept "print strl1(0:5)" \
+ "\"hansi\"//c\"00\"" \
+ "print string slice 2"
+ test_print_accept "print strl1(0:0)" "\"h\"" \
+ "print string slice 3"
+ test_print_accept "print strl1(0 up 6)" \
+ "\"hansi\"//c\"00\"" \
+ "print string slice 4"
+ # FIXME: adjust error message, when implented
+ gdb_test "print strl1(6 up 1)" \
+ ".*slice.*out of range.*" \
+ "print invalid string slice length"
+ gdb_test "print strl1(-1 up 5)" \
+ ".*slice.*out of range.*" \
+ "print invalid string slice length"
+ gdb_test "print strl1(-1:5)" \
+ ".*slice.*out of range.*" \
+ "print invalid string slice"
+ test_print_accept_exact "print strl1(-1:7)" \
+ ".*slice.*out of range.*" \
+ "print invalid string slice"
+ gdb_test "print strl1(0 up -1)" \
+ ".*slice.*out of range.*" \
+ "print invalid string slice length"
+ gdb_test "print strl1(0 up 0)" {""}
+
+ # bitstring locations
+ test_print_accept "ptype bstr1" \
+ "BOOLS \\(20\\)" \
+ "print mode of bitstring location"
+ test_print_accept "whatis bstrl1" "bstr1" \
+ "print mode name of bitstring location"
+ test_print_accept "print bstrl1" \
+ "B'10101010101010101010'" \
+ "print bitstring location"
+
+ test_print_accept "ptype bstrl1(0)" "bool|BOOL" \
+ "print mode of bitstring element"
+ test_print_accept "print bstrl1(0)" "TRUE" \
+ "print bitstring element 1"
+ test_print_accept "print bstrl1(19)" "FALSE" \
+ "print bitstring element 2"
+ test_print_accept "print bstrl1(10)" "TRUE" \
+ "print bitstring element 3"
+
+ test_print_accept "print bstrl1(0:19)" \
+ "B'10101010101010101010'" \
+ "print bitstring location slice 1"
+ test_print_accept "print bstrl1(0:0)" \
+ "B'1'" \
+ "print bitstring location slice 2"
+ test_print_accept "print bstrl1(3:9)" \
+ "B'0101010'" \
+ "print bitstring location slice 3"
+ test_print_accept "print bstrl1(0 up 20)" \
+ "B'10101010101010101010'" \
+ "print bitstring location slice 4"
+ test_print_accept "print bstrl1(19 up 1)" \
+ "B'0'" \
+ "print bitstring location slice 5"
+ gdb_test "print bstrl1(20 up 1)" \
+ ".*slice out of range.*" \
+ "print invalid bitstring slice (20 up 1)"
+ gdb_test "print bstrl1(-4:5)" \
+ ".*slice out of range.*" \
+ "print invalid bitstring slice (-4:5)"
+ gdb_test "print bstrl1(-1:up 1)" \
+ ".*invalid expression syntax.*" \
+ "print invalid bitstring slice (-1:ip 1)"
+ gdb_test "print bstrl1(-1:20)" \
+ ".*slice out of range.*" \
+ "print invalid bitstring slice (-1:20)"
+ gdb_test "print bstrl1(0 up -1)" \
+ ".*slice out of range.*" \
+ "print invalid bitstring slice (0 up -1)"
+ test_print_accept "print bstrl1(4 up 0)" "B''"
+
+ # array mode locations
+ gdb_test_exact "ptype arrl1" \
+ "ARRAY (1:100) set1" \
+ "print mode of array location"
+ gdb_test "whatis arrl1" "arr1m" \
+ "print mode name of array location"
+ gdb_test_exact "print arrl1" {[(1:100): a]} \
+ "print array location"
+ test_print_accept "ptype arrl1(1)" \
+ "SET \\(a, b, c\\)" \
+ "print mode of array element"
+ gdb_test_exact "print arrl3" \
+ {[(1:5): [(1:3): [(1:2): -2147483648]]]} \
+ "print array location 2"
+ gdb_test_exact "print arrl3(1)" \
+ {[(1:3): [(1:2): -2147483648]]} \
+ "print array location 3"
+ gdb_test_exact "ptype arrl3(1)" \
+ {ARRAY (1:3) ARRAY (1:2) long} \
+ "print mode of array element"
+ test_print_accept "print arrl3(5)" \
+ {\[\(1:3\): \[\(1:2\): -2147483648\]\]} \
+ "print array location 4"
+ test_print_accept "print arrl3(1,1)" \
+ {\[\(1:2\): -2147483648\]} \
+ "print array location 5"
+ test_print_accept "ptype arrl3(1,1)" \
+ {ARRAY \(1:2\) long} \
+ "print mode of array element"
+ test_print_accept "print arrl3(5,3)" \
+ {\[\(1:2\): -2147483648\]} \
+ "print array location 6"
+ test_print_accept "print arrl3(1,1,1)" \
+ "-2147483648" \
+ "print array location 7"
+ test_print_accept "print arrl3(5,3,2)" \
+ "-2147483648" \
+ "print array location 8"
+ test_print_accept "print arrl3(1)(3)(2)" \
+ "-2147483648" \
+ "print array location 9"
+
+ # reject the following range fails
+ # FIXME: adjust error messages
+ test_print_accept_exact "print arrl3(-1)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 1"
+ test_print_accept_exact "print arrl3(6)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 2"
+ test_print_accept_exact "print arrl3(0,0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 3"
+ test_print_accept_exact "print arrl3(1,0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 4"
+ test_print_accept_exact "print arrl3(1,4)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 5"
+ test_print_accept_exact "print arrl3(6,4)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 6"
+ test_print_accept_exact "print arrl3(1,1,0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 7"
+ test_print_accept_exact "print arrl3(6,4,0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 8"
+ test_print_accept_exact "print arrl3(1,1,3)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 9"
+
+ test_print_accept_exact "print arrl3(0)(0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 10"
+ test_print_accept_exact "print arrl3(1)(0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 11"
+ test_print_accept_exact "print arrl3(1)(4)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 12"
+ test_print_accept_exact "print arrl3(6)(4)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 13"
+ test_print_accept_exact "print arrl3(1)(1)(0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 14"
+ test_print_accept_exact "print arrl3(6)(4)(0)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 15"
+ test_print_accept_exact "print arrl3(1)(1)(3)" \
+ ".* array or string index out of range.*" \
+ "check invalid array indices 16"
+
+ # slices
+ test_print_accept "print arrl4(1:3)" \
+ {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\]\]} \
+ "print array slice 1"
+ test_print_accept "ptype arrl4(1:3)" \
+ {ARRAY \(1:3\) ARRAY \(1:3\) ARRAY \(1:2\) long} \
+ "print mode of array slice"
+# The next one is bogus:
+# test_print_accept "print arrl4(5, 2:3, 1)" \
+# # FIXME: maybe the '(1): ' in the inner tupel should be omitted ? \
+# {\[(2): \[\(1\): 100\], \(3\):\[\(1\): 100\]\]} \
+# "print array slice 2"
+ test_print_accept "print arrl4(1 up 4)" \
+ {\[\(1:2\): \[\(1:3\): \[\(1:2\): -2147483648\]\], \(3\): \[\(1:3\): \[\(1:2\): 100\]\], \(4\): \[\(1:3\): \[\(1:2\): -2147483648\]\]\]} \
+ "print array slice 3"
+# The next two are bogus:
+# test_print_accept "print arrl4(3, 2 up 1)" \
+# {\[\(2:3\): \[\(1:2\): 100\]\]} \
+# "print array slice 4"
+# test_print_accept "print arrl4(1:2, 1 up 1, 2)" \
+# {\[\(1\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\], \(2\): \[\(1\): \[\(2\): -2147483648\], \(2\): \[\(2\): -2147483648\]\]\]} \
+# "print array slice 4"
+ # reject invalid slices
+ # FIXME: adjust error messages
+ test_print_accept_exact "print arrl4(5:6)" \
+ ".*slice out of range.*" \
+ "check invalid range 1"
+ test_print_accept_exact "print arrl4(0:1)" \
+ ".*slice out of range.*" \
+ "check invalid range 2"
+ test_print_accept_exact "print arrl4(0:6)" \
+ ".*slice out of range.*" \
+ "check invalid range 3"
+ gdb_test "print arrl4(3:2)" \
+ ".*slice out of range.*" \
+ "check invalid range 4"
+ gdb_test "print arrl4(1,3:4)" \
+ ".*syntax error.*" \
+ "check invalid range 5"
+ gdb_test "print arrl4(1,0:1)" \
+ ".*syntax error.*" \
+ "check invalid range 6"
+ gdb_test "print arrl4(1,0:4)" \
+ ".*syntax error.*" \
+ "check invalid range 7"
+ gdb_test "print arrl4(1,3:2)" \
+ ".*syntax error.*" \
+ "check invalid range 8"
+ gdb_test "print arrl4(5 up 2)" \
+ ".*slice out of range.*" \
+ "check invalid range 9"
+ gdb_test "print arrl4(-1 up 1)" \
+ ".*slice out of range.*" \
+ "check invalid range 10"
+ gdb_test "print arrl4(-1 up 7)" \
+ ".*slice out of range.*" \
+ "check invalid range 11"
+ gdb_test "print arrl4(1 up 0)" \
+ ".*slice out of range.*" \
+ "check invalid range 12"
+ gdb_test "print arrl4(1,3 up 1)" \
+ ".*syntax error.*" \
+ "check invalid range 13"
+ gdb_test "print arrl4(1,-1 up 1)" \
+ ".*syntax error.*" \
+ "check invalid range 14"
+ gdb_test "print arrl4(1,-1 up 5)" \
+ ".*syntax error.*" \
+ "check invalid range 15"
+ gdb_test "print arrl4(1,2 up 0)" \
+ ".*syntax error.*" \
+ "check invalid range 16"
+
+ # structure modes
+ # some tests are in chillvars.exp
+ # FIXME: no tag processing implemented do maybe adjust these tests
+ setup_xfail "*-*-*"
+ 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.*\\)" \
+ "print mode of structure location 1"
+ test_print_accept "whatis strul1" "stru1m" \
+ "print mode name of structure location 1"
+ setup_xfail "*-*-*"
+ test_print_accept "print strul1" \
+ {\[\.a: -2147483648, \.b: 42, \.\(b\): \{\(42\) = \[\.ch1: \"12345678900987654321\"\], \(52\) = \[\.ch2: \"1234567890\"\], (else) = \[\.ch3: \"1\"\]\}\]} \
+ "print structure location 1"
+ test_print_accept "print strul1.a" \
+ "-2147483648" \
+ "print field of structure location 1"
+ test_print_accept "print strul1.b" "42" \
+ "print field of structure location 1"
+ test_print_accept "print strul1.ch1" \
+ "\"12345678900987654321\"" \
+ "print field of structure location 1"
+ setup_xfail "*-*-*"
+ test_print_accept "print strul1.ch2" \
+ "\"1234567890\".*warning: tag field value does'nt match" \
+ "print field of structure location 1"
+ setup_xfail "*-*-*"
+ test_print_accept "print strul1.ch3" \
+ "\"1\".*warning: tag field value does'nt match" \
+ "print field of structure location 1"
+
+ if $passcount then {
+ pass "$passcount correct locations printed"
+ }
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+
+if [set_lang_chill] then {
+ test_modes
+ test_locations
+} else {
+ warning "$test_name tests suppressed."
+}
diff --git a/gdb/testsuite/gdb.chill/tests2.ch b/gdb/testsuite/gdb.chill/tests2.ch
new file mode 100644
index 0000000..1596f3b
--- /dev/null
+++ b/gdb/testsuite/gdb.chill/tests2.ch
@@ -0,0 +1,193 @@
+-- Copyright (C) 1992 Free Software Foundation, Inc.
+
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program; if not, write to the Free Software
+-- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+-- Please email any bugs, comments, and/or additions to this file to:
+-- bug-gdb@prep.ai.mit.edu
+
+--
+-- test program 2 (refer to tests2.exp)
+--
+
+tests2: module;
+
+-- testpattern
+syn pat1 ulong = H'aaaaaaaa;
+syn pat2 ulong = H'55555555;
+
+-- discrete modes
+newmode bytem = struct (
+ p1 ulong,
+ m byte,
+ p2 ulong);
+newmode ubytem = struct (
+ p1 ulong,
+ m ubyte,
+ p2 ulong);
+newmode intm = struct (
+ p1 ulong,
+ m int,
+ p2 ulong);
+newmode uintm = struct (
+ p1 ulong,
+ m uint,
+ p2 ulong);
+newmode longm = struct (
+ p1 ulong,
+ m long,
+ p2 ulong);
+newmode ulongm = struct (
+ p1 ulong,
+ m ulong,
+ p2 ulong);
+newmode boolm = struct (
+ p1 ulong,
+ m bool,
+ p2 ulong);
+newmode charm1 = struct (
+ p1 ulong,
+ m char(4),
+ p2 ulong);
+newmode charm2 = struct (
+ p1 ulong,
+ m char(7),
+ p2 ulong);
+newmode charm3 = struct (
+ p1 ulong,
+ m char(8) varying,
+ p2 ulong);
+newmode charm4 = struct (
+ p1 ulong,
+ m char,
+ p2 ulong);
+newmode bitm1 = struct (
+ p1 ulong,
+ m bit(8),
+ p2 ulong);
+newmode bitm2 = struct (
+ p1 ulong,
+ m bit(10),
+ p2 ulong);
+newmode setm1 = struct (
+ p1 ulong,
+ m set (a, b, c, d, e, f, g, h),
+ p2 ulong);
+newmode nset1 = struct (
+ p1 ulong,
+ m set (na = 2147483648, nb = 1024, nc = 4294967295),
+ p2 ulong);
+newmode rm1 = struct (
+ p1 ulong,
+ m range (lower(byte):upper(byte)),
+ p2 ulong);
+newmode rm2 = struct (
+ p1 ulong,
+ m range (lower(int):upper(int)),
+ p2 ulong);
+newmode rm3 = struct (
+ p1 ulong,
+ m range (lower(long):upper(long)),
+ p2 ulong);
+newmode pm1 = struct (
+ p1 ulong,
+ m powerset set (pa, pb, pc, pd, pe, pf, pg, ph),
+ p2 ulong);
+newmode pm2 = struct (
+ p1 ulong,
+ m powerset int (1:32),
+ p2 ulong);
+-- this should be rejected by the gnuchill compiler !
+newmode pm3 = struct (
+ p1 ulong,
+-- m powerset long (lower(long): upper(long)),
+ p2 ulong);
+newmode refm1 = struct (
+ p1 ulong,
+ m ptr,
+ p2 ulong);
+newmode refm2 = struct (
+ p1 ulong,
+ m ref bytem,
+ p2 ulong);
+newmode prm1 = struct (
+ p1 ulong,
+ m proc (),
+ p2 ulong);
+newmode tim1 = struct (
+ p1 ulong,
+ m time,
+ p2 ulong);
+newmode tim2 = struct (
+ p1 ulong,
+ m duration,
+ p2 ulong);
+newmode rem1 = struct (
+ p1 ulong,
+ m real,
+ p2 ulong);
+newmode rem2 = struct (
+ p1 ulong,
+ m long_real,
+ p2 ulong);
+newmode arrm1 = struct (
+ p1 ulong,
+ m array(1:3, 1:2) int,
+ p2 ulong);
+newmode strum1 = struct (
+ p1 ulong,
+ m struct (a, b int, ch char(4)),
+ p2 ulong);
+
+
+-- dummyfunction for breakpoints
+dummyfunc: proc();
+end dummyfunc;
+
+
+dcl b1 bytem init := [pat1, -128, pat2];
+dcl ub1 ubytem init := [pat1, 0, pat2];
+dcl i1 intm init := [pat1, -32768, pat2];
+dcl ui1 uintm init := [pat1, 0, pat2];
+dcl l1 longm init := [pat1, -2147483648, pat2];
+dcl ul1 ulongm init := [pat1, 0, pat2];
+dcl bo1 boolm init := [pat1, true, pat2];
+dcl c1 charm1 init := [pat1, "1234", pat2];
+dcl c2 charm2 init := [pat1, "1234567", pat2];
+dcl c3 charm3 init := [pat1, "12345678", pat2];
+dcl c4 charm4 init := [pat1, C'00', pat2];
+dcl bi1 bitm1 init := [pat1, B'01011010', pat2];
+dcl bi2 bitm2 init := [pat1, B'1010110101', pat2];
+dcl se1 setm1 init := [pat1, a, pat2];
+dcl nse1 nset1 init := [pat1, na, pat2];
+dcl r1 rm1 init := [pat1, -128, pat2];
+dcl r2 rm2 init := [pat1, -32768, pat2];
+dcl r3 rm3 init := [pat1, -2147483648, pat2];
+dcl p1 pm1 init := [pat1, [pa], pat2];
+dcl p2 pm2 init := [pat1, [1], pat2];
+-- dcl p3 pm3 init := [pat1, [-1], pat2]; -- FIXME: bug in gnuchill
+dcl ref1 refm1 init := [pat1, null, pat2];
+dcl ref2 refm2 init := [pat1, null, pat2];
+dcl pr1 prm1;
+dcl ti1 tim1 init := [pat1, 0, pat2];
+dcl ti2 tim2 init := [pat1, 0, pat2];
+dcl re1 rem1 init := [pat1, 0.0, pat2];
+dcl re2 rem2 init := [pat1, 0.0, pat2];
+dcl arrl1 arrm1 init:=[pat1, [(1:3): [0,0]], pat2];
+dcl strul1 strum1 init := [pat1, [.a: 0, .b: 0, .ch: "0000"], pat2];
+
+pr1 := [pat1, dummyfunc, pat2];
+dummyfunc();
+
+end tests2;
diff --git a/gdb/testsuite/gdb.chill/tests2.exp b/gdb/testsuite/gdb.chill/tests2.exp
new file mode 100644
index 0000000..dcc29ce
--- /dev/null
+++ b/gdb/testsuite/gdb.chill/tests2.exp
@@ -0,0 +1,362 @@
+# Copyright (C) 1992, 1995 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# Set the current language to chill. This counts as a test. If it
+# fails, then we skip the other tests.
+
+proc set_lang_chill {} {
+ global prompt
+ global binfile objdir subdir
+
+ if ![file exists $objdir/$subdir/$binfile] then {
+ return 0
+ }
+ verbose "loading file '$objdir/$subdir/$binfile'"
+ gdb_load $objdir/$subdir/$binfile
+
+ send "set language chill\n"
+ expect {
+ -re ".*$prompt $" {}
+ timeout { fail "set language chill (timeout)" ; return 0 }
+ }
+
+ send "show language\n"
+ expect {
+ -re ".* source language is \"chill\".*$prompt $" {
+ pass "set language to \"chill\""
+ send "break dummyfunc\n"
+ expect {
+ -re ".*$prompt $" {
+ send "run\n"
+ expect -re ".*$prompt $" {}
+ return 1
+ }
+ timeout {
+ fail "can't set breakpoint (timeout)"
+ return 0
+ }
+ }
+ }
+ -re ".*$prompt $" {
+ fail "setting language to \"chill\""
+ return 0
+ }
+ timeout {
+ fail "can't show language (timeout)"
+ return 0
+ }
+ }
+}
+
+# Testing printing of a specific value. Increment passcount for
+# success or issue fail message for failure. In both cases, return
+# a 1 to indicate that more tests can proceed. However a timeout
+# is a serious error, generates a special fail message, and causes
+# a 0 to be returned to indicate that more tests are likely to fail
+# as well.
+#
+# Args are:
+#
+# First one is string to send to gdb
+# Second one is string to match gdb result to
+# Third one is an optional message to be printed
+
+proc test_print_accept { args } {
+ global prompt
+ global passcount
+ global verbose
+
+ if [llength $args]==3 then {
+ set message [lindex $args 2]
+ } else {
+ set message [lindex $args 0]
+ }
+ set sendthis [lindex $args 0]
+ set expectthis [lindex $args 1]
+ if $verbose>2 then {
+ send_user "Sending \"$sendthis\" to gdb\n"
+ send_user "Looking to match \"$expectthis\"\n"
+ send_user "Message is \"$message\"\n"
+ }
+ send "$sendthis\n"
+ expect {
+ -re ".* = $expectthis\r\n$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$prompt $" {
+ if ![string match "" $message] then {
+ fail "$sendthis ($message)"
+ } else {
+ fail "$sendthis"
+ }
+ return 1
+ }
+ timeout {
+ fail "$sendthis (timeout)"
+ return 0
+ }
+ }
+}
+
+# Testing printing of a specific value. Increment passcount for
+# success or issue fail message for failure. In both cases, return
+# a 1 to indicate that more tests can proceed. However a timeout
+# is a serious error, generates a special fail message, and causes
+# a 0 to be returned to indicate that more tests are likely to fail
+# as well.
+
+proc test_print_reject { args } {
+ global prompt
+ global passcount
+ global verbose
+
+ if [llength $args]==2 then {
+ set expectthis [lindex $args 1]
+ } else {
+ set expectthis "should never match this bogus string"
+ }
+ set sendthis [lindex $args 0]
+ if $verbose>2 then {
+ send_user "Sending \"$sendthis\" to gdb\n"
+ send_user "Looking to match \"$expectthis\"\n"
+ }
+ send "$sendthis\n"
+ expect {
+ -re ".*A .* in expression.*\\.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*Junk after end of expression.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*No symbol table is loaded.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$expectthis.*$prompt $" {
+ incr passcount
+ return 1
+ }
+ -re ".*$prompt $" {
+ fail "$sendthis not properly rejected"
+ return 1
+ }
+ timeout {
+ fail "$sendthis (timeout)"
+ return 0
+ }
+ }
+}
+
+# checks if structure was accessed correctly
+proc test_write { args } {
+ global prompt
+ global passcount
+
+ if [llength $args]==5 then {
+ set message [lindex $args 4]
+ set extended [lindex $args 3]
+ set matchval [lindex $args 2]
+ } elseif [llength $args]==4 then {
+ set message [lindex $args 3]
+ set matchval [lindex $args 2]
+ set extended ""
+ } elseif [llength $args]==3 then {
+ set message [lindex $args 2]
+ set extended ""
+ } else {
+ warning "test ($args) write called with wrong number of arguments"
+ return
+ }
+
+ set location [lindex $args 0]
+ set value [lindex $args 1]
+ if ![info exists matchval] then {
+ set matchval $value
+ }
+ verbose "loc: $location, val: $value, msg: $message, ext: $extended, match: $matchval"
+
+ verbose "setting var $value..."
+ send "set var $location.m$extended := $value\n"
+ expect -re ".*$prompt $" {}
+ test_print_accept "print $location" \
+ "\[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]" \
+ "$message"
+}
+
+# test write access from gdb (setvar x:=y) from gdb
+proc write_access { } {
+ global passcount
+
+ set passcount 0
+ verbose "testing write access to locations"
+
+ # discrete modes
+ test_write b1 127 "byte write 1"
+ test_write b1 -128 "byte write 2"
+ test_write b1 0 "byte write 3"
+ test_write ub1 255 "ubyte write 1"
+ test_write ub1 0 "ubyte write 2"
+ test_write ub1 42 "ubyte write 3"
+ test_write i1 32767 "int write 1"
+ test_write i1 -32768 "int write 2"
+ test_write i1 0 "int write 3"
+ test_write ui1 65535 "uint write 1"
+ test_write ui1 0 "uint write 2"
+ test_write ui1 123 "uint write 3"
+ test_write l1 2147483647 "long write 1"
+ test_write l1 -2147483648 "long write 2"
+ test_write l1 0 "long write 3"
+ test_write ul1 4294967295 "ulong write 1"
+ test_write ul1 0 "ulong write 2"
+ test_write ul1 1000000 "ulong write 3"
+ test_write bo1 FALSE "bool write 1"
+ test_write bo1 TRUE "bool write 2"
+ test_write c1 \"1234\" "char write 1"
+ test_write c2 \"1234567\" "char write 2"
+ test_write c3 \"654321\" "char write 3"
+ test_write c4 C'65' 'e' "char write 4"
+ test_write bi1 B'10100101' "bitstring write 1"
+ test_write bi2 B'0101001010' "bitstring write 2"
+ test_write se1 a "set write 1"
+ test_write se1 h "set write 2"
+ # The following two use numbered sets with too-large values.
+ setup_xfail "*-*-*"
+ test_write nse1 nb "numbered set write 1"
+ setup_xfail "*-*-*"
+ test_write nse1 nc "numbered set write 2"
+ test_write r1 127 "range write 1"
+ test_write r2 32767 "range write 2"
+ test_write r3 2147483647 "range write 3"
+
+ # powerset modes
+ test_write p1 {[pa:ph]} {\[pa:ph\]} "powerset write 1"
+ test_write p1 {[pa, pc:pf, ph]} {\[pa, pc:pf, ph\]} "powerset write 2"
+ test_write p1 {[pa, pc, pe, pg]} {\[pa, pc, pe, pg\]} "powerset write 3"
+ test_write p1 {[]} {\[\]} "powerset write 4"
+ test_write p2 {[1:32]} {\[1:32\]} "powerset write 5"
+ test_write p2 {[1, 3:30, 32]} {\[1, 3:30, 32\]} "powerset write 6"
+ test_write p2 {[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31]} {\[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31\]} \
+ "powerset write 7"
+ test_write p2 {[]} {\[\]} "powerset write 8"
+
+# Fixme: this should be rejected by gnuchill
+# test_write p3 {[-2147483648:2147483647]} {\[-2147483648:2147483647\]} \
+# "powerset write 9"
+# test_write p3 {[-2147483648, -1000000:1000000, 2147483647]} \
+# {\[-2147483648, -1000000:1000000, 2147483647\]} \
+# "powerset write 10"
+# test_write p3 {[-99, -97, -95, 1001, 1003, 1005]} \
+# {\[-99, -97, -95, 1001, 1003, 1005\]} "powerset write 11"
+# test_write p3 {[]} {\[\]} "powerset write 12"
+
+ # reference modes
+ test_write ref1 ->ref1 {H'[0-9a-fA-F]+} "reference write 1"
+ test_write ref2 ->b1 {H'[0-9a-fA-F]+} "reference write 2"
+ test_write ref1 NULL "reference write 3"
+ test_write ref2 NULL "reference write 4"
+
+ # procedure modes
+ test_write pr1 NULL "procefure write 1"
+ # FIXME: remove when NULL is understood
+ test_write pr1 0 NULL "procefure write 2"
+ test_write pr1 dummyfunc {H'[0-9a-fA-F]+ <dummyfunc>} "procedure write 3"
+
+ # timing modes, FIXME when callbacks to timefunctions are implemented
+ #test_write ti1 abstime(1970, 3, 12, 10, 43, 0) {} "time write 1"
+ #test_write ti2 <set somehow a duration>
+ xfail "timing modes not implemented yet"
+
+ # real modes
+ # This ones
+ test_write re1 42.03 {42.0[0-9]*} "real write 1"
+ test_write re1 0 "real write 2"
+ test_write re1 "1e+38" {1e\+38|1\.0[0-9]*e\+38|9\.9[0-9]*e\+37} \
+ "real write 3"
+ test_write re1 "1e+39" Infinity "real write 4"
+ test_write re2 42.03 {42.0[0-9]*} "real write 5"
+ test_write re2 0 "real write 6"
+ test_write re2 "1e+308" {1e\+308} "real write 7"
+ test_write re2 "1e+309" Infinity "real write 8"
+
+ # array modes
+ test_write arrl1 {[(1:3): [(1:2): -128]]} {\[\(1:3\): \[\(1:2\): -128\]\]}\
+ "array write 1"
+ test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\
+ "array write 2"
+ test_write arrl1 {[(1): [(1:2): 127], (2): [(1:2): -128], (3): [(1:2): 127]]} {\[\(1\): \[\(1:2\): 127\], \(2\): \[\(1:2\): -128\], \(3\): \[\(1:2\): 127\]\]}\
+ "array write 3"
+ test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\
+ "array write 4"
+ setup_xfail "*-*-*"
+ # Bogus test case - type mismatch?
+ test_write arrl1 {[(1): 127, (2): -128]} "array write 5"
+ test_write arrl1 {[(1:3): [(1:2): 0]]} {\[\(1:3\): \[\(1:2\): 0\]\]}\
+ "array write 6"
+
+ # structure modes
+ test_write strul1 {[.a: -32768, .b: 32767, .ch: "ZZZZ"]} \
+ {\[\.a: -32768, \.b: 32767, \.ch: \"ZZZZ\"\]} \
+ "structure write 1"
+ test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \
+ {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \
+ "structure write 2"
+ test_write strul1 -32768 {\[\.a: -32768, \.b: 0, \.ch: \"0000\"\]} \
+ {.a} "structure write 3"
+ test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \
+ {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \
+ "structure write 4"
+ test_write strul1 -32768 {\[\.a: 0, \.b: -32768, \.ch: \"0000\"\]} \
+ {.b} "structure write 5"
+ test_write strul1 {[.a: 0, .b: 0, .ch: "0000"]} \
+ {\[\.a: 0, \.b: 0, \.ch: \"0000\"\]} \
+ "structure write 6"
+ test_write strul1 \"HUGO\" {\[\.a: 0, \.b: 0, \.ch: \"HUGO\"\]} \
+ {.ch} "structure write 7"
+
+ if $passcount then {
+ pass "$passcount correct write access tests"
+ }
+}
+
+# Start with a fresh gdb.
+
+set binfile "tests2.exe"
+global passcount
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+
+if [set_lang_chill] then {
+ write_access
+} else {
+ warning "$test_name tests suppressed."
+}