diff options
author | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
commit | c906108c21474dfb4ed285bcc0ac6fe02cd400cc (patch) | |
tree | a0015aa5cedc19ccbab307251353a41722a3ae13 /gdb/testsuite/gdb.chill | |
parent | cd946cff9ede3f30935803403f06f6ed30cad136 (diff) | |
download | gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.zip gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.gz gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.bz2 |
Initial creation of sourceware repositorygdb-4_18-branchpoint
Diffstat (limited to 'gdb/testsuite/gdb.chill')
74 files changed, 7502 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.chill/ChangeLog b/gdb/testsuite/gdb.chill/ChangeLog new file mode 100644 index 0000000..9db44ea --- /dev/null +++ b/gdb/testsuite/gdb.chill/ChangeLog @@ -0,0 +1,313 @@ +Thu May 21 02:45:18 1998 Felix Lee <flee@zog.cygnus.com> + + * chexp.exp: fix tests that assume >16-bit ints. + +Wed Sep 10 15:01:55 1997 Bob Manson <manson@charmed.cygnus.com> + + * *.exp: The end-all be-all of quoting fixes. Ha. + +Thu Aug 21 10:31:23 1997 Bob Manson <manson@charmed.cygnus.com> + + * enum.exp: More quoting fixes. + * pr-9946.exp: Ditto. + * gch1280.exp: Ditto. + * gch1272.exp: Ditto. + +Tue Aug 12 21:48:08 1997 Bob Manson <manson@charmed.cygnus.com> + + * tests2.exp: Fix quoting. + * tests1.exp: Ditto. + * pr-9946.exp: Ditto. + * enum.exp: Ditto. + * builtins.exp: Ditto. + * powerset.exp: Ditto. + * misc.exp: Ditto. + * gch981.exp: Ditto. + * gch922.exp: Ditto. + * gch1280.exp: Ditto. + * gch1272.exp: Ditto. + * gch1041.exp: Ditto. + +Sat Nov 23 14:00:59 1996 Fred Fish <fnf@cygnus.com> + + * misc.exp: Change x86 linux setup_xfails to use new + i*86-pc-linux*-gnu quads. + * tuples.exp: Ditto. + * tests2.exp: Ditto. + * pr-5016.exp: Ditto. + + * tuples.exp: Add i*86-pc-linux-gnu setup_fail to existing + xfails for 'set var vs1 := [ "bar", 42, m_ps[ a ] ]', + 'set var $i := m_s1["foo", 44, m_ps[a ]]', and + 'set var vs2 := [ 10+3, m_s1[ "foo" , 42, m_ps[ b ]]]'. + +Mon Nov 11 10:27:32 1996 Fred Fish <fnf@cygnus.com> + + * callch.exp: Add mips*-sgi-irix* xfail for + "call king(a, otto[[10, 15], [20, 25]])". + * pr-8742.exp: Add mips*-sgi-irix* xfails for + "pass int powerset tuple" + "pass set powerset tuple" + "pass modeless int powerset tuple" and + "pass modeless set powerset tuple". + * tuples.exp: Add sparc-*-solaris* and sparc-*-sunos* + xfails for several "set var" commands that are failing. + Convert most of the set commands into gdb_test_exact + commands. + +Fri Oct 11 16:48:56 1996 Fred Fish <fnf@cygnus.com> + + * expstruct.exp (objfile2): Set and use, like other chill tests. + * pr-4975.exp: Ditto. + * pr-5646.exp: Ditto. + * pr-8134.exp: Ditto. + +Thu Sep 5 01:54:42 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * gch1280.exp: Enhance test case. + +Wed Sep 4 07:30:44 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * gch1272.{ch,exp}, gch1280.{ch,exp}, pr-9946.{ch,exp}: + New test cases. + +Sun Aug 18 13:29:48 1996 Fred Fish <fnf@cygnus.com> + + * tests2.exp: Remove mips-sgi-irix* setup_xfail for + "real write 4" and "real write 8". + +Mon Jun 10 14:04:05 1996 Fred Fish <fnf@cygnus.com> + + * tests1.exp (test_modes): Remove *-*-* setup_sfail for + "print unnumbered set range mode" and + "print numbered set range mode". + +Wed Apr 17 01:23:06 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * tests1.{ch,exp}: Tets case modified and enhanced. + +Tue Apr 9 01:18:04 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * gch981.{ch,exp}, gch1041.{ch,exp}: New test cases. + +Wed Mar 6 00:29:35 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * powerset.exp: Add test. + +Tue Mar 5 23:41:39 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * gch922.{ch,exp}, powerset.{ch,exp}: New test cases. + + * builtins.exp, chillvars.exp, misc.exp, tests1.exp: Updated + due to new format of nonprintable characters (control sequence + instead of C'xx'). + +Tue Mar 5 00:09:17 1996 Per Bothner <bothner@kalessin.cygnus.com> + + * string.ch, string.exp: Add tests (from Cygnus PR chill/9078). + + * pr-9095.ch, pr-9095.exp: New test case. + +Fri Feb 9 08:22:16 1996 Fred Fish <fnf@cygnus.com> + + * Makefile.in (clean): Add missing '{'. + +Tue Feb 6 21:52:26 1996 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-8894.exp, pr-8894.ch, pr-8894-grt.ch: New test case. + +Mon Jan 29 00:05:01 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * builtins.ch, builtins.exp: Enhance test case. + + * extstruct.ch, extstruct-grt.ch, extstruct.exp: New test case. + +Tue Jan 23 16:57:13 1996 Per Bothner <bothner@kalessin.cygnus.com> + + * enum.ch, enum.exp: New test case (covers PRs 8869 and 8870). + +Thu Jan 11 17:34:01 1996 Per Bothner <bothner@kalessin.cygnus.com> + + * Makefile.in (PROGS): Removed. + (clean mostlyclean): Remove *.exe rather than ${PROGS}. + + * pr-8742.ch, pr-8742.exp: New test case. + +Tue Jan 9 04:47:27 1996 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * misc.ch, misc.exp: Enhance test case. + +Sat Dec 30 15:31:59 1995 Fred Fish <fnf@cygnus.com> + + * tests2.exp: Setup_xfail "i*86-*-linux" and + "mips-sgi-irix*" for "real write 4" and "real write 8". + Conditionalize both tests for system specific value + of "infinity" string. + +Fri Dec 29 10:46:09 1995 Fred Fish <fnf@cygnus.com> + + * builtins.exp (test_size): Alpha seems to have long builtins. + * tests1.exp: Setup xfail "*-*-*" for "ptype r2". + * tests2.exp: Add check to skip chill tests. + +Mon Dec 11 16:53:40 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * tuples.ch, tuples.exp: Exhance test cases (from PR 8643). + +Mon Dec 11 06:57:07 1995 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * builtins.exp, pr-5016.{ch,exp}, result.{ch,exp}, + tests1.{ch,exp}: Enhance test cases. + +Thu Dec 7 05:16:34 1995 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * builtins.ch, builtins.exp, Makefile.in: New test case. + +Tue Dec 5 01:51:45 1995 Wilfried Moser (Alcatel) <moser@rtl.cygnus.com> + + * tests2.exp: Add compiling of the test case. + +Fri Dec 1 00:08:37 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-8405.ch, pr-8405.exp, Makefile.in: New test case. + + * tests1.exp, tests2.exp (test_print_reject): Remove; causes + conflicts with later tests using test_print_reject in ../lib/gdb.exp. + (passcount): Remove. + * tests2.exp (test_print_accept): Removed. + (test_write): Re-write to use gdb_test rather than test_print_accept. + * tests1.exp (test_print_accept_exact): Removed. + (tests_locations): Rewrite to use gdb_test and not above proc. + + * 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. + * callch.ch: Add missing "%." to format strings. + * callch.exp: Fix argument to gdb_load. + * chexp.exp: Add specific error messages to test_print_reject calls. + * misc.exp: Add a test for PR 8496. + * pr-6632.exp, pr-8136.exp: Link executables from two .o files. + +Sat Nov 25 20:49:27 1995 Fred Fish <fnf@phydeaux.cygnus.com> + + * pr-5016.exp: xfail "whatis i" for alpha-osf-dec-osf2*, same as linux. + +Sun Oct 29 17:58:01 1995 Fred Fish <fnf@cygnus.com> + + * pr-5016.exp: xfail "whatis i" for sparc-sun-sunos4*, same as linux. + +Wed Oct 4 18:20:53 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-8136.{ch,exp}, pr-8134.exp, func1.ch, Makefile.in: New test cases. + +Wed Sep 27 11:51:50 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * tuples.ch. tuples.exp: Add new test for setting a variant record + using a tuple, and access the fields. + +Thu Aug 3 10:45:37 1995 Fred Fish <fnf@cygnus.com> + + * Update all FSF addresses except those in COPYING* files. + +Thu Jul 27 20:36:30 1995 Fred Fish (fnf@cygnus.com) + + * pr-5016.exp: xfail "i*86-*-linux*" for "whatis int-range" + test. Thinks it is "_cint" rather than "m_index". + * misc.exp: xfail "i*86-*-linux*" for "info line" test. + Line number is off by one. + +Wed Jun 14 13:07:45 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * chillvars.exp, string.exp: New tests for LOWER/UPPER/LENGTH. + +Wed Jun 7 17:52:38 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * chillvars.ch (xptr): Declare new variable. + * chillvars.exp (test_ptr): New function to test EXPR->MODENAME. + +Tue Mar 28 17:13:13 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-6632.ch, pr-6632-grt.ch, pr-6632.exp, Makefile.in: New test case. + +Tue Mar 21 12:10:06 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + + * tuples.exp (do_tests): Make names of "print v_ps" test unique. + +Wed Mar 8 13:26:36 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + + * *.exp: Skip all tests silently if skip_chill_tests returns true. + + * misc.exp: Remove reference to non-existent variable passcount. + +Tue Mar 7 19:30:05 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * string.ch, string.exp, Makefile.in: New test case. + +Mon Mar 6 14:11:01 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * tuples.ch (setnmode); New module. + * tuples.exp: Add some extra tests. + +Sat Mar 4 15:16:17 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * callch.ch, callch.exp, Makefile.in: New test case. + +Thu Mar 2 06:17:41 1995 Jim Kingdon (kingdon@lioth.cygnus.com) + + * misc.exp: If executable does not exist, issue warning and skip + remaining tests, like other chill tests. + +Wed Mar 1 20:28:42 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * misc.ch, misc.exp, Makefile.in: New test case. + +Mon Feb 20 16:19:58 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * chillvars.ch: Add missing INIT's. + * chillvars.exp: Allow builtin types as either case. E.g. (BOOL|bool). + * pr-5016.exp: Likewise. + +Sun Feb 12 11:26:08 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-6292.ch, pr-6292.exp, Makefile.in: New test case. + +Wed Feb 1 13:09:48 1995 Per Bothner <bothner@kalessin.cygnus.com> + + * tuples.ch, tuples.exp, Makefile.in: New test case. + +Mon Nov 28 18:39:08 1994 Per Bothner <bothner@kalessin.cygnus.com> + + * pr-5984.ch, pr-5984.exp, Makefile.in: New test case. + +Fri Sep 16 16:55:03 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * pr-5646.ch, pr-5646-grt.ch, pr-5646.exp, Makefile.in: New testcase. + +Tue Sep 6 13:21:27 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * pr-5016.ch, pr-5016.exp, Makefile.in: New testcase. + * Makefile.in (.exe.check): New rule, to run just one test. + +Tue Jun 14 16:20:18 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * result.ch, result.exp, Makefile.in: New test case. + * pr-4975.ch, pr-4975-grt.ch, pr-4975.exp, Makefile.in: Ditto. + +Thu Jun 9 15:20:43 1994 Per Bothner (bothner@kalessin.cygnus.com) + + * pr-5022.ch, pr-5022.exp: New testcase. + * chillvars.exp: Remove spurious newline. + + * Makefile.in: Bunch of fixes so it actually works in this + directory. (E.g. add extra ../ where needed.) + Also, add .exe to executables, so we can use suffix rules. + * chexp.exp (test_print_reject): Update syntax error message. + * chillvars.ch (module PR_5020): Moved from here ... + * pr-5022.ch: ... to this new file. + * chillvars.exp, pr-5020.exp (binfile): Add .exe extension. + * chillvars.exp, pr-5020.exp: Don't check all_flag. + * pr-5020.exp: Add more tests; fix "print y pretty" output. diff --git a/gdb/testsuite/gdb.chill/Makefile.in b/gdb/testsuite/gdb.chill/Makefile.in new file mode 100644 index 0000000..a965b57 --- /dev/null +++ b/gdb/testsuite/gdb.chill/Makefile.in @@ -0,0 +1,26 @@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +all: + @echo "Nothing to be done for all..." + +#### host, target, and site specific Makefile frags come in here. + +.SUFFIXES: .ch .o .exe .exp .check + +# Do 'make chillvars.check' to run just the chillvars.{ch,exp} test. + +.exp.check: + rootme=`pwd`/; export rootme; \ + cd .. ; \ + $(MAKE) just-check RUNTESTFLAGS="${RUNTESTFLAGS} $*.exp" \ + EXPECT=${EXPECT} + +clean mostlyclean: + -rm -f *.o ${OBJS} *.exe *~ core + +distclean maintainer-clean realclean: clean + -rm -f Makefile config.status config.log + +Makefile: $(srcdir)/Makefile.in $(srcdir)/configure.in + $(SHELL) ./config.status --recheck diff --git a/gdb/testsuite/gdb.chill/builtins.ch b/gdb/testsuite/gdb.chill/builtins.ch new file mode 100644 index 0000000..ef12c83 --- /dev/null +++ b/gdb/testsuite/gdb.chill/builtins.ch @@ -0,0 +1,83 @@ +xx: MODULE + +DCL v_bool BOOL INIT := FALSE; +DCL v_char CHAR INIT := 'X'; +DCL v_byte BYTE INIT := -30; +DCL v_ubyte UBYTE INIT := 30; +DCL v_int INT INIT := -333; +DCL v_uint UINT INIT := 333; +DCL v_long LONG INIT := -4444; +DCL v_ulong ULONG INIT := 4444; +DCL v_ptr PTR; + +SYNMODE m_set = SET (e1, e2, e3, e4, e5, e6); +DCL v_set m_set INIT := e3; + +SYNMODE m_set_range = m_set(e2:e5); +DCL v_set_range m_set_range INIT := e3; + +SYNMODE m_numbered_set = SET (n1 = 25, n2 = 22, n3 = 35, n4 = 33, + n5 = 45, n6 = 43); +DCL v_numbered_set m_numbered_set INIT := n3; + +SYNMODE m_char_range = CHAR('A':'Z'); +DCL v_char_range m_char_range INIT := 'G'; + +SYNMODE m_bool_range = BOOL(FALSE:FALSE); +DCL v_bool_range m_bool_range; + +SYNMODE m_long_range = LONG(255:3211); +DCL v_long_range m_long_range INIT := 1000; + +SYNMODE m_range = RANGE(12:28); +DCL v_range m_range INIT := 23; + +SYNMODE m_chars = CHARS(20); +SYNMODE m_chars_v = CHARS(20) VARYING; +DCL v_chars CHARS(20); +DCL v_chars_v CHARS(20) VARYING INIT := "foo bar"; + +SYNMODE m_bits = BOOLS(10); +DCL v_bits BOOLS(10); + +SYNMODE m_arr = ARRAY(1:10) BYTE; +DCL v_arr ARRAY(1:10) BYTE; + +SYNMODE m_char_arr = ARRAY (CHAR) BYTE; +DCL v_char_arr ARRAY(CHAR) BYTE; + +SYNMODE m_bool_arr = ARRAY (BOOL) BYTE; +DCL v_bool_arr ARRAY (BOOL) BYTE; + +SYNMODE m_int_arr = ARRAY (INT) BYTE; +DCL v_int_arr ARRAY (INT) BYTE; + +SYNMODE m_set_arr = ARRAY (m_set) BYTE; +DCL v_set_arr ARRAY (m_set) BYTE; + +SYNMODE m_numbered_set_arr = ARRAY (m_numbered_set) BYTE; +DCL v_numbered_set_arr ARRAY (m_numbered_set) BYTE; + +SYNMODE m_char_range_arr = ARRAY (m_char_range) BYTE; +DCL v_char_range_arr ARRAY (m_char_range) BYTE; + +SYNMODE m_set_range_arr = ARRAY (m_set_range) BYTE; +DCL v_set_range_arr ARRAY (m_set_range) BYTE; + +SYNMODE m_bool_range_arr = ARRAY (m_bool_range) BYTE; +DCL v_bool_range_arr ARRAY (m_bool_range) BYTE; + +SYNMODE m_long_range_arr = ARRAY (m_long_range) BYTE; +DCL v_long_range_arr ARRAY (m_long_range) BYTE; + +SYNMODE m_range_arr = ARRAY (m_range) BYTE; +DCL v_range_arr ARRAY (m_range) BYTE; + +SYNMODE m_struct = STRUCT (i LONG, + c CHAR, + s CHARS(30)); +DCL v_struct m_struct; + +v_bool := TRUE; + +END xx; diff --git a/gdb/testsuite/gdb.chill/builtins.exp b/gdb/testsuite/gdb.chill/builtins.exp new file mode 100644 index 0000000..a75ca20 --- /dev/null +++ b/gdb/testsuite/gdb.chill/builtins.exp @@ -0,0 +1,441 @@ +# Copyright (C) 1995, 1997 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 "builtins" +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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break xx_\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_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_gdb 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 gdb_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 +} + +proc test_lower {} { + global passcount + + verbose "testing builtin LOWER" + set passcount 0 + + # discrete mode names + test_print_accept "print lower(bool)" "FALSE" + test_print_accept "print lower(char)" {'\^[(]0[)]'} + test_print_accept "print lower(byte)" "-128" + test_print_accept "print lower(ubyte)" "0" + if [istarget "alpha-*-*"] then { + test_print_accept "print lower(int)" "-2147483648" + } else { + test_print_accept "print lower(int)" "-32768" + } + test_print_accept "print lower(uint)" "0" + setup_xfail "alpha-*-*" + test_print_accept "print lower(long)" "-2147483648" + test_print_accept "print lower(ulong)" "0" + test_print_accept "print lower(m_set)" "e1" + test_print_accept "print lower(m_set_range)" "e2" + test_print_accept "print lower(m_numbered_set)" "n2" + test_print_accept "print lower(m_char_range)" "'A'" + test_print_accept "print lower(m_bool_range)" "FALSE" + test_print_accept "print lower(m_long_range)" "255" + test_print_accept "print lower(m_range)" "12" + + # discrete locations + test_print_accept "print lower(v_bool)" "FALSE" + test_print_accept "print lower(v_char)" {'\^[(]0[)]'} + test_print_accept "print lower(v_byte)" "-128" + test_print_accept "print lower(v_ubyte)" "0" + if [istarget "alpha-*-*"] then { + test_print_accept "print lower(v_int)" "-2147483648" + } else { + test_print_accept "print lower(v_int)" "-32768" + } + test_print_accept "print lower(v_uint)" "0" + setup_xfail "alpha-*-*" + test_print_accept "print lower(v_long)" "-2147483648" + test_print_accept "print lower(v_ulong)" "0" + test_print_accept "print lower(v_set)" "e1" + test_print_accept "print lower(v_set_range)" "e2" + test_print_accept "print lower(v_numbered_set)" "n2" + test_print_accept "print lower(v_char_range)" "'A'" + test_print_accept "print lower(v_bool_range)" "FALSE" + test_print_accept "print lower(v_long_range)" "255" + test_print_accept "print lower(v_range)" "12" + + # string mode names + test_print_accept "print lower(m_chars)" "0" + test_print_accept "print lower(m_chars_v)" "0" + test_print_accept "print lower(m_bits)" "0" + + # string locations + test_print_accept "print lower(v_chars)" "0" + test_print_accept "print lower(v_chars_v)" "0" + test_print_accept "print lower(v_bits)" "0" + + # string expressions + test_print_accept "print lower(\"abcd\")" "0" + test_print_accept "print lower(B'010101')" "0" + + # array mode name + test_print_accept "print lower(m_arr)" "1"; + test_print_accept "print lower(m_char_arr)" {'\^[(]0[)]'} + test_print_accept "print lower(m_bool_arr)" "FALSE" + if [istarget "alpha-*-*"] then { + test_print_accept "print lower(m_int_arr)" "-2147483648" + } else { + test_print_accept "print lower(m_int_arr)" "-32768" + } + test_print_accept "print lower(m_set_arr)" "e1" + test_print_accept "print lower(m_set_range_arr)" "e2" + test_print_accept "print lower(m_numbered_set_arr)" "n2" + test_print_accept "print lower(m_char_range_arr)" "'A'" + test_print_accept "print lower(m_bool_range_arr)" "FALSE" + test_print_accept "print lower(m_long_range_arr)" "255" + test_print_accept "print lower(m_range_arr)" "12" + + # array locations + test_print_accept "print lower(v_arr)" "1"; + test_print_accept "print lower(v_char_arr)" {'\^[(]0[)]'} + test_print_accept "print lower(v_bool_arr)" "FALSE" + if [istarget "alpha-*-*"] then { + test_print_accept "print lower(v_int_arr)" "-2147483648" + } else { + test_print_accept "print lower(v_int_arr)" "-32768" + } + test_print_accept "print lower(v_set_arr)" "e1" + test_print_accept "print lower(v_set_range_arr)" "e2" + test_print_accept "print lower(v_numbered_set_arr)" "n2" + test_print_accept "print lower(v_char_range_arr)" "'A'" + test_print_accept "print lower(v_bool_range_arr)" "FALSE" + test_print_accept "print lower(v_long_range_arr)" "255" + test_print_accept "print lower(v_range_arr)" "12" +} + +proc test_upper {} { + global passcount + + verbose "testing builtin UPPER" + set passcount 0 + + # discrete mode names + test_print_accept "print upper(bool)" "TRUE" + test_print_accept "print upper(char)" {'\^[(]255[)]'} + test_print_accept "print upper(byte)" "127" + test_print_accept "print upper(ubyte)" "255" + if [istarget "alpha-*-*"] then { + test_print_accept "print upper(int)" "2147483647" + test_print_accept "print upper(uint)" "4294967295" + setup_xfail "alpha-*-*" + test_print_accept "print upper(long)" "4294967295" + test_print_accept "print upper(ulong)" "18446744073709551615" + } else { + test_print_accept "print upper(int)" "32767" + test_print_accept "print upper(uint)" "65535" + test_print_accept "print upper(long)" "2147483647" + test_print_accept "print upper(ulong)" "4294967295" + } + test_print_accept "print upper(m_set)" "e6" + test_print_accept "print upper(m_set_range)" "e5" + test_print_accept "print upper(m_numbered_set)" "n5" + test_print_accept "print upper(m_char_range)" "'Z'" + test_print_accept "print upper(m_bool_range)" "FALSE" + test_print_accept "print upper(m_long_range)" "3211" + test_print_accept "print upper(m_range)" "28" + + # discrete locations + test_print_accept "print upper(v_bool)" "TRUE" + test_print_accept "print upper(v_char)" {'\^[(]255[)]'} + test_print_accept "print upper(v_byte)" "127" + test_print_accept "print upper(v_ubyte)" "255" + if [istarget "alpha-*-*"] then { + test_print_accept "print upper(v_int)" "2147483647" + test_print_accept "print upper(v_uint)" "4294967295" + setup_xfail "alpha-*-*" + test_print_accept "print upper(v_long)" "4294967295" + test_print_accept "print upper(v_ulong)" "18446744073709551615" + } else { + test_print_accept "print upper(v_int)" "32767" + test_print_accept "print upper(v_uint)" "65535" + test_print_accept "print upper(v_long)" "2147483647" + test_print_accept "print upper(v_ulong)" "4294967295" + } + test_print_accept "print upper(v_set)" "e6" + test_print_accept "print upper(v_set_range)" "e5" + test_print_accept "print upper(v_numbered_set)" "n5" + test_print_accept "print upper(v_char_range)" "'Z'" + test_print_accept "print upper(v_bool_range)" "FALSE" + test_print_accept "print upper(v_long_range)" "3211" + test_print_accept "print upper(v_range)" "28" + + # string mode names + test_print_accept "print upper(m_chars)" "19" + test_print_accept "print upper(m_chars_v)" "19" + test_print_accept "print upper(m_bits)" "9" + + # string locations + test_print_accept "print upper(v_chars)" "19" + test_print_accept "print upper(v_chars_v)" "19" + test_print_accept "print upper(v_bits)" "9" + + # string expressions + test_print_accept "print upper(\"abcd\")" "3" + test_print_accept "print upper(B'010101')" "5" + + # array mode name + test_print_accept "print upper(m_arr)" "10"; + test_print_accept "print upper(m_char_arr)" {'\^[(]255[)]'} + test_print_accept "print upper(m_bool_arr)" "TRUE" + if [istarget "alpha-*-*"] then { + test_print_accept "print upper(m_int_arr)" "2147483647" + } else { + test_print_accept "print upper(m_int_arr)" "32767" + } + test_print_accept "print upper(m_set_arr)" "e6" + test_print_accept "print upper(m_set_range_arr)" "e5" + test_print_accept "print upper(m_numbered_set_arr)" "n5" + test_print_accept "print upper(m_char_range_arr)" "'Z'" + test_print_accept "print upper(m_bool_range_arr)" "FALSE" + test_print_accept "print upper(m_long_range_arr)" "3211" + test_print_accept "print upper(m_range_arr)" "28" + + # array locations + test_print_accept "print upper(v_arr)" "10"; + test_print_accept "print upper(v_char_arr)" {'\^[(]255[)]'} + test_print_accept "print upper(v_bool_arr)" "TRUE" + if [istarget "alpha-*-*"] then { + test_print_accept "print upper(v_int_arr)" "2147483647" + } else { + test_print_accept "print upper(v_int_arr)" "32767" + } + test_print_accept "print upper(v_set_arr)" "e6" + test_print_accept "print upper(v_set_range_arr)" "e5" + test_print_accept "print upper(v_numbered_set_arr)" "n5" + test_print_accept "print upper(v_char_range_arr)" "'Z'" + test_print_accept "print upper(v_bool_range_arr)" "FALSE" + test_print_accept "print upper(v_long_range_arr)" "3211" + test_print_accept "print upper(v_range_arr)" "28" +} + +proc test_length {} { + global passcount + + verbose "testing builtin LENGTH" + set passcount 0 + + # string locations + test_print_accept "print length(v_chars)" "20" + test_print_accept "print length(v_chars_v)" "7"; + test_print_accept "print length(v_bits)" "10"; + + # string expressions + test_print_accept "print length(\"the quick brown fox ...\")" "23" + test_print_accept "print length(B'010101010101')" "12" + test_print_accept "print length(\"foo \" // \"bar\")" "7" + + # check some failures + setup_xfail "*-*-*" + test_print_accept "print length(m_chars)" "typename in invalid context" + setup_xfail "*-*-*" + test_print_accept "print length(v_byte)" "bad argument to LENGTH builtin" + setup_xfail "*-*-*" + test_print_accept "print length(b'000000' // b'111111')" "12" +} + +proc test_size {} { + global passcount + + verbose "testing builtin SIZE" + set passcount 0 + + # modes + test_print_accept "print size(bool)" "1" + test_print_accept "print size(char)" "1" + test_print_accept "print size(byte)" "1" + if [istarget "alpha-*-*"] then { + test_print_accept "print size(int)" "4" + test_print_accept "print size(ulong)" "8" + test_print_accept "print size(ptr)" "8" + test_print_accept "print size(m_chars_v)" "24" + test_print_accept "print size(m_struct)" "40" + } else { + test_print_accept "print size(int)" "2" + test_print_accept "print size(ulong)" "4" + test_print_accept "print size(ptr)" "4" + test_print_accept "print size(m_chars_v)" "22" + test_print_accept "print size(m_struct)" "36" + } + test_print_accept "print size(m_set)" "1" + test_print_accept "print size(m_numbered_set)" "1" + test_print_accept "print size(m_char_range)" "1" + test_print_accept "print size(m_range_arr)" "17" + test_print_accept "print size(m_chars)" "20" + test_print_accept "print size(m_bits)" "2" + + # locations + test_print_accept "print size(v_bool)" "1" + test_print_accept "print size(v_char)" "1" + test_print_accept "print size(v_byte)" "1" + if [istarget "alpha-*-*"] then { + test_print_accept "print size(v_int)" "4" + test_print_accept "print size(v_ulong)" "8" + test_print_accept "print size(v_ptr)" "8" + test_print_accept "print size(v_chars_v)" "24" + test_print_accept "print size(v_struct)" "40" + } else { + test_print_accept "print size(v_int)" "2" + test_print_accept "print size(v_ulong)" "4" + test_print_accept "print size(v_ptr)" "4" + test_print_accept "print size(v_chars_v)" "22" + test_print_accept "print size(v_struct)" "36" + } + test_print_accept "print size(v_set)" "1" + test_print_accept "print size(v_numbered_set)" "1" + test_print_accept "print size(v_char_range)" "1" + test_print_accept "print size(v_range_arr)" "17" + test_print_accept "print size(v_chars)" "20" + test_print_accept "print size(v_bits)" "2" +} + +proc test_num {} { + global passcount + + verbose "testing builtin NUM" + set passcount 0 + + # constants + test_print_accept "print num(false)" "0" + test_print_accept "print num(true)" "1" + test_print_accept "print num(10)" "10" + test_print_accept "print num(33-34)" "-1" + test_print_accept "print num('X')" "88" + test_print_accept "print num(e5)" "4" + + # locations + test_print_accept "print num(v_bool)" "0" + test_print_accept "print num(v_char)" "88" + test_print_accept "print num(v_byte)" "-30" + test_print_accept "print num(v_ubyte)" "30" + test_print_accept "print num(v_int)" "-333" + test_print_accept "print num(v_uint)" "333" + test_print_accept "print num(v_long)" "-4444" + test_print_accept "print num(v_ulong)" "4444" + test_print_accept "print num(v_set)" "2" + test_print_accept "print num(v_set_range)" "2" + test_print_accept "print num(v_numbered_set)" "35" + test_print_accept "print num(v_char_range)" "71" + test_print_accept "print num(v_long_range)" "1000" + test_print_accept "print num(v_range)" "23" +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if [set_lang_chill] then { + # test builtins as described in chapter 6.20.3 Z.200 + test_num + test_size + test_lower + test_upper + test_length +} else { + warning "$test_name tests suppressed." +} diff --git a/gdb/testsuite/gdb.chill/callch.ch b/gdb/testsuite/gdb.chill/callch.ch new file mode 100644 index 0000000..6001d92 --- /dev/null +++ b/gdb/testsuite/gdb.chill/callch.ch @@ -0,0 +1,50 @@ +hack : module + +dcl i int; +newmode otto = array (bool, bool) byte; +newmode str1 = struct (f1 int, f2 bool); +newmode str2 = struct (f1 otto); + +dcl a otto := [[1,1],[1,1]]; +dcl b str1 := [10, false]; +dcl c str2; + +fred : proc (a int in, b int loc); + writetext(stdout, "a is '%C'; b is '%C'.%/", a, b); +end fred; + +klaus : proc (); + writetext(stdout, "here's klaus calling.%/"); +end klaus; + +king : proc (p otto loc, x otto in); + dcl i, j bool; + p := [[h'ff,h'ff],[h'ff,h'ff]]; + do for i:= lower(bool) to upper(bool); + do for j:= lower(bool) to upper(bool); + writetext(stdout, "x(%C, %C) = %C%..%/", i, j, x(i, j)); + writetext(stdout, "p(%C, %C) = %C%..%/", i, j, p(i, j)); + od; + od; +end king; + +ralph : proc (x str1 in); + writetext(stdout, "x.f1 = %C, x.f2 = %C%..%/", x.f1, x.f2); +end ralph; + +whitney : proc (x str2 in); + dcl i, j bool; + + do for i:= lower(bool) to upper(bool); + do for j:= lower(bool) to upper(bool); + writetext(stdout, "x.f1(%C, %C) = %C%..%/", i, j, x.f1(i, j)); + od; + od; + +end whitney; + +c := [a]; +i:=12; +writetext(stdout, "done.%/"); + +end hack; diff --git a/gdb/testsuite/gdb.chill/callch.exp b/gdb/testsuite/gdb.chill/callch.exp new file mode 100644 index 0000000..c579a05 --- /dev/null +++ b/gdb/testsuite/gdb.chill/callch.exp @@ -0,0 +1,69 @@ +# Copyright (C) 1995, 1997 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 that gdb can call functions in a Chill inferior. + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "callch" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language chill\n" ; + + gdb_test "break callch.ch:48" "" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*callch.ch:48.*$gdb_prompt $" + gdb_test {set fred(10, i)} {a is '10'; b is '12'.} + gdb_test_exact "call klaus()" {here's klaus calling.} + gdb_test_exact "call fred()" {too few arguments in function call} + # Too many arguments are allowed + gdb_test_exact "call klaus(10, 20, 30)" {here's klaus calling.} + gdb_test "print a" { = \[\(FALSE:TRUE\): \[\(FALSE:TRUE\): 1\]\]}\ + "print a before king" + # Current gdb prints 255 for the results that are expected to be -1. + setup_xfail "mips*-sgi-irix*" + gdb_test {call king(a, otto[[10, 15], [20, 25]])} "x\\(FALSE, FALSE\\) = 10.*p\\(FALSE, FALSE\\) = -1.*x\\(FALSE, TRUE\\) = 15.*p\\(FALSE, TRUE\\) = -1.*x\\(TRUE, FALSE\\) = 20.*p\\(TRUE, FALSE\\) = -1.*x\\(TRUE, TRUE\\) = 25.*p\\(TRUE, TRUE\\) = -1.*" + gdb_test "print a" { = \[\(FALSE:TRUE\): \[\(FALSE:TRUE\): -1\]\]}\ + "print a after king" + gdb_test_exact "call ralph(b)" {x.f1 = 10, x.f2 = FALSE.} + gdb_test "call whitney(c)" "x.f1\\(FALSE, FALSE\\) = 1.*x.f1\\(FALSE, TRUE\\) = 1.*x.f1\\(TRUE, FALSE\\) = 1.*x.f1\\(TRUE, TRUE\\) = 1.*" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/chexp.exp b/gdb/testsuite/gdb.chill/chexp.exp new file mode 100644 index 0000000..bed4aba --- /dev/null +++ b/gdb/testsuite/gdb.chill/chexp.exp @@ -0,0 +1,450 @@ +# Copyright (C) 1992, 1997 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 was written by Fred Fish. (fnf@cygnus.com) + +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 gdb_prompt + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + return 1 + } + -re ".*$gdb_prompt $" { + fail "setting language to \"chill\"" + return 0 + } + timeout { + fail "can't show language (timeout)" + return 0 + } + } +} + +proc test_integer_literals_accepted {} { + global gdb_prompt + + # Test various decimal values. + + gdb_test "p 123" " = 123" + gdb_test "p -123" " = -123" + gdb_test "p D'123" " = 123" + gdb_test "p d'123" " = 123" + gdb_test "p -D'123" " = -123" + gdb_test "p -d'123" " = -123" + gdb_test "p 12_345" " = 12345" + gdb_test "p __1_2_3__" " = 123" + gdb_test "p/d 123" " = D'123" + + # Test various binary values. + + gdb_test "p B'111" " = 7" + gdb_test "p b'111" " = 7" + gdb_test "p -B'111" " = -7" + gdb_test "p B'0111" " = 7" + gdb_test "p b'0111" " = 7" + gdb_test "p -b'0111" " = -7" + gdb_test "p B'_0_1_1_1_" " = 7" + gdb_test "p b'_0_1_1_1_" " = 7" + gdb_test "p -b'_0_1_1_1_" " = -7" + gdb_test "p/t B'111" " = B'111" + + # Test various octal values. + + gdb_test "p O'123" " = 83" + gdb_test "p o'123" " = 83" + gdb_test "p -o'0123" " = -83" + gdb_test "p O'0123" " = 83" + gdb_test "p o'0123" " = 83" + gdb_test "p -o'123" " = -83" + gdb_test "p O'_1_2_3_" " = 83" + gdb_test "p o'_1_2_3_" " = 83" + gdb_test "p -o'_1_2_3_" " = -83" + gdb_test "p/o O'123" " = O'123" + + # Test various hexadecimal values. + + gdb_test "p H'123" " = 291" + gdb_test "p h'123" " = 291" + gdb_test "p -h'123" " = -291" + gdb_test "p H'0123" " = 291" + gdb_test "p h'0123" " = 291" + gdb_test "p -h'0123" " = -291" + gdb_test "p H'_1_2_3_" " = 291" + gdb_test "p h'_1_2_3_" " = 291" + gdb_test "p -h'_1_2_3_" " = -291" + gdb_test "p H'ABC" " = 2748" + gdb_test "p H'abc" " = 2748" + gdb_test "p H'AbC" " = 2748" + gdb_test "p H'_A_b_C_" " = 2748" + gdb_test "p H'_D_e_F_" " = 3567" + gdb_test "p H'_d_E_f_" " = 3567" + gdb_test "p/x H'123" " = H'123" +} + +proc test_character_literals_accepted {} { + global gdb_prompt + + # Test various decimal values. + + gdb_test "p 'a'" " = 'a'" + gdb_test "p/x 'a'" " = H'61" + gdb_test "p/d 'a'" " = D'97" + gdb_test "p/t 'a'" " = B'1100001" + # gdb_test "p '^(97)'" " = 'a'" (not in GNU Chill) + gdb_test "p C'61'" " = 'a'" + gdb_test "p c'61'" " = 'a'" + gdb_test "p/x C'FF'" " = H'ff" + # gdb_test "p/x '^(H'FF)'" " = H'ff" (not in GNU Chill) + # gdb_test "p/x '^(D'255)'" " = H'ff" (not in GNU Chill) +} + +proc test_integer_literals_rejected {} { + global gdb_prompt + + # These are valid integer literals in Z.200, but not GNU-Chill. + + test_print_reject "p _" + test_print_reject "p __" + + test_print_reject "p D'" + test_print_reject "p D'_" + test_print_reject "p D'__" + + test_print_reject "p B'" + test_print_reject "p B'_" + test_print_reject "p B'__" + + test_print_reject "p O'" + test_print_reject "p O'_" + test_print_reject "p O'__" + + test_print_reject "p H'" + test_print_reject "p H'_" + test_print_reject "p H'__" + + # Test various decimal values. + + test_print_reject "p D'DEADBEEF" + test_print_reject "p D'123DEADBEEF" + + # Test various binary values. + + test_print_reject "p B'2" "Too-large digit in bitstring or integer." + test_print_reject "p B'12" "Too-large digit in bitstring or integer." + + # Test various octal values. + + test_print_reject "p O'9" "Too-large digit in bitstring or integer." + test_print_reject "p O'79" "Too-large digit in bitstring or integer." + + # Test various hexadecimal values. + + test_print_reject "p H'G" "Invalid character in bitstring or integer." + test_print_reject "p H'AG" "Invalid character in bitstring or integer." +} + +proc test_boolean_literals_accepted {} { + global gdb_prompt + + # Test the only possible values for a boolean, TRUE and FALSE. + + gdb_test "p TRUE" " = TRUE" + gdb_test "p FALSE" " = FALSE" +} + +proc test_float_literals_accepted {} { + global gdb_prompt + + # Test various floating point formats + + 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" " = 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 {} { + global gdb_prompt + + gdb_test "set \$foo := 101" " := 101\[\r\]*" \ + "Set a new convenience variable" + + gdb_test "print \$foo" " = 101" \ + "Print contents of new convenience variable" + + gdb_test "set \$foo := 301" " := 301\[\r\]*" \ + "Set convenience variable to a new value" + + gdb_test "print \$foo" " = 301" \ + "Print new contents of convenience variable" + + gdb_test "set \$_ := 11" " := 11\[\r\]*" \ + "Set convenience variable \$_" + + gdb_test "print \$_" " = 11" \ + "Print contents of convenience variable \$_" + + gdb_test "print \$foo + 10" " = 311" \ + "Use convenience variable in arithmetic expression" + + gdb_test "print (\$foo := 32) + 4" " = 36" \ + "Use convenience variable assignment in arithmetic expression" + + gdb_test "print \$bar" " = void" \ + "Print contents of uninitialized convenience variable" +} + +proc test_value_history {} { + global gdb_prompt + + gdb_test "print 101" "\\\$1 = 101" \ + "Set value-history\[1\] using \$1" + + gdb_test "print 102" "\\\$2 = 102" \ + "Set value-history\[2\] using \$2" + + gdb_test "print 103" "\\\$3 = 103" \ + "Set value-history\[3\] using \$3" + + gdb_test "print \$\$" "\\\$4 = 102" \ + "Print value-history\[MAX-1\] using inplicit index \$\$" + + gdb_test "print \$\$" "\\\$5 = 103" \ + "Print value-history\[MAX-1\] again using implicit index \$\$" + + gdb_test "print \$" "\\\$6 = 103" \ + "Print value-history\[MAX\] using implicit index \$" + + gdb_test "print \$\$2" "\\\$7 = 102" \ + "Print value-history\[MAX-2\] using explicit index \$\$2" + + gdb_test "print \$0" "\\\$8 = 102" \ + "Print value-history\[MAX\] using explicit index \$0" + + gdb_test "print 108" "\\\$9 = 108" "" + + gdb_test "print \$\$0" "\\\$10 = 108" \ + "Print value-history\[MAX\] using explicit index \$\$0" + + gdb_test "print \$1" "\\\$11 = 101" \ + "Print value-history\[1\] using explicit index \$1" + + gdb_test "print \$2" "\\\$12 = 102" \ + "Print value-history\[2\] using explicit index \$2" + + gdb_test "print \$3" "\\\$13 = 103" \ + "Print value-history\[3\] using explicit index \$3" + + gdb_test "print \$-3" "\\\$14 = 100" \ + "Print (value-history\[MAX\] - 3) using implicit index \$" + + gdb_test "print \$1 + 3" "\\\$15 = 104" \ + "Use value-history element in arithmetic expression" +} + +proc test_arithmetic_expressions {} { + global gdb_prompt + + # Test unary minus with various operands + +# gdb_test "p -(TRUE)" " = -1" "unary minus applied to bool" +# gdb_test "p -('a')" " = xxx" "unary minus applied to char" + gdb_test "p -(1)" " = -1" "unary minus applied to int" + gdb_test "p -(1.0)" " = -1" "unary minus applied to real" + + # Test addition with various operands + + gdb_test "p TRUE + 1" " = 2" "bool plus int" + gdb_test "p 'a' + 1" " = 98" "char plus int" + gdb_test "p 1 + 1" " = 2" "int plus int" + gdb_test "p 1.0 + 1" " = 2" "real plus int" + gdb_test "p 1.0 + 2.0" " = 3" "real plus real" + + # Test subtraction with various operands + + gdb_test "p TRUE - 1" " = 0" "bool minus int" + gdb_test "p 'b' - 1" " = 97" "char minus int" + gdb_test "p 3 - 1" " = 2" "int minus int" + gdb_test "p 3.0 - 1" " = 2" "real minus int" + gdb_test "p 5.0 - 2.0" " = 3" "real minus real" + + # Test multiplication with various operands + + gdb_test "p TRUE * 1" " = 1" "bool times int" + gdb_test "p 'a' * 2" " = 194" "char times int" + gdb_test "p 2 * 3" " = 6" "int times int" + gdb_test "p 2.0 * 3" " = 6" "real times int" + gdb_test "p 2.0 * 3.0" " = 6" "real times real" + + # Test division with various operands + + gdb_test "p TRUE / 1" " = 1" "bool divided by int" + gdb_test "p 'a' / 2" " = 48" "char divided by int" + gdb_test "p 6 / 3" " = 2" "int divided by int" + gdb_test "p 6.0 / 3" " = 2" "real divided by int" + gdb_test "p 6.0 / 3.0" " = 2" "real divided by real" + + # Test modulo with various operands + + gdb_test "p TRUE MOD 1" " = 0" "bool modulo int" + gdb_test "p 'a' MOD 2" " = 1" "char modulo int" + gdb_test "p -5 MOD 3" " = 1" "negative int modulo int" + gdb_test "p 5 MOD 1" " = 0" "int modulo int" + gdb_test "p 5 MOD 2" " = 1" "int modulo int" + gdb_test "p 5 MOD 3" " = 2" "int modulo int" + gdb_test "p 5 MOD 4" " = 1" "int modulo int" + gdb_test "p 5 MOD 5" " = 0" "int modulo int" + gdb_test "p 0 MOD 1" " = 0" "int modulo int" + gdb_test "p 0 MOD 2" " = 0" "int modulo int" + gdb_test "p 0 MOD 3" " = 0" "int modulo int" + gdb_test "p 0 MOD 4" " = 0" "int modulo int" + gdb_test "p -5 MOD 1" " = 0" "int modulo int" + gdb_test "p -5 MOD 2" " = 1" "int modulo int" + gdb_test "p -5 MOD 3" " = 1" "int modulo int" + gdb_test "p -5 MOD 4" " = 3" "int modulo int" + gdb_test "p -5 MOD 5" " = 0" "int modulo int" + gdb_test "p -5 MOD 5" " = 0" "int modulo int" + test_print_reject "p 6.0 MOD 3" \ + "Integer-only operation on floating point number.*" + test_print_reject "p 6.0 MOD 3.0" \ + "Integer-only operation on floating point number.*" + test_print_reject "p -5 MOD -1" \ + "Second operand of MOD must be greater than zero.*" + test_print_reject "p -5 MOD 0" \ + "Second operand of MOD must be greater than zero.*" + + # Test remainder with various operands + + gdb_test "p TRUE REM 1" " = 0" "bool remainder int" + gdb_test "p 'a' REM 2" " = 1" "char remainder int" + gdb_test "p 5 REM 5" " = 0" "int remainder int" + gdb_test "p 5 REM 4" " = 1" "int remainder int" + gdb_test "p 5 REM 3" " = 2" "int remainder int" + gdb_test "p 5 REM 2" " = 1" "int remainder int" + gdb_test "p 5 REM 1" " = 0" "int remainder int" + gdb_test "p 5 REM -1" " = 0" "int remainder int" + gdb_test "p 5 REM -2" " = 1" "int remainder int" + gdb_test "p 5 REM -3" " = 2" "int remainder int" + gdb_test "p 5 REM -4" " = 1" "int remainder int" + gdb_test "p 5 REM -5" " = 0" "int remainder int" + gdb_test "p -5 REM 5" " = 0" "int remainder int" + gdb_test "p -5 REM 4" " = -1" "int remainder int" + gdb_test "p -5 REM 3" " = -2" "int remainder int" + gdb_test "p -5 REM 2" " = -1" "int remainder int" + gdb_test "p -5 REM 1" " = 0" "int remainder int" + gdb_test "p -5 REM -1" " = 0" "int remainder int" + gdb_test "p -5 REM -2" " = -1" "int remainder int" + gdb_test "p -5 REM -3" " = -2" "int remainder int" + gdb_test "p -5 REM -4" " = -1" "int remainder int" + gdb_test "p -5 REM -5" " = 0" "int remainder int" + gdb_test "p 6 REM 3" " = 0" "int remainder int" + test_print_reject "p 6.0 REM 3" \ + "Integer-only operation on floating point number.*" + test_print_reject "p 6.0 REM 3.0" \ + "Integer-only operation on floating point number.*" +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" "" + +if [set_lang_chill] then { + test_value_history + test_convenience_variables + test_integer_literals_accepted + test_integer_literals_rejected + test_boolean_literals_accepted + test_character_literals_accepted + test_float_literals_accepted + test_arithmetic_expressions +} else { + warning "$test_name tests suppressed." 0 +} diff --git a/gdb/testsuite/gdb.chill/chillvars.ch b/gdb/testsuite/gdb.chill/chillvars.ch new file mode 100644 index 0000000..21dfcba --- /dev/null +++ b/gdb/testsuite/gdb.chill/chillvars.ch @@ -0,0 +1,204 @@ +testvars: MODULE + +DCL bool_true BOOL INIT := TRUE; +DCL bool_false BOOL INIT := FALSE; +DCL booltable1 ARRAY (0:3) BOOL INIT := [ TRUE, FALSE, FALSE, TRUE ]; +DCL booltable2 ARRAY (4:7) BOOL INIT := [ TRUE, FALSE, FALSE, TRUE ]; + +DCL control_char CHAR INIT := C'07'; +DCL printable_char CHAR INIT := 'a'; +DCL chartable1 ARRAY (0:2) CHAR INIT := [ C'00', C'01', C'02' ]; +DCL chartable2 ARRAY (3:5) CHAR INIT := [ C'00', C'01', C'02' ]; + +DCL string1 CHARS (4) INIT := 'abcd'; +DCL string2 CHARS (5) INIT := 'ef' // C'00' // 'gh'; +DCL string3 CHARS (6) INIT := 'ef' // 'gh' // 'ij'; +DCL string4 CHARS (7) INIT := (6) 'z' // C'00'; + +DCL byte_low BYTE INIT := -128; +DCL byte_high BYTE INIT := 127; +DCL bytetable1 ARRAY (0:4) BYTE INIT := [ -2, -1, 0, 1, 2 ]; +DCL bytetable2 ARRAY (5:9) BYTE INIT := [ -2, -1, 0, 1, 2 ]; +DCL bytetable3 ARRAY (1:2,'c':'d',FALSE:TRUE) BYTE + INIT := [ [ [ 0, 1 ], [ 2, 3 ] ], [ [ 4, 5 ], [ 6, 7 ] ] ]; +DCL bytetable4 ARRAY (1:2) ARRAY ('c':'d') ARRAY (FALSE:TRUE) BYTE + INIT := [ [ [ 0, 1 ], [ 2, 3 ] ], [ [ 4, 5 ], [ 6, 7 ] ] ]; + +DCL ubyte_low UBYTE INIT := 0; +DCL ubyte_high UBYTE INIT := 255; +DCL ubytetable1 ARRAY (0:4) UBYTE INIT := [ 0, 1, 2, 3, 4 ]; +DCL ubytetable2 ARRAY (5:9) UBYTE INIT := [ 0, 1, 2, 3, 4 ]; + +DCL int_low INT INIT := -32_768; +DCL int_high INT INIT := 32_767; +DCL inttable1 ARRAY (0:4) INT INIT := [ -2, -1, 0, 1, 2 ]; +DCL inttable2 ARRAY (5:9) INT INIT := [ -2, -1, 0, 1, 2 ]; + +DCL uint_low UINT INIT := 0; +DCL uint_high UINT INIT := 65_535; +DCL uinttable1 ARRAY (0:4) UINT INIT := [ 0, 1, 2, 3, 4 ]; +DCL uinttable2 ARRAY (5:9) UINT INIT := [ 0, 1, 2, 3, 4 ]; + +DCL long_low LONG INIT := -2_147_483_648; +DCL long_high LONG INIT := 2_147_483_647; +DCL longtable1 ARRAY (0:4) LONG INIT := [ -2, -1, 0, 1, 2 ]; +DCL longtable2 ARRAY (5:9) LONG INIT := [ -2, -1, 0, 1, 2 ]; + +DCL ulong_low ULONG INIT := 0; +DCL ulong_high ULONG INIT := 4_294_967_295; +DCL ulongtable1 ARRAY (0:4) ULONG INIT := [ 0, 1, 2, 3, 4 ]; +DCL ulongtable2 ARRAY (5:9) ULONG INIT := [ 0, 1, 2, 3, 4 ]; + +DCL real1 FLOAT INIT := 3.14159265358; +DCL real2 FLOAT INIT := -3.14159265358; +DCL realtable1 ARRAY (0:4) FLOAT INIT := [ -2.0, -1.0, 0.0, 1.0, 2.0 ]; +DCL realtable2 ARRAY (5:9) FLOAT INIT := [ -2.0, -1.0, 0.0, 1.0, 2.0 ]; + +DCL long_real1 DOUBLE INIT := 3.14e300; +DCL long_real2 DOUBLE INIT := -3.14e-300; +DCL longrealtable1 ARRAY (0:4) DOUBLE INIT := [ -2.0, -1.0, 0.0, 1.0, 2.0 ]; +DCL longrealtable2 ARRAY (5:9) DOUBLE INIT := [ -2.0, -1.0, 0.0, 1.0, 2.0 ]; + +/* DCL powerset1 POWERSET INT(0:7);*/ +/* DCL chars1 CHAR (16) INIT := (16)'b'; */ +/* DCL bits1 BIT(20) := B'11111111000010101011'; */ + +NEWMODE simple_struct = STRUCT (abool BOOL, aint INT, astring CHARS (8)); +DCL struct1 simple_struct := [ TRUE, 123, "a string" ]; + +NEWMODE nested_struct = STRUCT (abool BOOL, nstruct simple_struct, aint INT); +DCL struct2 nested_struct := [ TRUE, [ FALSE, 456, "deadbeef" ], 789 ]; + +/* This table is used as a source for every ascii character. */ + +DCL asciitable ARRAY (0:255) CHAR INIT := [ + C'00', C'01', C'02', C'03', C'04', C'05', C'06', C'07', + C'08', C'09', C'0a', C'0b', C'0c', C'0d', C'0e', C'0f', + C'10', C'11', C'12', C'13', C'14', C'15', C'16', C'17', + C'18', C'19', C'1a', C'1b', C'1c', C'1d', C'1e', C'1f', + C'20', C'21', C'22', C'23', C'24', C'25', C'26', C'27', + C'28', C'29', C'2a', C'2b', C'2c', C'2d', C'2e', C'2f', + C'30', C'31', C'32', C'33', C'34', C'35', C'36', C'37', + C'38', C'39', C'3a', C'3b', C'3c', C'3d', C'3e', C'3f', + C'40', C'41', C'42', C'43', C'44', C'45', C'46', C'47', + C'48', C'49', C'4a', C'4b', C'4c', C'4d', C'4e', C'4f', + C'50', C'51', C'52', C'53', C'54', C'55', C'56', C'57', + C'58', C'59', C'5a', C'5b', C'5c', C'5d', C'5e', C'5f', + C'60', C'61', C'62', C'63', C'64', C'65', C'66', C'67', + C'68', C'69', C'6a', C'6b', C'6c', C'6d', C'6e', C'6f', + C'70', C'71', C'72', C'73', C'74', C'75', C'76', C'77', + C'78', C'79', C'7a', C'7b', C'7c', C'7d', C'7e', C'7f', + C'80', C'81', C'82', C'83', C'84', C'85', C'86', C'87', + C'88', C'89', C'8a', C'8b', C'8c', C'8d', C'8e', C'8f', + C'90', C'91', C'92', C'93', C'94', C'95', C'96', C'97', + C'98', C'99', C'9a', C'9b', C'9c', C'9d', C'9e', C'9f', + C'a0', C'a1', C'a2', C'a3', C'a4', C'a5', C'a6', C'a7', + C'a8', C'a9', C'aa', C'ab', C'ac', C'ad', C'ae', C'af', + C'b0', C'b1', C'b2', C'b3', C'b4', C'b5', C'b6', C'b7', + C'b8', C'b9', C'ba', C'bb', C'bc', C'bd', C'be', C'bf', + C'c0', C'c1', C'c2', C'c3', C'c4', C'c5', C'c6', C'c7', + C'c8', C'c9', C'ca', C'cb', C'cc', C'cd', C'ce', C'cf', + C'd0', C'd1', C'd2', C'd3', C'd4', C'd5', C'd6', C'd7', + C'd8', C'd9', C'da', C'db', C'dc', C'dd', C'de', C'df', + C'e0', C'e1', C'e2', C'e3', C'e4', C'e5', C'e6', C'e7', + C'e8', C'e9', C'ea', C'eb', C'ec', C'ed', C'ee', C'ef', + C'f0', C'f1', C'f2', C'f3', C'f4', C'f5', C'f6', C'f7', + C'f8', C'f9', C'fa', C'fb', C'fc', C'fd', C'fe', C'ff' +]; + +DCL charmatrix ARRAY (0:255) CHAR INIT := [ + 'a','X','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'a','a','X','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'a','a','a','X','X','X','X','X','X','X','X','X','X','X','X','X', + 'a','a','a','a','X','X','X','X','X','X','X','X','X','X','X','X', + 'a','a','a','a','a','X','X','X','X','X','X','X','X','X','X','X', + 'a','a','a','a','a','a','X','X','X','X','X','X','X','X','X','X', + 'a','a','a','a','a','a','a','X','X','X','X','X','X','X','X','X', + 'a','a','a','a','a','a','a','a','X','X','X','X','X','X','X','X', + 'a','a','a','a','a','a','a','a','a','X','X','X','X','X','X','X', + 'a','a','a','a','a','a','a','a','a','a','X','X','X','X','X','X', + 'a','a','a','a','a','a','a','a','a','a','a','X','X','X','X','X', + 'a','a','a','a','a','a','a','a','a','a','a','a','X','X','X','X', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','X','X','X', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','X','X', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','X', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a' +]; + +DCL xptr PTR INIT := ->int_high; + +booleans: PROC (); + + DCL val1 BOOL := TRUE; + DCL val2 BOOL := FALSE; + DCL val3 BOOL := TRUE; + + val1 := TRUE XOR TRUE; + val1 := TRUE XOR FALSE; + val1 := FALSE XOR TRUE; + val1 := FALSE XOR FALSE; + val1 := val2 XOR val3; + + val1 := TRUE AND TRUE; + val1 := TRUE AND FALSE; + val1 := FALSE AND TRUE; + val1 := FALSE AND FALSE; + val1 := val2 AND val3; + + val1 := TRUE ANDIF TRUE; + val1 := TRUE ANDIF FALSE; + val1 := FALSE ANDIF TRUE; + val1 := FALSE ANDIF FALSE; + val1 := val2 ANDIF val3; + + val1 := TRUE OR TRUE; + val1 := TRUE OR FALSE; + val1 := FALSE OR TRUE; + val1 := FALSE OR FALSE; + val1 := val2 OR val3; + +-- val1 := NOT TRUE; +-- val1 := NOT FALSE; +-- val1 := NOT val2; +-- val1 := NOT val3; + +END booleans; + +scalar_arithmetic: PROC (); + + DCL val1 INT := 1; + DCL val2 INT := 2; + DCL val3 INT := 3; + + val1 := -val2; + val1 := val2 + val3; + val1 := val2 - val3; + val1 := val2 * val3; + val1 := val2 / val3; + val1 := val2 MOD val3; + val1 := val2 REM val3; + +END scalar_arithmetic; + +write_arrays: PROC (); + + inttable1(0) := 0; + inttable1(1) := 1; + inttable1(2) := 2; + inttable1(3) := 3; + inttable1(4) := 4; + inttable2(5) := 5; + inttable2(6) := 6; + inttable2(7) := 7; + inttable2(8) := 8; + inttable2(9) := 9; + +END write_arrays; + +uint_low := 0; + +scalar_arithmetic (); +write_arrays (); +booleans (); + +END; diff --git a/gdb/testsuite/gdb.chill/chillvars.exp b/gdb/testsuite/gdb.chill/chillvars.exp new file mode 100644 index 0000000..f37c94d --- /dev/null +++ b/gdb/testsuite/gdb.chill/chillvars.exp @@ -0,0 +1,316 @@ +# Copyright (C) 1992, 1997 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 was written by Fred Fish. (fnf@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "chillvars" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + # This is needed (at least on SunOS4) to make sure the + # the symbol table is read. + gdb_test "break chillvars.ch:3" "" + gdb_test "delete 1" "" + + gdb_test "set width 0" "" + gdb_test "set print sevenbit-strings" "" + gdb_test "set print address off" "" + + test_BOOL + test_CHAR + test_BYTE + test_UBYTE + test_INT + test_UINT + test_LONG + test_ULONG + test_REAL + test_LONG_REAL + test_POWERSET + test_arrays + test_strings + test_structs + + test_ptr +} + +proc test_BOOL {} { + + gdb_test "ptype bool_true" "type = (BOOL|bool)" + gdb_test "ptype bool_false" "type = (BOOL|bool)" + gdb_test "whatis bool_true" "type = (BOOL|bool)" + gdb_test "whatis bool_false" "type = (BOOL|bool)" + gdb_test "print bool_false" " = FALSE" + gdb_test "print bool_true" " = TRUE" + +} + +proc test_CHAR {} { + gdb_test "ptype control_char" "type = (CHAR|char)" + gdb_test "whatis control_char" "type = (CHAR|char)" + gdb_test "print control_char" { = '\^[(]7[)]'} + gdb_test "ptype printable_char" "type = (CHAR|char)" + gdb_test "whatis printable_char" "type = (CHAR|char)" + gdb_test "print printable_char" " = 'a'" + + gdb_test "print lower(char)" { = '\^[(]0[)]'} + gdb_test "print upper(char)" { = '\^[(]255[)]'} +} + +proc test_BYTE {} { + gdb_test "ptype byte_low" "type = (BYTE|byte)" + gdb_test "whatis byte_low" "type = (BYTE|byte)" + gdb_test "print byte_low" " = -128" + gdb_test "ptype byte_high" "type = (BYTE|byte)" + gdb_test "whatis byte_high" "type = (BYTE|byte)" + gdb_test "print byte_high" " = 127" + + gdb_test "print lower(byte)" " = -128" + gdb_test "print upper(byte)" " = 127" + gdb_test "print lower(byte_high)" " = -128" + gdb_test "print upper(byte_high)" " = 127" +} + +proc test_UBYTE {} { + gdb_test "ptype ubyte_low" "type = (UBYTE|ubyte)" + gdb_test "whatis ubyte_low" "type = (UBYTE|ubyte)" + gdb_test "print ubyte_low" " = 0" + gdb_test "ptype ubyte_high" "type = (UBYTE|ubyte)" + gdb_test "whatis ubyte_high" "type = (UBYTE|ubyte)" + gdb_test "print ubyte_high" " = 255" +} + +proc test_INT {} { + gdb_test "ptype int_low" "type = (INT|int)" + gdb_test "whatis int_low" "type = (INT|int)" + gdb_test "print int_low" " = -32768" + gdb_test "ptype int_high" "type = (INT|int)" + gdb_test "whatis int_high" "type = (INT|int)" + gdb_test "print int_high" " = 32767" +} + +proc test_UINT {} { + gdb_test "ptype uint_low" "type = (UINT|uint)" + gdb_test "whatis uint_low" "type = (UINT|uint)" + gdb_test "print uint_low" " = 0" + gdb_test "ptype uint_high" "type = (UINT|uint)" + gdb_test "whatis uint_high" "type = (UINT|uint)" + gdb_test "print uint_high" " = 65535" +} + +proc test_LONG {} { + gdb_test "ptype long_low" "type = (LONG|long)" + gdb_test "whatis long_low" "type = (LONG|long)" + gdb_test "print long_low" " = -2147483648" + gdb_test "ptype long_high" "type = (LONG|long)" + gdb_test "whatis long_high" "type = (LONG|long)" + gdb_test "print long_high" " = 2147483647" +} + +proc test_ULONG {} { + gdb_test "ptype ulong_low" "type = (ULONG|ulong)" + gdb_test "whatis ulong_low" "type = (ULONG|ulong)" + gdb_test "print ulong_low" " = 0" + gdb_test "ptype ulong_high" "type = (ULONG|ulong)" + gdb_test "whatis ulong_high" "type = (ULONG|ulong)" + gdb_test "print ulong_high" " = 4294967295" +} + +proc test_REAL {} { + gdb_test "ptype real1" "type = (FLOAT|float)" + gdb_test "whatis real1" "type = (FLOAT|float)" + gdb_test "print real1" " = 3.14159274" +} + +proc test_LONG_REAL {} { + gdb_test "ptype long_real1" "type = (DOUBLE|double)" + gdb_test "whatis long_real1" "type = (DOUBLE|double)" + gdb_test "print long_real1" " = 3\\.1400000000000001e\\+300" +} + +proc test_POWERSET {} { +} + +proc test_arrays {} { + gdb_test "ptype booltable1" "type = ARRAY \\(+0:3\\)+ (BOOL|bool)" + gdb_test_exact "print booltable1" \ + { = [(0): TRUE, (1:2): FALSE, (3): TRUE]} + + gdb_test "ptype booltable2" "type = ARRAY \\(+4:7\\)+ (BOOL|bool)" + gdb_test_exact "print booltable2" { = [(4): TRUE, (5:6): FALSE, (7): TRUE]} + + gdb_test "ptype chartable1" "type = ARRAY \\(+0:2\\)+ (CHAR|char)" + gdb_test_exact "print chartable1" {= [(0): '^(0)', (1): '^(1)', (2): '^(2)']} + + gdb_test "ptype chartable2" "type = ARRAY \\(+3:5\\)+ (CHAR|char)" + gdb_test_exact "print chartable2" \ + {= [(3): '^(0)', (4): '^(1)', (5): '^(2)']} + + gdb_test "ptype bytetable1" "type = ARRAY \\(+0:4\\)+ (BYTE|byte)" + gdb_test_exact "print bytetable1" \ + {= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]} + + gdb_test "ptype bytetable2" "type = ARRAY \\(+5:9\\)+ (BYTE|byte)" + gdb_test_exact "print bytetable2" \ + {= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]} + + gdb_test "ptype bytetable3" \ + "type = ARRAY \\(1:2\\) ARRAY \\('c':'d'\\) ARRAY \\(FALSE:TRUE\\) (BYTE|byte)" + gdb_test_exact "print bytetable3" \ + {= [(1): [('c'): [(FALSE): 0, (TRUE): 1], ('d'): [(FALSE): 2, (TRUE): 3]], (2): [('c'): [(FALSE): 4, (TRUE): 5], ('d'): [(FALSE): 6, (TRUE): 7]]]} + gdb_test "ptype bytetable4" \ + "type = ARRAY \\(1:2\\) ARRAY \\('c':'d'\\) ARRAY \\(FALSE:TRUE\\) (BYTE|byte)" + gdb_test_exact "print bytetable4" \ + {= [(1): [('c'): [(FALSE): 0, (TRUE): 1], ('d'): [(FALSE): 2, (TRUE): 3]], (2): [('c'): [(FALSE): 4, (TRUE): 5], ('d'): [(FALSE): 6, (TRUE): 7]]]} + + gdb_test "ptype ubytetable1" "type = ARRAY \\(+0:4\\)+ (UBYTE|ubyte)" + gdb_test_exact "print ubytetable1" \ + {= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]} + + gdb_test "ptype ubytetable2" "type = ARRAY \\(+5:9\\)+ (UBYTE|ubyte)" + gdb_test_exact "print ubytetable2" \ + {= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]} + + gdb_test "ptype inttable1" "type = ARRAY \\(+0:4\\)+ (INT|int)" + gdb_test_exact "print inttable1" \ + {= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]} + + gdb_test "ptype inttable2" "type = ARRAY \\(+5:9\\)+ (INT|int)" + gdb_test_exact "print inttable2" \ + {= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]} + + gdb_test "ptype uinttable1" "type = ARRAY \\(+0:4\\)+ (UINT|uint)" + gdb_test_exact "print uinttable1" \ + {= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]} + + gdb_test "ptype uinttable2" "type = ARRAY \\(+5:9\\)+ (UINT|uint)" + gdb_test_exact "print uinttable2" \ + {= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]} + + gdb_test "ptype longtable1" "type = ARRAY \\(+0:4\\)+ (LONG|long)" + gdb_test_exact "print longtable1" \ + {= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]} + + gdb_test "ptype longtable2" "type = ARRAY \\(+5:9\\)+ (LONG|long)" + gdb_test_exact "print longtable2" \ + {= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]} + + gdb_test "ptype ulongtable1" "type = ARRAY \\(+0:4\\)+ (ULONG|ulong)" + gdb_test_exact "print ulongtable1" \ + {= [(0): 0, (1): 1, (2): 2, (3): 3, (4): 4]} + + gdb_test "ptype ulongtable2" "type = ARRAY \\(+5:9\\)+ (ULONG|ulong)" + gdb_test_exact "print ulongtable2" \ + {= [(5): 0, (6): 1, (7): 2, (8): 3, (9): 4]} + + gdb_test "ptype realtable1" "type = ARRAY \\(+0:4\\)+ (FLOAT|float)" + gdb_test_exact "print realtable1" \ + {= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]} + + gdb_test "ptype realtable2" "type = ARRAY \\(+5:9\\)+ (FLOAT|float)" + gdb_test_exact "print realtable2" \ + {= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]} + + gdb_test "ptype longrealtable1" "type = ARRAY \\(+0:4\\)+ (DOUBLE|double)" + gdb_test_exact "print longrealtable1" \ + {= [(0): -2, (1): -1, (2): 0, (3): 1, (4): 2]} + + gdb_test "ptype longrealtable2" "type = ARRAY \\(+5:9\\)+ (DOUBLE|double)" + gdb_test_exact "print longrealtable2" \ + {= [(5): -2, (6): -1, (7): 0, (8): 1, (9): 2]} + + gdb_test "print length(longrealtable2)" {= 5} + gdb_test "print lower(longrealtable2)" {= 5} + gdb_test "print upper(longrealtable2)" {= 9} +} + +proc test_strings {} { + + gdb_test "ptype string1" "type = CHARS \[(\]4\[)\]+" + gdb_test "print string1" " = \"abcd\"" + + gdb_test "ptype string2" "type = CHARS \[(\]+5\[)\]+" + gdb_test "print string2" { = \"ef\^\(0\)gh\"} + + gdb_test "ptype string3" "type = CHARS \[(\]+6\[)\]+" + gdb_test "print string3" " = \"efghij\"" + + gdb_test "ptype string4" "type = CHARS \[(\]+7\[)\]+" + gdb_test "print string4" { = \"zzzzzz\^\(0\)\"} + + # These tests require a running process, so run to one of the procs + # and then do the tests. + + if [runto scalar_arithmetic] then { + gdb_test "ptype string1//string2" "type = CHARS \\(9\\)" + gdb_test "print string1//string2" { = \"abcdef\^\(0\)gh\"} + gdb_test_exact {ptype "a chill string"} {type = CHARS (14)} + gdb_test "print 'a chill string'" " = \"a chill string\"" + gdb_test "print \"ef\"//c'00'//\"gh\"" { = \"ef\^\(0\)gh\"} + gdb_test "print string1 // \"efgh\"" " = \"abcdefgh\"" + gdb_test "print (6) 'z'" " = \"zzzzzz\"" + gdb_test "ptype (6) 'z'" "type = CHARS \[(\]+6\[)\]+" + gdb_test "print (1+2*3) 'x'" " = \"xxxxxxx\"" + gdb_test "ptype (1+2*3) 'x'" "type = CHARS \[(\]+7\[)\]+" + } + +} + +proc test_structs {} { + gdb_test "ptype struct1" \ + "type = STRUCT \\(+.*abool (BOOL|bool),.*aint (INT|int),.*astring CHARS \\(+8\\)+.*\\)+" + gdb_test "print struct1" \ + ".* = \\\[\.abool: TRUE, \.aint: 123, \.astring: \"a string\"\\\]" + gdb_test "ptype struct2" \ + "type = STRUCT \\(+.*abool (BOOL|bool),.*nstruct simple_struct,.*aint (INT|int).*\\)+" + gdb_test "print struct2" \ + ".* = \\\[.abool: TRUE, \.nstruct: \\\[\.abool: FALSE, \.aint: 456, \.astring: \"deadbeef\"\\\], \.aint: 789\\\]" +} + +proc test_ptr {} { + # This is to test Cygnus PR 6932 + gdb_test "print xptr->int" ".* = 32767" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/configure b/gdb/testsuite/gdb.chill/configure new file mode 100755 index 0000000..24e429d --- /dev/null +++ b/gdb/testsuite/gdb.chill/configure @@ -0,0 +1,899 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=chexp.exp + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +CC=${CC-cc} + +ac_aux_dir= +for ac_dir in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../../.. $srcdir/`cd $srcdir;pwd`/../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:573: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:594: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:612: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/gdb/testsuite/gdb.chill/configure.in b/gdb/testsuite/gdb.chill/configure.in new file mode 100644 index 0000000..3eed026 --- /dev/null +++ b/gdb/testsuite/gdb.chill/configure.in @@ -0,0 +1,11 @@ +dnl Process this file file with autoconf to produce a configure script. + +AC_PREREQ(2.5) +AC_INIT(chexp.exp) + +CC=${CC-cc} +AC_SUBST(CC) +AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..) +AC_CANONICAL_SYSTEM + +AC_OUTPUT(Makefile) diff --git a/gdb/testsuite/gdb.chill/enum.ch b/gdb/testsuite/gdb.chill/enum.ch new file mode 100644 index 0000000..971fc94 --- /dev/null +++ b/gdb/testsuite/gdb.chill/enum.ch @@ -0,0 +1,9 @@ +hugo: module + + synmode m_set = set (a, b, c, d, e, f, g, h, i); + dcl x long; + dcl y m_set; + + writetext (stdout, "done.%/"); + +end hugo; diff --git a/gdb/testsuite/gdb.chill/enum.exp b/gdb/testsuite/gdb.chill/enum.exp new file mode 100644 index 0000000..74fee35 --- /dev/null +++ b/gdb/testsuite/gdb.chill/enum.exp @@ -0,0 +1,85 @@ +# Copyright (C) 1995, 1997 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 was written by Wilfried Moser (moser@aut.alcatel.at +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "enum" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto hugo_ + + send_gdb "set var \$i := d\n" + gdb_expect -re ".*$gdb_prompt $" + gdb_test "print \$i" { = d} + gdb_test "print size (\$i)" { = 1} + gdb_test "print b+c" { = 3} + gdb_test "print c*d" { = 6} + gdb_test "print a<b" { = TRUE} + gdb_test "print a=b" { = FALSE} + gdb_test "print a=a" { = TRUE} + gdb_test "print a/=\$i" { = TRUE} + +# This is PR 8870 + gdb_test "break malloc" ".*" + gdb_test {set var $j := m_set[b]} ".*invalid.*tuple.*" +} diff --git a/gdb/testsuite/gdb.chill/extstruct-grt.ch b/gdb/testsuite/gdb.chill/extstruct-grt.ch new file mode 100644 index 0000000..abd0d5e --- /dev/null +++ b/gdb/testsuite/gdb.chill/extstruct-grt.ch @@ -0,0 +1,12 @@ +pot1: MODULE + +SYNMODE m_array1 = ARRAY (2:3) ulong; +SYNMODE m_struct = STRUCT (f1 int, + f2 REF m_array1, + f3 m_array1); +SYNMODE m_array3 = ARRAY (5:6) m_struct; +SYNMODE m_array4 = ARRAY (7:8) ARRAY (9:10) m_struct; + +GRANT all; + +END pot1; diff --git a/gdb/testsuite/gdb.chill/extstruct.ch b/gdb/testsuite/gdb.chill/extstruct.ch new file mode 100644 index 0000000..649f609 --- /dev/null +++ b/gdb/testsuite/gdb.chill/extstruct.ch @@ -0,0 +1,16 @@ +pottendo: MODULE + +<> USE_SEIZE_FILE "extstruct-grt.grt" <> +SEIZE m_array3; +SEIZE m_array4; + +SYNMODE m_x = STRUCT (i long, + ar m_array3); +SYNMODE m_y = STRUCT (i long, + ar m_array4); + +DCL x LONG; + +x := 10; + +END pottendo; diff --git a/gdb/testsuite/gdb.chill/extstruct.exp b/gdb/testsuite/gdb.chill/extstruct.exp new file mode 100644 index 0000000..39d61cb --- /dev/null +++ b/gdb/testsuite/gdb.chill/extstruct.exp @@ -0,0 +1,66 @@ +# Copyright (C) 1992, 1994, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile2 "extstruct-grt" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "extstruct" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + gdb_test "set var \$i := m_x\[\]" "" + gdb_test "print \$i" { = \[.i: 0, .ar: \[\(5:6\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]} + + gdb_test "set var \$j := m_y\[\]" "" + gdb_test "print \$j" { = \[.i: 0, .ar: \[\(7:8\): \[\(9:10\): \[.f1: 0, .f2: NULL, .f3: \[\(2:3\): 0\]\]\]\]\]} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/func1.ch b/gdb/testsuite/gdb.chill/func1.ch new file mode 100644 index 0000000..d0d28ce --- /dev/null +++ b/gdb/testsuite/gdb.chill/func1.ch @@ -0,0 +1,9 @@ +func1: MODULE + +SYNMODE m_set = SET (e1, e2, e3, e4, e5, e6, e7, e8, e9, e10); +SYNMODE m_setrange = RANGE (e3:e8); +SYNMODE m_ps = POWERSET m_set; +SYNMODE m_rangeps = POWERSET RANGE(0:31); +GRANT ALL; + +END func1; diff --git a/gdb/testsuite/gdb.chill/gch1041.ch b/gdb/testsuite/gdb.chill/gch1041.ch new file mode 100644 index 0000000..a9ce80b --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1041.ch @@ -0,0 +1,17 @@ +arr: MODULE + +SYNMODE m_chars = CHARS(30) VARYING; +SYNMODE m_s = STRUCT (l LONG, c m_chars, b BOOL); + +DCL a1 ARRAY (1:1000) LONG INIT := [(5:100): 33, (1:4): 44, (ELSE): 55 ]; +DCL a2 ARRAY (1:10) m_s INIT := [(*): [ 22, "mowi", TRUE ] ]; +DCL a3 ARRAY (CHAR) CHAR INIT := [(*): 'X']; + +SYNMODE m_set = SET (e1, e2, e3, e4, e5, e6, e7, e9, e10); +DCL a4 ARRAY (m_set) BOOL INIT := [(*): TRUE]; + +a1 := [(5:100): 33, (1:4): 44, (ELSE): 55 ]; +a1 := [ (*): 22 ]; +a2 := [(*): [ 22, "mowi", TRUE ] ]; + +END arr; diff --git a/gdb/testsuite/gdb.chill/gch1041.exp b/gdb/testsuite/gdb.chill/gch1041.exp new file mode 100644 index 0000000..1cec0f9 --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1041.exp @@ -0,0 +1,76 @@ +# Copyright (C) 1995, 1997 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 was written by Fred Fish. (fnf@cygnus.com) +# Martin Pottendorfer (pottendo@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "gch1041" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto arr_ + # check if array slices print correct index + gdb_test {print a1(10:30)} { = \[\(10:30\): 33\]} + gdb_test {print a2(3:5)} { = \[\(3:5\): \[.l: 22, .c: "mowi", .b: TRUE\]\]} + gdb_test {print a3('a':'c')} { = \[\('a':'c'\): 'X'\]} + gdb_test {print a4(e2:e5)} { = \[\(e2:e5\): TRUE\]} +} diff --git a/gdb/testsuite/gdb.chill/gch1272.ch b/gdb/testsuite/gdb.chill/gch1272.ch new file mode 100644 index 0000000..6112d4b --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1272.ch @@ -0,0 +1,21 @@ +gch1272: MODULE + +SYNMODE m_array = ARRAY (0:99) INT; +DCL foo m_array; + +SYNMODE m_xxx = ARRAY (1:10) LONG; + +SYNMODE m_struct = STRUCT (i LONG, b BOOL); +SYNMODE m_bar = ARRAY (-10:20) m_struct; +DCL bar m_bar; + +SYNMODE m_ps = POWERSET LONG (0:20); + +brrr: PROC () +END; + +foo := [ (*): 222 ]; + +brrr (); + +END gch1272; diff --git a/gdb/testsuite/gdb.chill/gch1272.exp b/gdb/testsuite/gdb.chill/gch1272.exp new file mode 100644 index 0000000..db60715 --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1272.exp @@ -0,0 +1,86 @@ +# Copyright (C) 1995, 1997 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 was written by Wilfried Moser (moser@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "gch1272" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto brrr + + # check foo + gdb_test {print foo} { = \[\(0:99\): 222\]} + gdb_test "set var foo := m_array\[\(\*\):44\]" ".*" + gdb_test {print foo} { = \[\(0:99\): 44\]} + + # check bar + gdb_test {print bar} { = \[\(-10:20\): \[.i: 0, .b: FALSE\]\]} + gdb_test "set var bar := m_bar\[\(\*\): \[42, TRUE\]\]" ".*" + gdb_test {print bar} { = \[\(-10:20\): \[.i: 42, .b: TRUE\]\]} + + # some failues + gdb_test "set var foo := \[\(\*\):44\]" {\(\*\) only possible with modename in front of tuple \(mode\[\.\.\]\)} + gdb_test "set var foo := m_xxx\[\(\*\):44\]" {Invalid cast\.} + gdb_test "set var foo := m_struct\[\(\*\):44\]" {\(\*\) in invalid context} + gdb_test "set var foo := m_ps\[\(\*\):44\]" {\(\*\) in invalid context} +} diff --git a/gdb/testsuite/gdb.chill/gch1280.ch b/gdb/testsuite/gdb.chill/gch1280.ch new file mode 100644 index 0000000..3fba71f --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1280.ch @@ -0,0 +1,13 @@ +gch1280: MODULE + +SYNMODE m_x = ARRAY (1:3) LONG; +DCL v_x m_x; +DCL v_xx m_x; + +doit: PROC () +END doit; + +v_x := [ 11, 12, 13 ]; +doit (); + +END gch1280; diff --git a/gdb/testsuite/gdb.chill/gch1280.exp b/gdb/testsuite/gdb.chill/gch1280.exp new file mode 100644 index 0000000..216625d --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch1280.exp @@ -0,0 +1,76 @@ +# Copyright (C) 1995, 1997 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 was written by Wilfried Moser (moser@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "gch1280" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto doit + gdb_test "next" "" + # check too many array elements + gdb_test {set var v_x := [1,2,3,4,5]} {Too many array elements} + gdb_test {set var $i := m_x[(3): 22, 25]} {Too many array elements} + gdb_test "set var \$i := m_x\[\(2\): 22, 25\]" "" + gdb_test {print $i} { = \[\(1\): 0, \(2\): 22, \(3\): 25\]} +} diff --git a/gdb/testsuite/gdb.chill/gch922.ch b/gdb/testsuite/gdb.chill/gch922.ch new file mode 100644 index 0000000..b3e8a23 --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch922.ch @@ -0,0 +1,23 @@ +xx : module + +dcl a chars(200) varying init := (70)'^(0)' // "Jason""^(0,5)""Hugo^(10)" // (70)'^(1)'; +dcl b chars(20) varying init := "Jason""^(0,5)""Hugo^(10)"; +dcl c chars(256) varying init := (70)'a' // "^(0,5)Jason" // (70)'b'; +dcl d char init := '^(11)'; + +bulk: PROC (); +END bulk; + +a := (50) '^(255,0,222,127)'; +b := (1)'^(200)'; +d := 'a'; + +c:= (256)" "; + +DO FOR i:= 0 BY 1 TO 255; + c (255-i) := char (i); +OD; + +bulk (); + +end xx;
\ No newline at end of file diff --git a/gdb/testsuite/gdb.chill/gch922.exp b/gdb/testsuite/gdb.chill/gch922.exp new file mode 100644 index 0000000..c0fb6dc --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch922.exp @@ -0,0 +1,183 @@ +# Copyright (C) 1995, 1997 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. + +# This file was written by Wilfried Moser (moser@aut.alcatel.at) +# Kurt Fuchs (fuchs_k@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "gch922" +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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break xx_\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_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_gdb 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 gdb_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 +} + + +proc test_chars {} { + global passcount gdb_prompt + + verbose "Testing Chars" + set passcount 0 + + test_print_accept "print a" {'\^\(0\)'<repeats 70 times>//"Jason""\^\(0,5\)""Hugo\^\(10\)"//'\^\(1\)'<repeats 70 times>} + test_print_accept "print b" {"Jason""\^\(0,5\)""Hugo\^\(10\)"} + test_print_accept "print c" {'a'<repeats 70 times>//"\^\(0,5\)Jason"//'b'<repeats 70 times>} + test_print_accept "print d" {'\^\(11\)'} + + gdb_test "set var a := (100)'\^(0,255)'" "" + test_print_accept "print a" {"\^\(0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255\)"} + + send_gdb "set var a := (10)'\^(1)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {"\^\(1,1,1,1,1,1,1,1,1,1\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"} + send_gdb "set var b := \"Hugo \"\"\^(3,4)\"\"Otto\^(17)\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print b" {"Hugo ""\^\(3,4\)""Otto\^\(17\)"} + send_gdb "set var c := (70)'b' // \"\^(2,3)Hugo \" // (70)'c' \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print c" {'b'<repeats 70 times>//"\^\(2,3\)Hugo "//'c'<repeats 70 times>} + gdb_test "set var d := '\^(199)'" "" + test_print_accept "print d" {'\^\(199\)'} + + test_print_accept "print (10)'\^(0)'//(26)\"\^(66,67)\"//\" \"//'I'//' '//'a'//'m'//\" Hugo\"" {"\^\(0,0,0,0,0,0,0,0,0,0\)BCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBCBC I am Hugo"} + test_print_accept "print \"Jason\"\"\^(0,5)\"\"Hugo\^(10)\"" {"Jason""\^\(0,5\)""Hugo\^\(10\)"} + + send_gdb "set var a := \"\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {""} + send_gdb "set var a := \"\"\"\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {""""} + send_gdb "set var a := \" \"\"\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {" """} + send_gdb "set var a := \"\^\^\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {"\^\^"} + send_gdb "set var a := \"'\" \n" ; gdb_expect -re "$gdb_prompt $" + test_print_accept "print a" {"'"} +} + + +proc test_code {} { + global passcount gdb_prompt + + verbose "Testing Chars" + set passcount 0 + + runto bulk + test_print_accept "print a" {"\^\(255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127,255,0,222,127\)"} + test_print_accept "print b" {"\^\(200\)"} +# test_print_accept "print c" {'a'<repeats 70 times>//"\^\(0,5\)Jason"//'b'<repeats 70 times>} + test_print_accept "print d" {'a'} +} + + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + + +if [set_lang_chill] then { + # test builtins as described in chapter 6.20.3 Z.200 + + test_chars +# test_code +} else { + warning "$test_name tests suppressed." +} diff --git a/gdb/testsuite/gdb.chill/gch981.ch b/gdb/testsuite/gdb.chill/gch981.ch new file mode 100644 index 0000000..e8f0474 --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch981.ch @@ -0,0 +1,60 @@ +xx: MODULE + +SYNMODE m_set1 = SET (e1, e2, e3, e4, e5); +DCL v_set1 m_set1 INIT := e3; + +SYNMODE m_set2 = SET (a1=1, a2=2, a3=17, a4=9, a5=8, a6=0, a7=14, a8=33, a9=12); +DCL v1_set2 m_set2 INIT := a1; +DCL v2_set2 m_set2 INIT := a2; +DCL v3_set2 m_set2 INIT := a3; +DCL v4_set2 m_set2 INIT := a4; +DCL v5_set2 m_set2 INIT := a5; +DCL v6_set2 m_set2 INIT := a6; +DCL v7_set2 m_set2 INIT := a7; +DCL v8_set2 m_set2 INIT := a8; +DCL v9_set2 m_set2 INIT := a9; + +SYNMODE m_set3 = SET (b1, b2, b3, b4, b5 = 4711, b6, b7 = 4713); +DCL v_set3 m_set3 INIT := b7; + +SYNMODE m_set4 = SET(s1=111111, s2, s3, s4); +DCL v1_set4 m_set4 INIT := s1; + +SYNMODE m_set_range = m_set1(e2:e5); +DCL v_set_range m_set_range INIT := e3; + +SYNMODE m_set_range_arr = ARRAY (m_set_range) BYTE; +DCL v_set_range_arr ARRAY (m_set_range) BYTE; + +SYNMODE m_set_arr = ARRAY (m_set1) BYTE; +DCL v_set_arr ARRAY (m_set1) BYTE; + +NEWMODE m_power1 = POWERSET m_set1; +DCL v1_power1 READ m_power1 INIT := [e1,e2,e3,e4,e5]; +DCL v2_power1 m_power1 INIT := []; + +NEWMODE m_power2 = POWERSET m_set2; +DCL v_power2 m_power2 INIT := []; + +NEWMODE m_power3 = POWERSET m_set3; +DCL v_power3 m_power3 INIT := [b1:b2]; + +NEWMODE m_power4 = POWERSET CHAR; +DCL v_power4 m_power4 INIT := ['b':'x']; + +NEWMODE m_power5 = POWERSET INT (2:400); +DCL v_power5 m_power5 INIT := [2:100]; + +NEWMODE m_power6 = POWERSET INT; +DCL v_power6 m_power6; + +NEWMODE m_power7 = POWERSET LONG; +DCL v_power7 m_power7; + + +v_set1:= e2; +v2_power1:= [e1]; + +v_set1:= e1; + +END xx; diff --git a/gdb/testsuite/gdb.chill/gch981.exp b/gdb/testsuite/gdb.chill/gch981.exp new file mode 100644 index 0000000..3a948b1 --- /dev/null +++ b/gdb/testsuite/gdb.chill/gch981.exp @@ -0,0 +1,249 @@ +# Copyright (C) 1995, 1997 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. + +# This file was written by Wilfried Moser (moser@aut.alcatel.at) +# Kurt Fuchs (fuchs_k@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "gch981" +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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break xx_\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_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_gdb 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 gdb_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 +} + +proc test_power {} { + global passcount gdb_prompt + + verbose "Testing some POWERSET Stuff" + set passcount 0 + + test_print_accept "print v1_power1" {\[e1:e5\]} + test_print_accept "print v2_power1" {\[\]} + test_print_accept "print SIZE(v1_power1)" "1" + + gdb_test "set v1_power1 := \[b1\]" "" +# if GDB has rejected the improper values, we have to gdb_expect the same! + test_print_accept "print v1_power1" {\[e1:e5\]} + + gdb_test "set v1_power1 := \[a1,a2\]" "" + test_print_accept "print v1_power1" {\[e1:e5\]} + gdb_test "set v1_power1 := \[b1,b2,b3,e4\]" "" + test_print_accept "print v1_power1" {\[e1:e5\]} + gdb_test "set v1_power1 := \[e4:e5\]" "" + test_print_accept "print v1_power1" {\[e4:e5\]} + gdb_test "set v1_power1 := \[e1, e2:e3, e5\]" "" + test_print_accept "print v1_power1" {\[e1:e3, e5\]} + gdb_test "set v1_power1 := \[e1, e2:e4, e4:e5\]" "" + test_print_accept "print v1_power1" {\[e1:e5\]} + gdb_test "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\]" "" + test_print_accept "print v1_power1" {\[e1:e3\]} + + gdb_test "set v_power2 := \[e2\]" "" + test_print_accept "print v_power2" {\[\]} + gdb_test "set v_power2 := \[1,2,3\]" "" + test_print_accept "print v_power2" {\[\]} + gdb_test "set v_power2 := \[e2, b2, b1\]" "" + test_print_accept "print v_power2" {\[\]} + +# Note, that this is a numbered SET, so a1:a3 contains all elements (exept a6) + gdb_test "set v_power2 := \[a1:a3, a6:a4, a7:a9\]" "" + test_print_accept "print v_power2" {\[a6:a3\]} + gdb_test "set v_power2 := \[a1, a4:a6, a9\]" "" + test_print_accept "print v_power2" {\[a1, a9\]} + gdb_test "set v_power2 := \[a1:a2, a6, a9\]" "" + test_print_accept "print v_power2" {\[a6:a2, a9\]} + gdb_test "set v_power2 := \[a1, a4, a7:a8, a9:a3\]" "" + test_print_accept "print v_power2" {\[a1, a4, a9:a8\]} + gdb_test "set v_power2 := \[a1, a4:a8\]" "" + test_print_accept "print v_power2" {\[a1, a4:a8\]} + gdb_test "set v_power2 := \[a8,a3,a7,a9,a5,a6\]" "" + test_print_accept "print v_power2" {\[a6, a5, a9, a7, a3, a8\]} + + gdb_test "set v_power3 := \[b1:b2,e1\]" "" + test_print_accept "print v_power3" {\[b1:b2\]} + gdb_test "set v_power3 := \[b1, b3, b6:b7\]" "" + test_print_accept "print v_power3" {\[b1, b3, b6:b7\]} + gdb_test "set v_power3 := \[b1, b3:b4, b7\]" "" + test_print_accept "print v_power3" {\[b1, b3:b4, b7\]} + gdb_test "set v_power3 := \[b1, b4:b6, b7\]" "" + test_print_accept "print v_power3" {\[b1, b4:b7\]} + gdb_test "set v_power3 := \[b1:b7\]" "" + test_print_accept "print v_power3" {\[b1:b7\]} + gdb_test "set v_power3 := \[b5:b7, b1\]" "" + test_print_accept "print v_power3" {\[b1, b5:b7\]} + + gdb_test "set v_power4 := \[\"b\"\]" "" + test_print_accept "print v_power4" {\['b':'x'\]} + gdb_test "set v_power4 := \[5\]" "" + test_print_accept "print v_power4" {\['b':'x'\]} + gdb_test "set v_power4 := \['c':'f','g':'h','o':'t'\]" "" + test_print_accept "print v_power4" {\['c':'h', 'o':'t'\]} + gdb_test "set v_power4 := \['a','b','c','d','e','f'\]" "" + test_print_accept "print v_power4" {\['a':'f'\]} + gdb_test "set v_power4 := \['\^(0)':'\^(200)'\]" "" + test_print_accept "print v_power4" {\['\^\(0\)':'\^\(200\)'\]} + + gdb_test "set v_power5 := \[a8\]" "" + test_print_accept "print v_power5" {\[2:100\]} + gdb_test "set v_power5 := \[4\]" "" + test_print_accept "print v_power5" {\[4\]} + gdb_test "set v_power5 := \[3:95,9:100,10:107,200:250\]" "" + test_print_accept "print v_power5" {\[3:107, 200:250\]} + gdb_test "set v_power5 := \[2, 100:120, 350:400\]" "" + test_print_accept "print v_power5" {\[2, 100:120, 350:400\]} + gdb_test "set v_power5 := \[2:64,65:127,128:256,256:399,400\]" "" + test_print_accept "print v_power5" {\[2:400\]} + gdb_test "set v_power5 := \[3:95, 99:100, 101:107, 200:250\]" "" + test_print_accept "print v_power5" {\[3:95, 99:107, 200:250\]} + + gdb_test "set v_power6 := \[a8\]" "" + test_print_accept "print v_power6" {\[\]} + gdb_test "set v_power6 := \[4\]" "" + test_print_accept "print v_power6" {\[4\]} + gdb_test "set v_power6 := \[3:95, 99:100, 101:107, 200:250\]" "" + test_print_accept "print v_power6" {\[3:95, 99:107, 200:250\]} + gdb_test "set v_power6 := \[-111:0, 1:112, 11111:22222\]" "" + test_print_accept "print v_power6" {\[-111:112, 11111:22222\]} + gdb_test "set v_power6 := \[0, 200:4000, 6666:9999\]" "" + test_print_accept "print v_power6" {\[0, 200:4000, 6666:9999\]} + +# gdb_test "set v_power7 := \[a8\]" "" +# test_print_accept "print v_power7" {\[2:100\]} +# gdb_test "set v_power7 := \[4\]" "" +# test_print_accept "print v_power7" {\[4\]} +# gdb_test "set v_power7 := \[3:95, 99:100, 101:107, 200:250\]" "" +# test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]} +# gdb_test "set v_power7 := \[0, 1000, 1000000, 10000000000\]" "" +# test_print_accept "print v_power7" {\[0, 1000, 1000000, 1000000000\]} +# gdb_test "set v_power7 := \[-20000:100000, 111111:2222222\]" "" +# test_print_accept "print v_power7" {\[-20000:100000, 111111:2222222\]} +# gdb_test "set v_power7 := \[\]" "" +# test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]} +# gdb_test "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ " "" +# test_print_accept "print v_power7" {\[-920:-888, -501:2, 20:370, 1000:2500\]} +# test_print_accept "print SIZE(v_power7)" "" + + + runto 58 + test_print_accept "print v_set1 IN v1_power1" "TRUE" + test_print_accept "print v_set1 IN v2_power1" "FALSE" + +} + + + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + + +if [set_lang_chill] then { + # test builtins as described in chapter 6.20.3 Z.200 + + test_power +} else { + warning "$test_name tests suppressed." +} diff --git a/gdb/testsuite/gdb.chill/misc.ch b/gdb/testsuite/gdb.chill/misc.ch new file mode 100644 index 0000000..20f12c8 --- /dev/null +++ b/gdb/testsuite/gdb.chill/misc.ch @@ -0,0 +1,12 @@ +misc_tests : MODULE; + +DCL otto INT := 42; + +DCL foo STRUCT (l LONG, c CHAR, b BOOL, s CHARS(3)); + +dummyfunc: PROC(); +END dummyfunc; + +dummyfunc(); + +END misc_tests; diff --git a/gdb/testsuite/gdb.chill/misc.exp b/gdb/testsuite/gdb.chill/misc.exp new file mode 100644 index 0000000..684c34d --- /dev/null +++ b/gdb/testsuite/gdb.chill/misc.exp @@ -0,0 +1,100 @@ +# Copyright (C) 1995, 1997 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 was written by Fred Fish. (fnf@cygnus.com) +# Martin Pottendorfer (pottendo@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "misc" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto dummyfunc + # check upper/lower case + gdb_test "ptype BOOL" " = (bool|BOOL)" + gdb_test "ptype bool" " = (bool|BOOL)" + gdb_test "print otto" " = 42" + gdb_test "print OTTO" " = 42" + gdb_test "print otTO" " = 42" + gdb_test "print OTto" " = 42" + gdb_test "print NULL" " = NULL" "print emptiness literal" + + # This tests PR 8496. + gdb_test {printf "%d %d.", 3+4,2} "7 2." "printf with 2 arguments" + + # This tests GCH/924 + gdb_test {print (h'23)} { = 35} "print parantised integer literal" + + # Linux thinks this is at line 6, but is otherwise ok. + setup_xfail "i*86-pc-linux*-gnu" + gdb_test "info line" \ + {Line 7 of .*misc.ch.* at address H'[0-9a-fA-F]+.*}\ + "info about current line" + + # check array () type (expr) + setup_xfail "m68*-*-hpux*" + gdb_test "print array () ubyte (foo)" { = \[\(0:11\): 0\]} + + send_gdb "set var \$i := foo\n" + gdb_expect -re ".*$gdb_prompt $" + setup_xfail "m68*-*-hpux*" + gdb_test "print/x array () byte (\$i)" { = \[\(0:11\): H'0\]} +} diff --git a/gdb/testsuite/gdb.chill/powerset.ch b/gdb/testsuite/gdb.chill/powerset.ch new file mode 100644 index 0000000..dd3172d --- /dev/null +++ b/gdb/testsuite/gdb.chill/powerset.ch @@ -0,0 +1,33 @@ +-- +-- check powerset operators and built-ins +-- + +ps: MODULE + +SYNMODE m_ps1 = POWERSET ULONG (0:8); +DCL v_ps1 m_ps1 INIT := [1,3,5,7]; + +SYNMODE m_ps2 = POWERSET LONG (-100:100); +DCL v_ps2 m_ps2 INIT := [ -100:-95, -1:1, 95:100]; + +SYNMODE m_set = SET (aa, bb, cc, dd, ee, ff, gg, hh, ii, jj); +SYNMODE m_ps3 = POWERSET m_set; +DCL v_ps3 m_ps3 INIT := [bb, dd, ff, ii]; + +SYNMODE m_ps4 = POWERSET CHAR(' ':'z'); +DCL v_ps4 m_ps4 INIT := [ '.', ',', 'A':'F', 'x':'z' ]; + +SYNMODE m_ps5 = POWERSET BOOL; +DCL v_ps5 m_ps5 INIT := [ FALSE ]; +DCL v_ps51 m_ps5 INIT := [ ]; + +SYNMODE m_int_range = INT(-100:100); +SYNMODE m_int_subrange = m_int_range(-50:50); +SYNMODE m_ps6 = POWERSET m_int_subrange; +DCL v_ps6 m_ps6 INIT := [ LOWER(m_int_subrange):UPPER(m_int_subrange) ]; + +DCL x INT; + +x := 25; + +END ps; diff --git a/gdb/testsuite/gdb.chill/powerset.exp b/gdb/testsuite/gdb.chill/powerset.exp new file mode 100644 index 0000000..f047507 --- /dev/null +++ b/gdb/testsuite/gdb.chill/powerset.exp @@ -0,0 +1,187 @@ +# Copyright (C) 1995, 1997 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 "powerset" +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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break xx_\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_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_gdb 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 gdb_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 +} + +proc test_card {} { + global passcount + + verbose "testing builtin CARD" + set passcount 0 + + # discrete mode names + test_print_accept "print card(v_ps1)" "4" + test_print_accept "print card(v_ps2)" "15" + test_print_accept "print card(v_ps3)" "4" + test_print_accept "print card(v_ps4)" "11" + test_print_accept "print card(v_ps5)" "1" + test_print_accept "print card(v_ps51)" "0" + test_print_accept "print card(v_ps6)" "101" + + # a failure + setup_xfail "*-*-*" + test_print_accept "print card(m_ps1)" "typename in invalid context" +} + +proc test_min {} { + global passcount + + verbose "testing builtin MIN" + set passcount 0 + + # discrete mode names + test_print_accept "print min(v_ps1)" "1" + test_print_accept "print min(v_ps2)" "-100" + test_print_accept "print min(v_ps3)" "bb" + test_print_accept "print min(v_ps4)" "','" + test_print_accept "print min(v_ps5)" "FALSE" + test_print_accept "print min(v_ps6)" "-50" + + # a failure + setup_xfail "*-*-*" + test_print_accept "print min(v_ps51)" "MIN for empty powerset" + setup_xfail "*-*-*" + test_print_accept "print min(m_ps1)" "typename in invalid context" +} + +proc test_max {} { + global passcount + + verbose "testing builtin MIN" + set passcount 0 + + # discrete mode names + test_print_accept "print max(v_ps1)" "7" + test_print_accept "print max(v_ps2)" "100" + test_print_accept "print max(v_ps3)" "ii" + test_print_accept "print max(v_ps4)" "'z'" + test_print_accept "print max(v_ps5)" "FALSE" + test_print_accept "print max(v_ps6)" "50" + + # test an IN + test_print_accept "print 0 in v_ps6" "TRUE" + + # a failure + setup_xfail "*-*-*" + test_print_accept "print max(v_ps51)" "MAX for empty powerset" +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if [set_lang_chill] then { + # test builtins as described in chapter 6.20.3 Z.200 + test_card + test_min + test_max +} else { + warning "$test_name tests suppressed." +} diff --git a/gdb/testsuite/gdb.chill/pr-4975-grt.ch b/gdb/testsuite/gdb.chill/pr-4975-grt.ch new file mode 100644 index 0000000..7796362 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-4975-grt.ch @@ -0,0 +1,13 @@ +gdb_bug_grt: MODULE +NEWMODE is_channel_type = SET (chan_1, + chan_2, + chan_3, + chan_4, + chan_5, + chan_6, + chan_7, + chan_8, + chan_9, + chan_10); +GRANT is_channel_type; +END; diff --git a/gdb/testsuite/gdb.chill/pr-4975.ch b/gdb/testsuite/gdb.chill/pr-4975.ch new file mode 100644 index 0000000..dbba064 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-4975.ch @@ -0,0 +1,43 @@ +/* +>Number: 4975 +>Category: chill +>Synopsis: Segmentation fault of gdb 4.12.1 +>Description: + + Problem: gdb 4.12.1 segment faults with following chill program. +*/ + +gdb_bug: MODULE + +<> USE_SEIZE_FILE "pr-4975-grt.grt" <> +SEIZE is_channel_type; + + SYNMODE chan_type = POWERSET is_channel_type; + SYN hugo chan_type = [chan_1, chan_3]; + +DCL otto is_channel_type := chan_2; + +x: PROC (); + + IF otto IN hugo THEN + WRITETEXT (STDOUT, "otto IN hugo%/"); + ELSE + WRITETEXT (STDOUT, "You loose%/"); + FI; +END x; + +x (); + +END gdb_bug; +/* +Compiled with: + + chill -S -fgrant-only pr-315-grt.ch + chill -g -o pr-315 pr-315.ch + +Run gdb with + + gdb pr-315 --readnow + +will result in a sigsegv in file gdbtypes.c function force_to_range_type. +*/ diff --git a/gdb/testsuite/gdb.chill/pr-4975.exp b/gdb/testsuite/gdb.chill/pr-4975.exp new file mode 100644 index 0000000..f59e7dc --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-4975.exp @@ -0,0 +1,67 @@ +# Copyright (C) 1992, 1994, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile2 "pr-4975-grt" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-4975" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + # This is needed (at least on SunOS4) to make sure the + # the symbol table is read. + runto "x" + # "You loose"? Why, thank you. (But I suspect "You lose" might have + # been what was intended). + gdb_test "finish" "You loose.*" "Runs and reads symbols OK" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-5016.ch b/gdb/testsuite/gdb.chill/pr-5016.ch new file mode 100644 index 0000000..16f49e8 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5016.ch @@ -0,0 +1,24 @@ +vector: MODULE + +SYNMODE m_index = RANGE(1:10); +NEWMODE vector = ARRAY (m_index) INT; + +DCL a, b, c vector; + +dump: PROC( a vector LOC, c CHAR ); + DCL i m_index := 5; + DO FOR i IN m_index; + WRITETEXT( STDOUT, "%C(%C)=%C ", c, i, a(i) ); + OD; + WRITETEXT( STDOUT, "%/" ); +END dump; + +a := vector [ 1, -1, 2, -2, 3, -3, 4, -4, 5, -5 ]; +b := a; +b(4) := 4; +b(7) := 7; +c := vector [(*): 0]; + +dump(a,'a'); + +END vector; diff --git a/gdb/testsuite/gdb.chill/pr-5016.exp b/gdb/testsuite/gdb.chill/pr-5016.exp new file mode 100644 index 0000000..4384d8c --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5016.exp @@ -0,0 +1,62 @@ +# Copyright (C) 1992, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-5016" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto dump + # Linux thinks type is "_cint" (and so does sparc-sun-sunos4, alpha-dec-osf2.0) + #setup_xfail "i*86-pc-linux*-gnu" "sparc-sun-sunos4*" "alpha-dec-osf2*" + gdb_test "whatis i" "type = m_index" "whatis int-range" + gdb_test_exact "ptype m_index" "type = RANGE (1:10)" "ptype m_index" + gdb_test_exact "whatis a" "type = /*LOC*/ vector" + gdb_test "ptype a" "type = /\\*LOC\\*/ ARRAY \\(1:10\\) (INT|int)" + gdb_test "step" "" + gdb_test_exact "whatis i" "type = long" "whatis loop counter i" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-5020.ch b/gdb/testsuite/gdb.chill/pr-5020.ch new file mode 100644 index 0000000..6aba793 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5020.ch @@ -0,0 +1,19 @@ + +PR_5020: MODULE + dummy_pr_5020: PROC (); + END; + NEWMODE x = STRUCT (l LONG, b BOOL); + NEWMODE aset = SET (aa, bb); + + DCL y ARRAY ('a':'b') x; + DCL setarr ARRAY (aset) x; + DCL intarr ARRAY(10:11) x; + DCL boolarr ARRAY (BOOL) x; + + y('a').l, setarr(aa).l, intarr(10).l, boolarr(FALSE).l := 10; + y('a').b, setarr(aa).b, intarr(10).b, boolarr(FALSE).b := TRUE; + y('b').l, setarr(bb).l, intarr(11).l, boolarr(TRUE).l := 111; + y('b').b, setarr(bb).b, intarr(11).b, boolarr(TRUE).b := FALSE; + + dummy_pr_5020 (); +END; diff --git a/gdb/testsuite/gdb.chill/pr-5020.exp b/gdb/testsuite/gdb.chill/pr-5020.exp new file mode 100644 index 0000000..1adece3 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5020.exp @@ -0,0 +1,85 @@ +# Copyright (C) 1992, 1994, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-5020" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + # This is needed (at least on SunOS4) to make sure the + # the symbol table is read. + gdb_test "break chillvars.ch:3" "" + gdb_test "delete 1" "" + + gdb_test "set width 0" "" + gdb_test "set print sevenbit-strings" "" + gdb_test "set print address off" "" + + test_pr_5020 +} + +proc test_pr_5020 {} { + global gdb_prompt + runto dummy_pr_5020 + gdb_test_exact "print y" \ + {= [('a'): [.l: 10, .b: TRUE], ('b'): [.l: 111, .b: FALSE]]} + gdb_test_exact "print boolarr" \ + {= [(FALSE): [.l: 10, .b: TRUE], (TRUE): [.l: 111, .b: FALSE]]} + gdb_test_exact "print intarr" \ + {= [(10): [.l: 10, .b: TRUE], (11): [.l: 111, .b: FALSE]]} + gdb_test_exact "print setarr" \ + {= [(aa): [.l: 10, .b: TRUE], (bb): [.l: 111, .b: FALSE]]} + gdb_test "set print pretty" "" + gdb_test_exact "print y" \ +{= [('a'): [
+ .l: 10,
+ .b: TRUE
+ ], ('b'): [
+ .l: 111,
+ .b: FALSE
+ ]]} "print y pretty" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-5022.ch b/gdb/testsuite/gdb.chill/pr-5022.ch new file mode 100644 index 0000000..aeaad4e --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5022.ch @@ -0,0 +1,12 @@ +PR_5022: MODULE + dummy_pr_5022: PROC (); + END; + DCL p PTR; + DCL i INT; + + p := NULL; + dummy_pr_5022 (); + i := 13; + p := ->i; + dummy_pr_5022 (); +END; diff --git a/gdb/testsuite/gdb.chill/pr-5022.exp b/gdb/testsuite/gdb.chill/pr-5022.exp new file mode 100644 index 0000000..097e386 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5022.exp @@ -0,0 +1,70 @@ +# Copyright (C) 1992, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-5022" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + # This is needed (at least on SunOS4) to make sure the + # the symbol table is read. + gdb_test "break gdbme.ch:3" "" + gdb_test "delete 1" "" + + gdb_test "set width 0" "" + gdb_test "set print sevenbit-strings" "" + + test_pr_5022 +} + +proc test_pr_5022 {} { + global gdb_prompt + runto dummy_pr_5022 + gdb_test "p p" " = NULL" "print NULL pointer" + gdb_test "continue" "" + gdb_test "p p" {= PTR\(H'[0-9a-fA-F]+\)} "print non-NULL pointer" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-5646-grt.ch b/gdb/testsuite/gdb.chill/pr-5646-grt.ch new file mode 100644 index 0000000..b7a9002 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5646-grt.ch @@ -0,0 +1,5 @@ +x: MODULE +NEWMODE a_set = SET (a, b, c, d); +NEWMODE a_ps = POWERSET a_set; +GRANT a_ps; +END; diff --git a/gdb/testsuite/gdb.chill/pr-5646.ch b/gdb/testsuite/gdb.chill/pr-5646.ch new file mode 100644 index 0000000..8c14cb8 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5646.ch @@ -0,0 +1,15 @@ +y: MODULE + +<> USE_SEIZE_FILE "pr-5646-grt.grt" <> +SEIZE a_ps; + +p: PROC (); + + DCL xx a_ps; + + xx := [a, b]; +END p; + +p(); + +END y; diff --git a/gdb/testsuite/gdb.chill/pr-5646.exp b/gdb/testsuite/gdb.chill/pr-5646.exp new file mode 100644 index 0000000..958b36a --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5646.exp @@ -0,0 +1,64 @@ +# Copyright (C) 1992, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile2 "pr-5646-grt" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-5646" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto p + gdb_test "next" "" + gdb_test_exact "print xx" {= [a:b]} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-5984.ch b/gdb/testsuite/gdb.chill/pr-5984.ch new file mode 100644 index 0000000..3e74a56 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5984.ch @@ -0,0 +1,8 @@ +x: module -- line 1 + p:proc (t char (20) varying); -- 2 + writetext(stdout, t); -- 3 + end p; -- 4 + -- 5 + p("Jason Dark.%/"); -- 6 + p("Hello World.%/"); -- 7 +end x; diff --git a/gdb/testsuite/gdb.chill/pr-5984.exp b/gdb/testsuite/gdb.chill/pr-5984.exp new file mode 100644 index 0000000..f8ea37e --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-5984.exp @@ -0,0 +1,57 @@ +# Copyright (C) 1992, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-5984" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language chill\n" ; + + gdb_test "break pr-5984.ch:6" "" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*pr-5984.ch:6" + gdb_expect -re "$gdb_prompt $" + gdb_test "next" "Jason Dark.*" "next over Jason Dark" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-6292.ch b/gdb/testsuite/gdb.chill/pr-6292.ch new file mode 100644 index 0000000..c2ed953 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-6292.ch @@ -0,0 +1,17 @@ +hack : module + +dcl i int; + +fred : proc (a int in, b int loc); + writetext(stdout, "a was '%C'; b was '%C'.%/", a, b); + b + := 1; +end fred; + +klaus : proc (); + writetext(stdout, "here's klaus calling.%/"); +end klaus; + +i:=12; +writetext(stdout, "done.%/"); + +end hack; diff --git a/gdb/testsuite/gdb.chill/pr-6292.exp b/gdb/testsuite/gdb.chill/pr-6292.exp new file mode 100644 index 0000000..db276b8 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-6292.exp @@ -0,0 +1,58 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-6292" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language chill\n" ; + + gdb_test "break pr-6292.ch:15" "" + send_gdb "run\n"; gdb_expect -re "Breakpoint .*pr-6292.ch:15.*$gdb_prompt $" + gdb_test_exact "call klaus()" {here's klaus calling.} + gdb_test {set fred(10, i)} {a was '10'; b was '12'.} + gdb_test "print i" { = 13} "print i after call" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-6632-grt.ch b/gdb/testsuite/gdb.chill/pr-6632-grt.ch new file mode 100644 index 0000000..e9434f1 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-6632-grt.ch @@ -0,0 +1,34 @@ +markus1: MODULE + +SYNMODE m_dummy = SET (dummy_1, + dummy_2, + dummy_3, + dummy_4, + dummy_5, + dummy_6, + dummy_7, + dummy_8, + dummy_9, + dummy_10, + dummy_11, + dummy_12, + dummy_13, + dummy_14, + dummy_15, + dummy_16, + dummy_17, + dummy_18, + dummy_19, + dummy_20, + dummy_21, + dummy_22, + dummy_23, + dummy_24, + dummy_25, + dummy_26); + +SYNMODE m_dummy_range = m_dummy(dummy_6 : dummy_22); + +GRANT m_dummy, m_dummy_range; + +END markus1; diff --git a/gdb/testsuite/gdb.chill/pr-6632.ch b/gdb/testsuite/gdb.chill/pr-6632.ch new file mode 100644 index 0000000..b82c7ae --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-6632.ch @@ -0,0 +1,31 @@ +markus: MODULE + +<> USE_SEIZE_FILE "pr-6632-grt.grt" <> +SEIZE m_dummy, m_dummy_range; + +DCL v m_dummy_range; + +NEWMODE is_str_descr = STRUCT (p PTR, + l INT, + flag STRUCT (x UBYTE, + y SET (aa, bb, cc, dd, ee, ff))); +DCL des is_str_descr; + +NEWMODE is_cb_debug = STRUCT (i INT, + channel m_dummy_range, + p PTR); +NEWMODE is_cb_debug_array = ARRAY (0:20) is_cb_debug; +DCL cb_debug is_cb_debug_array; +DCL cb_debug_index INT := 0; + +p: PROC (pp is_str_descr IN, x m_dummy_range IN) + DO WITH cb_debug(cb_debug_index); + channel := x; + OD; +END p; + +p (des, dummy_10); +WRITETEXT (stdout, "cb_debug(%C).channel := %C%/", + cb_debug_index, cb_debug(cb_debug_index).channel); + +END markus; diff --git a/gdb/testsuite/gdb.chill/pr-6632.exp b/gdb/testsuite/gdb.chill/pr-6632.exp new file mode 100644 index 0000000..03e342c --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-6632.exp @@ -0,0 +1,66 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + + +if [skip_chill_tests] then { continue } + +set testfile2 "pr-6632-grt" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-6632" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} ${objfile2} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto p + gdb_test "whatis x" {type = m_dummy_range} + gdb_test_exact "ptype x" {type = m_dummy (dummy_6:dummy_22)} + gdb_test "print x" { = dummy_10} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-8134.exp b/gdb/testsuite/gdb.chill/pr-8134.exp new file mode 100644 index 0000000..5bbd66c --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8134.exp @@ -0,0 +1,65 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +# Note we use pr-8136.ch for pr-8134.exp as well as pr-8136.exp. +set testfile2 "func1" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-8134" +set srcfile ${srcdir}/$subdir/pr-8136.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto p1 + gdb_test "print first" "= 1" + gdb_test "print last" "= 10" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-8136.ch b/gdb/testsuite/gdb.chill/pr-8136.ch new file mode 100644 index 0000000..b380110 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8136.ch @@ -0,0 +1,34 @@ +-- NOTE: This test is used for pr-3134.exp as well as pr-8136. +func: MODULE + +<> USE_SEIZE_FILE "func1.grt" <> +SEIZE ALL; + +NEWMODE m_struct = STRUCT (i LONG, str CHARS(50) VARYING); +DCL insarr ARRAY (1:10) INT; + +DCL setrange m_setrange := e5; + +DCL ps m_ps := [ e3, e7:e9 ]; +DCL range_ps m_rangeps := [ 2, 3, 4, 28 ]; + +p1: PROC (first INT IN, last INT IN, s m_struct IN); + + DCL foo LONG := 3; + + startall: PROC () + DO FOR i := first to last; + insarr(i) := i; + OD; + DO FOR i := first TO last; + WRITETEXT (stdout, "insarr(%C) := %C%/", i, insarr(i)); + OD; + END startall; + + startall (); + +END p1; + +p1 (LOWER (insarr), UPPER (insarr), [ 10, "This is a string." ]); + +END func; diff --git a/gdb/testsuite/gdb.chill/pr-8136.exp b/gdb/testsuite/gdb.chill/pr-8136.exp new file mode 100644 index 0000000..7bf360c --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8136.exp @@ -0,0 +1,63 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile2 "func1" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-8136" +set srcfile ${srcdir}/$subdir/pr-8136.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto p1 + gdb_test "print ps" {= \[e3, e7:e9\]} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-8405.ch b/gdb/testsuite/gdb.chill/pr-8405.ch new file mode 100644 index 0000000..a9b2531 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8405.ch @@ -0,0 +1,19 @@ +emptybit: MODULE + +SYNMODE b8 = BOOLS(8); +SYN bit8 b8 = B'00000000'; + +SYNMODE char_m = CHARS(40) VARYING; + +SYNMODE stru_m = STRUCT (c char_m, b b8, boo BOOL); +DCL xx stru_m; + +SYNMODE m_stru = STRUCT (c char_m, i LONG, boo BOOL); +DCL yy m_stru; + +SYNMODE m_arr = ARRAY (1:10) LONG; +DCL zz m_arr; + +WRITETEXT (stdout, "%C%/", bit8); + +END emptybit; diff --git a/gdb/testsuite/gdb.chill/pr-8405.exp b/gdb/testsuite/gdb.chill/pr-8405.exp new file mode 100644 index 0000000..dff230e --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8405.exp @@ -0,0 +1,61 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_load $binfile + + gdb_test "set language chill" "" + gdb_test "set var \$i:=xx" "" + gdb_test "print \$i" {= \[.c: "", .b: B'00000000', .boo: FALSE\]} +} + +if [skip_chill_tests] then { continue } + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "pr-8405" +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 +} + +if ![file exists $binfile] then { + warning "$binfile does not exist; tests suppressed." 0 +} else { + do_tests +} diff --git a/gdb/testsuite/gdb.chill/pr-8742.ch b/gdb/testsuite/gdb.chill/pr-8742.ch new file mode 100644 index 0000000..0541149 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8742.ch @@ -0,0 +1,32 @@ +hugo : module + + synmode a = range(1:10); + synmode p = powerset a; + + synmode s = set (sa, sb, sc); + synmode s_ps = powerset s; + + x: proc (ps p); + dcl i a; + do for i in ps; + writetext (stdout, "%C ", i); + od; + writetext(stdout, "%/"); + end x; + + y : proc (ps s_ps); + dcl i s; + do for i in ps; + writetext (stdout, "%C ", i); + od; + writetext(stdout, "%/"); + end y; + + dummy: proc (); + end dummy; + + x([1,2,3]); + y([sa, sc]); + dummy (); + +end hugo; diff --git a/gdb/testsuite/gdb.chill/pr-8742.exp b/gdb/testsuite/gdb.chill/pr-8742.exp new file mode 100644 index 0000000..ee49c28 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8742.exp @@ -0,0 +1,64 @@ +# Copyright (C) 1992, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-8742" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto dummy + + # Haven't investigated why these fail on mips-sgi-irix* + setup_xfail "m68*-*-hpux*" "mips*-sgi-irix*" + gdb_test {call x(p [1, 3, 5])} "1 3 5 " "pass int powerset tuple" + setup_xfail "mips*-sgi-irix*" + gdb_test {call y(s_ps [sc])} "sc " "pass set powerset tuple" + setup_xfail "m68*-*-hpux*" "mips*-sgi-irix*" + gdb_test {call x([1, 3, 5])} "1 3 5 " "pass modeless int powerset tuple" + setup_xfail "mips*-sgi-irix*" + gdb_test {call y([sc])} "sc " "pass modeless set powerset tuple" +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-8894-grt.ch b/gdb/testsuite/gdb.chill/pr-8894-grt.ch new file mode 100644 index 0000000..5720170 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8894-grt.ch @@ -0,0 +1,6 @@ +yy: MODULE + +SYNMODE m_byte = INT (0:255); +GRANT ALL; + +END yy; diff --git a/gdb/testsuite/gdb.chill/pr-8894.ch b/gdb/testsuite/gdb.chill/pr-8894.ch new file mode 100644 index 0000000..391d56b --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8894.ch @@ -0,0 +1,12 @@ +xx: MODULE + +<> USE_SEIZE_FILE "pr-8894-grt.grt" <> +SEIZE m_byte; + +SYNMODE m_struct = STRUCT (a, b, c m_byte); + +DCL v m_struct; + +v.a := 100; + +END xx; diff --git a/gdb/testsuite/gdb.chill/pr-8894.exp b/gdb/testsuite/gdb.chill/pr-8894.exp new file mode 100644 index 0000000..adef6f6 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-8894.exp @@ -0,0 +1,61 @@ +# Copyright (C) 1996, 1997 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 + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile2 "pr-8894-grt" +set srcfile2 ${srcdir}/$subdir/${testfile2}.ch +set objfile2 ${objdir}/$subdir/${testfile2}.o +if { [compile "${srcfile2} -g -c -o ${objfile2}"] != "" } { + perror "Couldn't compile ${srcfile2}" + return -1 +} + +set testfile "pr-8894" +set srcfile ${srcdir}/$subdir/$testfile.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g ${objfile2} -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + gdb_test "print size(m_byte)" { = 2} + gdb_test "print size(m_struct)" { = 6} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/pr-9095.ch b/gdb/testsuite/gdb.chill/pr-9095.ch new file mode 100644 index 0000000..61ffb70 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-9095.ch @@ -0,0 +1,13 @@ +gdb1: MODULE + +SYNMODE m_arr1 = ARRAY (1:10) UBYTE; +SYNMODE m_struct = STRUCT ( i LONG, + p REF m_arr1); +SYNMODE m_arr2 = ARRAY (0:10) REF m_struct; + +DCL v_arr1 m_arr1 INIT := [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]; +DCL v_struct m_struct INIT := [ 10, ->v_arr1 ]; +DCL v_arr2 m_arr2 INIT := [ (5): ->v_struct, (ELSE): NULL ]; + +WRITETEXT (stdout, "v_arr2(5)->.p->(5) = %C%/", v_arr2(5)->.p->(5)); +END gdb1; diff --git a/gdb/testsuite/gdb.chill/pr-9095.exp b/gdb/testsuite/gdb.chill/pr-9095.exp new file mode 100644 index 0000000..4c5ce97 --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-9095.exp @@ -0,0 +1,62 @@ +# Copyright (C) 1996, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_load $binfile + + gdb_test "set language chill" "" + runto pr-9095.ch:12 + gdb_test {p v_arr2(5)->.p(5)} "reference value used as function" \ + "bad call using pointer" +} + +if [skip_chill_tests] then { continue } + +# Check to see if we have an executable to test. If not, then either we +# haven't tried to compile one, or the compilation failed for some reason. +# In either case, just notify the user and skip the tests in this file. + +set testfile "pr-9095" +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 +} + +if ![file exists $binfile] then { + warning "$binfile does not exist; tests suppressed." 0 +} else { + do_tests +} diff --git a/gdb/testsuite/gdb.chill/pr-9946.ch b/gdb/testsuite/gdb.chill/pr-9946.ch new file mode 100644 index 0000000..3d9210a --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-9946.ch @@ -0,0 +1,10 @@ +x: module + +synmode aset = SET (stopped, moving); + +DCL xyz aset; + +xyz := moving; +xyz := SUCC (xyz); + +END x; diff --git a/gdb/testsuite/gdb.chill/pr-9946.exp b/gdb/testsuite/gdb.chill/pr-9946.exp new file mode 100644 index 0000000..b6b592f --- /dev/null +++ b/gdb/testsuite/gdb.chill/pr-9946.exp @@ -0,0 +1,79 @@ +# Copyright (C) 1995, 1997 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 was written by Fred Fish. (fnf@cygnus.com) +# Martin Pottendorfer (pottendo@aut.alcatel.at) +# + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "pr-9946" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + return [gdb_test "show language" ".* source language is \"chill\".*" \ + "set language to \"chill\""] +} + +set prms_id 0 +set bug_id 0 + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if ![set_lang_chill] then { + runto x_ + gdb_test "next" "" + # check comparison of SET's + gdb_test {print xyz=moving} { = TRUE} + gdb_test {print xyz/=moving} { = FALSE} + gdb_test {print xyz<moving} { = FALSE} + gdb_test {print xyz<=moving} { = TRUE} + gdb_test {print xyz>moving} { = FALSE} + gdb_test {print xyz>=moving} { = TRUE} +} diff --git a/gdb/testsuite/gdb.chill/result.ch b/gdb/testsuite/gdb.chill/result.ch new file mode 100644 index 0000000..b8c65e7 --- /dev/null +++ b/gdb/testsuite/gdb.chill/result.ch @@ -0,0 +1,29 @@ +test_result: MODULE + + DCL i INT := 5; + + SYNMODE m_struct = STRUCT (l LONG, b BOOL); + DCL v_struct m_struct := [ 20, TRUE ]; + + simple_func: PROC () RETURNS (INT); + DCL j INT := i; + RESULT 10; + i + := 2; + RESULT j + 2; + i + := 2; + END simple_func; + + ret_struct: PROC () RETURNS (m_struct) + DCL v m_struct := [ 33, FALSE ]; + RESULT v; + v.l := 18; + END ret_struct; + + i := simple_func (); + i := simple_func (); + i * := 10; + + v_struct := ret_struct (); + + i := 33; -- for gdb +END test_result; diff --git a/gdb/testsuite/gdb.chill/result.exp b/gdb/testsuite/gdb.chill/result.exp new file mode 100644 index 0000000..64ca335 --- /dev/null +++ b/gdb/testsuite/gdb.chill/result.exp @@ -0,0 +1,77 @@ +# Copyright (C) 1994, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "result" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + gdb_test "set width 0" "" + gdb_test "set print sevenbit-strings" "" + gdb_test "set print address off" "" + + # simple function + runto simple_func + gdb_test "step 2" "" + gdb_test "print j" "= 5" + gdb_test "p RESULT" "= 10" + gdb_test "continue" "" + gdb_test "print i" "= 7" + gdb_test "step 4" "" + gdb_test "set RESULT := 50" "" + gdb_test "finish" "" + gdb_test "step" "" + gdb_test "print i" "= 50" + + # returning a structure + runto ret_struct + gdb_test "step 2" "" + gdb_test "p result" {\[.l: 33, .b: FALSE\]} + gdb_test "set var result := \[383, TRUE\]" "" + gdb_test "finish" "" + gdb_test "p v_struct" {\[.l: 383, .b: TRUE\]} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/string.ch b/gdb/testsuite/gdb.chill/string.ch new file mode 100644 index 0000000..3503c46 --- /dev/null +++ b/gdb/testsuite/gdb.chill/string.ch @@ -0,0 +1,24 @@ +ss: MODULE + +/* These declarations are from Cygnus PR chill/9078. */ + SYNMODE m_char20 = CHARS(20) VARYING; + + DCL foo m_char20 INIT := "Moser "; + DCL bar m_char20 INIT := "Wilfried"; + + DCL foo1 CHARS(5) INIT := "12345"; + DCL bar1 CHARS(5) INIT := "abcde"; + +/* This is Cynus PR chill/5696. */ + +DCL s20 CHARS(20) VARYING; + +DCL s10 CHARS(10); + + +s20 := "Moser Wilfried"; +S10 := "1234567890"; + +WRITETEXT (stdout, "s20 := ""%C"", s10 := ""%C""%/", s20, s10); + +END ss; diff --git a/gdb/testsuite/gdb.chill/string.exp b/gdb/testsuite/gdb.chill/string.exp new file mode 100644 index 0000000..dabd7e9 --- /dev/null +++ b/gdb/testsuite/gdb.chill/string.exp @@ -0,0 +1,73 @@ +# Copyright (C) 1995, 1997 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 + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "string" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + # These tests based on Cygnus PR chill/5696. + runto string.ch:22 + gdb_test "p s20" { = "Moser Wilfried"} "print simple vstring" + gdb_test "p s20(1)" { = 'o'} "print vstring element" + gdb_test "p s20(1:3)" { = "ose"} "print vstring slice (:)" + gdb_test "p s20(2 up 3)" { = "ser"} "print vstring slice (up)" + gdb_test "p s10" { = "1234567890"} "print simple string" + gdb_test "p s10(1)" { = '2'} "print string element" + gdb_test "p s10(1:3)" { = "234"} "print string slice (:)" + gdb_test "p s10(2 up 3)" { = "345"} "print string slice (up)" + + gdb_test "p length(s10)" { = 10} "print string length" + gdb_test "p length(s20)" { = 14} "print varying string length" + gdb_test "p lower(s10)" { = 0} "print string lower" + gdb_test "p upper(s10)" { = 9} "print string upper" + gdb_test "p lower(s20)" { = 0} "print varying string lower" + gdb_test "p upper(s20)" { = 19} "print varying string upper" + + # These tests are based on Cygnus PR chill/9078. + gdb_test "print foo // bar" { = "Moser Wilfried"} + gdb_test "print foo // bar1" { = "Moser abcde"} + gdb_test "print foo1 // bar1" { = "12345abcde"} +} + +do_tests diff --git a/gdb/testsuite/gdb.chill/tests1.ch b/gdb/testsuite/gdb.chill/tests1.ch new file mode 100644 index 0000000..b545d07 --- /dev/null +++ b/gdb/testsuite/gdb.chill/tests1.ch @@ -0,0 +1,240 @@ +-- 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(aaa, bbb, ccc); +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(bbb : ccc); +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 chars(20), + (52): ch2 chars(10) + else ch3 chars(1) + esac); + +newmode stru2m = struct (f set1, + case f of + (aaa): ch1 char(20), + (bbb): ch2 char(10) varying + else ch3 char(0) varying + esac); +newmode stru3m = struct (f r3, + case f of + (na): ch1 char(20) + esac); +newmode stru4m = struct (i long, + case of + : i1, i11 int, + b1 bool, + c1 char, + : i2, i22 long, + bs2 bools (10), + : + s3 struct (i3 int, + case of + : foo long + else bar char + esac) + else + x stru2m + esac, + y stru3m); + +synmode m_xyzmode = struct (next ref m_xyzmode, + i long); + +-- set mode locations +dcl s1l set1 := ccc; +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..3ede1eb --- /dev/null +++ b/gdb/testsuite/gdb.chill/tests1.exp @@ -0,0 +1,822 @@ +# Copyright (C) 1995, 1997 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 gdb_prompt + global binfile objdir subdir + + verbose "loading file '$binfile'" + gdb_load $binfile + send_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break dummyfunc\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_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_gdb 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 gdb_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 +} + +# 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. + +# 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 \[(\]aaa, bbb, ccc\[)\]" \ + "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 \\(bbb:ccc\\)" \ + "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 OF.*:.*ch1 CHARS \\(20\\).*:.*ch2 CHARS \\(10\\).*ELSE.*ch3 CHARS \\(1\\).*ESAC.*\\)" \ + "print structure mode 1" + #setup_xfail "*-*-*" + test_print_accept "ptype stru2m" "STRUCT \\(.*f set1,.*CASE OF.*:.*ch1 CHARS \\(20\\).*:.*ch2 CHARS \\(10\\) VARYING.*ELSE.*ch3 CHARS \\(0\\) VARYING.*ESAC.*\\)" \ + "print structure mode 2" + #setup_xfail "*-*-*" + test_print_accept "ptype stru3m" "STRUCT \\(.*f r3,.*CASE OF.*:.*ch1 CHARS \\(20\\).*ESAC.*\\)" \ + "print structure mode 3" + # setup_xfail "*-*-*" + 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.*\\)" \ + "print structure mode 4" + + + 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 \\(aaa, bbb, ccc\\)" \ + "print mode of set location" + test_print_accept "whatis s1l" "set1" \ + "print modename of set location" + test_print_accept "print s1l" "ccc" "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" + # setup_xfail "*-*-*" + test_print_accept "whatis ref3l" "ref3" \ + "print modename of reference location" + # setup_xfail "*-*-*" + test_print_accept "print ref3l" "ref3\\(H'.*\\)" \ + "print reference location" + test_print_accept "ptype ref4l" "PTR" "print mode of reference location" + # setup_xfail "*-*-*" + test_print_accept "whatis ref4l" "ref4" \ + "print modename of reference location" + # setup_xfail "*-*-*" + 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\^\(0\)\"} \ + "print string location" + # string elements + test_print_accept "print strl1(0)" "\'h\'" \ + "print string element 1" + test_print_accept "print strl1(5)" {'\^[(]0[)]'} \ + "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\^\(0\)\"} \ + "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\^\(0\)\"} \ + "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" + gdb_test "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): aaa]} \ + "print array location" + test_print_accept "ptype arrl1(1)" \ + "SET \\(aaa, bbb, ccc\\)" \ + "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 + gdb_test "print arrl3(-1)" \ + ".*out of range.*" \ + "check invalid array indices 1" + gdb_test "print arrl3(6)" \ + ".*out of range.*" \ + "check invalid array indices 2" + gdb_test "print arrl3(0,0)" \ + ".*out of range.*" \ + "check invalid array indices 3" + gdb_test "print arrl3(1,0)" \ + ".*out of range.*" \ + "check invalid array indices 4" + gdb_test "print arrl3(1,4)" \ + ".*out of range.*" \ + "check invalid array indices 5" + gdb_test "print arrl3(6,4)" \ + ".*out of range.*" \ + "check invalid array indices 6" + gdb_test "print arrl3(1,1,0)" \ + ".*out of range.*" \ + "check invalid array indices 7" + gdb_test "print arrl3(6,4,0)" \ + ".*out of range.*" \ + "check invalid array indices 8" + gdb_test "print arrl3(1,1,3)" \ + ".*out of range.*" \ + "check invalid array indices 9" + + gdb_test "print arrl3(0)(0)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 10" + gdb_test "print arrl3(1)(0)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 11" + gdb_test "print arrl3(1)(4)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 12" + gdb_test "print arrl3(6)(4)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 13" + gdb_test "print arrl3(1)(1)(0)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 14" + gdb_test "print arrl3(6)(4)(0)" \ + ".* array or string index out of range.*" \ + "check invalid array indices 15" + gdb_test "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 + gdb_test "print arrl4(5:6)" \ + ".*slice out of range.*" \ + "check invalid range 1" + gdb_test "print arrl4(0:1)" \ + ".*slice out of range.*" \ + "check invalid range 2" + gdb_test "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\"" \ + "print field of structure location 1" + # setup_xfail "*-*-*" + test_print_accept "print strul1.ch3" \ + "\"1\"" \ + "print field of structure location 1" + + if $passcount then { + pass "$passcount correct locations printed" + } +} + +# This is chill/9434 + +proc test_9434 {} { + global passcount + + verbose "testing pr-9434" + + test_print_accept "ptype m_xyzmode" "STRUCT \\(.*next REF m_xyzmode,.*i long.*\\)" +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if [set_lang_chill] then { + test_modes + test_locations + test_9434 +} 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..46c4821 --- /dev/null +++ b/gdb/testsuite/gdb.chill/tests2.exp @@ -0,0 +1,271 @@ +# Copyright (C) 1992, 1995, 1997 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 +} + +if [skip_chill_tests] then { continue } + +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. + +set testfile "tests2" +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 +} + +global infinity +if [istarget "i*86-*-sysv4*"] then { + set infinity "inf" +} else { + set infinity "Infinity" +} + +proc set_lang_chill {} { + global gdb_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_gdb "set language chill\n" + gdb_expect { + -re ".*$gdb_prompt $" {} + timeout { fail "set language chill (timeout)" ; return 0 } + } + + send_gdb "show language\n" + gdb_expect { + -re ".* source language is \"chill\".*$gdb_prompt $" { + pass "set language to \"chill\"" + send_gdb "break dummyfunc\n" + gdb_expect { + -re ".*$gdb_prompt $" { + send_gdb "run\n" + gdb_expect -re ".*$gdb_prompt $" {} + return 1 + } + timeout { + fail "can't set breakpoint (timeout)" + return 0 + } + } + } + -re ".*$gdb_prompt $" { + fail "setting language to \"chill\"" + return 0 + } + timeout { + fail "can't show language (timeout)" + return 0 + } + } +} + +# checks if structure was accessed correctly +proc test_write { args } { + global gdb_prompt + + 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_gdb "set var $location.m$extended := $value\n" + gdb_expect -re ".*$gdb_prompt $" {} + gdb_test "print $location" \ + ".*= \[\[\]\\.p1: 2863311530, \\.m: $matchval, \\.p2: 1431655765\[\]\]"\ + "$message" +} + +# test write access from gdb (setvar x:=y) from gdb +proc write_access { } { + global infinity + + 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" + setup_xfail "i*86-pc-linux-gnu" "m68*-*-hpux*" + 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" + setup_xfail "i*86-pc-linux-gnu" "m68*-*-hpux*" + 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" +} + +# Start with a fresh gdb. + +set binfile "tests2.exe" + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_test "set print sevenbit-strings" ".*" + +if [set_lang_chill] then { + write_access +} else { + warning "$test_name tests suppressed." +} diff --git a/gdb/testsuite/gdb.chill/tuples.ch b/gdb/testsuite/gdb.chill/tuples.ch new file mode 100644 index 0000000..24709f8 --- /dev/null +++ b/gdb/testsuite/gdb.chill/tuples.ch @@ -0,0 +1,86 @@ +x: MODULE + +SYNMODE m_arri = ARRAY(1:5) INT; +DCL v_arri m_arri := [ -1, -2, -3, -4, -5 ]; + +SYNMODE m_arrui = ARRAY(1:5) UINT; +DCL v_arrui m_arrui := [ 1, 2, 3, 4, 5 ]; + +SYNMODE r1 = RANGE (1:5); +SYNMODE m_arrb = ARRAY(r1) BYTE; +DCL v_arrb m_arrb := [ -3, -4, -5, -6, -7 ]; + +SYNMODE m_arrub = ARRAY(r1) UBYTE; +DCL v_arrub m_arrub := [ 3, 4, 5, 6, 7 ]; + +SYNMODE m_arrc = ARRAY (1:5) CHAR; +DCL v_arrc m_arrc := [ '1', '2', '3', '4', '5' ]; + +SYNMODE m_ps = POWERSET r1; +DCL v_ps m_ps := [ 1, 3, 5 ]; + +DCL v_cv CHARS(20) VARYING := "foo"; + +SYNMODE m_arrbool = ARRAY(r1) BOOL; +DCL v_arrbool m_arrbool := [ true, false, true, false, true ]; + +DCL j r1 := 4; + +DCL i INT; + +newmode vstruct = struct (a, b long, + case b of + (42): ch8 chars(20), + (52): i long + else ch1 char + esac); + +DCL vstr vstruct := [ .a: 10, .b: 52, .i: 100 ]; + +i := 0; + +END x; + +setmode: MODULE /* This is from Cygnus PR chill/5024. */ + +NEWMODE day = SET( monday, tuesday, wednesday, thursday, friday, saturday, sunday ); +NEWMODE dow = POWERSET day; + +DCL d day; +DCL w dow; + +printdow: PROC( w dow ); + DCL d day; + DO FOR d in w; + WRITETEXT( stdout, "%C ", d ); + OD; +END; + +d := monday; +w := dow[monday : friday]; +printdow( w ); + +printdow( dow[LOWER(dow) : UPPER(dow)] ); + +END setmode; + +PR8643: MODULE + +SYNMODE m_set = SET (a, b, c, d); +SYNMODE m_ps = POWERSET m_set; + +SYNMODE m_s1 = STRUCT (str CHARS(40) VARYING, i INT, ps m_ps); +DCL vs1 m_s1; + +SYNMODE m_s2 = STRUCT (i LONG, s m_s1); +DCL vs2 m_s2; + +SYNMODE m_arr = ARRAY (1:3) BYTE; +SYNMODE m_s3 = STRUCT (i LONG, a m_arr); +DCL vs3 m_s3; + +DCL i LONG; + +i := 24; + +END PR8643; diff --git a/gdb/testsuite/gdb.chill/tuples.exp b/gdb/testsuite/gdb.chill/tuples.exp new file mode 100644 index 0000000..fbfa9ed --- /dev/null +++ b/gdb/testsuite/gdb.chill/tuples.exp @@ -0,0 +1,161 @@ +# Copyright (C) 1995, 1997 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 was written by Per Bothner. (bothner@cygnus.com) + +if $tracelevel then { + strace $tracelevel +} + +if [skip_chill_tests] then { continue } + +set testfile "tuples" +set srcfile ${srcdir}/$subdir/${testfile}.ch +set binfile ${objdir}/${subdir}/${testfile}.exe +if { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc do_tests {} { + global prms_id bug_id subdir objdir srcdir binfile gdb_prompt + + set prms_id 0 + set bug_id 0 + + # Start with a fresh gdb. + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + gdb_test "set language chill" "" + + runto tuples.ch:40 + + gdb_test_exact "print v_arri" {= [(1): -1, (2): -2, (3): -3, (4): -4, (5): -5]} + gdb_test_exact "set v_arri := \[ 33, 44, 55, 66, 77 \]" {} + gdb_test_exact "print v_arri" {= [(1): 33, (2): 44, (3): 55, (4): 66, (5): 77]} "after assignment 1 to v_arri" + gdb_test_exact "set v_arri := \[-33, -44, -55, -66, -77\]" {} + gdb_test_exact "print v_arri" {= [(1): -33, (2): -44, (3): -55, (4): -66, (5): -77]} {after assignment 2 to v_arri} + + gdb_test_exact "print v_arrui" {= [(1): 1, (2): 2, (3): 3, (4): 4, (5): 5]} + gdb_test_exact "set v_arrui := \[ 11, 11, 11, 11, 11 \]" {} + gdb_test_exact "print v_arrui" {= [(1:5): 11]} "after assignment to v_arrui" + + gdb_test_exact "print v_arrb" {= [(1): -3, (2): -4, (3): -5, (4): -6, (5): -7]} + + gdb_test_exact "set v_arrb := \[ -9, -8, -7, -6, -5 \]" {} + gdb_test_exact "print v_arrb" {= [(1): -9, (2): -8, (3): -7, (4): -6, (5): -5]} "after assignment to v_arrb" + + gdb_test_exact "print v_arrub" {= [(1): 3, (2): 4, (3): 5, (4): 6, (5): 7]} + gdb_test_exact "set v_arrub := \[ 77, 77, 77, 77, 77 \]" {} + gdb_test_exact "print v_arrub" {= [(1:5): 77]} "v_arrub after assignment" + + gdb_test_exact "print j" {= 4} + gdb_test_exact "print j := 3+4" {= 7} + gdb_test_exact "print j := r1(3)" {= 3} + + gdb_test_exact "print v_arrc" {= [(1): '1', (2): '2', (3): '3', (4): '4', (5): '5']} + gdb_test_exact "set v_arrc := \[ 'a', 'b', 'c', 'd', 'e' \]" {} + gdb_test_exact "print v_arrc" {= [(1): 'a', (2): 'b', (3): 'c', (4): 'd', (5): 'e']} "v_arrc after assignment" + + gdb_test_exact "print v_ps" {= [1, 3, 5]} + gdb_test_exact "set v_ps := \[ 2, 4 \]" {} + gdb_test_exact "print v_ps" {= [2, 4]} {v_ps after assignment} + gdb_test_exact "print v_ps := \[\]" {= []} {assign [] to v_ps} + + gdb_test_exact "print m_arri\[1, 2, 3, 4, 5\]" {= [(1): 1, (2): 2, (3): 3, (4): 4, (5): 5]} + gdb_test_exact "print m_arrub\[45, 46, 47, 48, 49\]" {= [(1): 45, (2): 46, (3): 47, (4): 48, (5): 49]} + + gdb_test_exact "print v_cv" {= "foo"} + gdb_test_exact "set v_cv := \"foo-bar\"" {} + gdb_test_exact "print v_cv" {= "foo-bar"} "v_cv after assignment" + gdb_test_exact "set v_cv(3) := ' '" {} + gdb_test_exact "print v_cv" {= "foo bar"} "v_cv after element assignment" + + gdb_test_exact "print v_arrbool" {= [(1): TRUE, (2): FALSE, (3): TRUE, (4): FALSE, (5): TRUE]} + gdb_test_exact "set v_arrbool := \[ false, false, false, false, false \]" {} + gdb_test_exact "print v_arrbool" {= [(1:5): FALSE]} "v_arrbool after assignment 1" + gdb_test_exact "set v_arrbool := \[true, true, true, true, true\]" {} + gdb_test_exact "print v_arrbool" {= [(1:5): TRUE]} "v_arrbool after assignment 2" + gdb_test_exact "set v_arrbool(3) := false" {} + gdb_test_exact "print v_arrbool" {= [(1:2): TRUE, (3): FALSE, (4:5): TRUE]} "v_arrbool after element assignment" + + gdb_test_exact "set v_arrbool(1 up 2) := \[ false, true \]" {} + gdb_test_exact "print v_arrbool" {= [(1): FALSE, (2): TRUE, (3): FALSE, (4:5): TRUE]} "v_arrbool after slice assignment 1" + gdb_test_exact "set v_arrbool(3 : 5) := \[ true, true, false \]" {} + gdb_test_exact "print v_arrbool" {= [(1): FALSE, (2:4): TRUE, (5): FALSE]} "v_arrbool after slice assignment 2" + + gdb_test_exact "set vstr := \[ .a: 2+3, .b: 12, .ch1: 'x' \]" {} + gdb_test_exact "print vstr.a" {= 5} "vstr.a after assignment" + gdb_test_exact "print vstr.ch1" {= 'x'} "vstr.ch1 after assignment" + +# These tests are from Cygnus PR chill/5024: + gdb_test "break printdow" "" + gdb_test "continue" "" + gdb_test_exact "set var w:= dow\[monday\]" {} + gdb_test "print w" " = \\\[monday\\\]" \ + "print bitstring after assignment" + gdb_test_exact "set var w:=\[\]" {} + gdb_test "print w" " = \\\[\\\]" \ + "print bitstring after assignment of \[\]" + +# These tests are from Cygnus PR chill/8643: + runto tuples.ch:40 + gdb_test_exact "set var vs1 := \[ \"foo\", 41, \[ b \] \]" {} + gdb_test_exact "print vs1" { = [.str: "foo", .i: 41, .ps: [b]]} \ + "print vs1 after tuple assign 1" + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact "set var vs1 := \[ \"bar\", 42, m_ps\[ a \] \]" {} + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact "print vs1" { = [.str: "bar", .i: 42, .ps: [a]]} \ + "print vs1 after tuple assign 2" + + gdb_test_exact "set var \$i := m_s1\[\"foo\", 42, \[a \]\]" {} + gdb_test_exact {print $i} { = [.str: "foo", .i: 42, .ps: [a]]} \ + "print \$i after tuple assign 1" + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact "set var \$i := m_s1\[\"foo\", 44, m_ps\[a \]\]" {} + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact {print $i} { = [.str: "foo", .i: 44, .ps: [a]]} \ + "print \$i after tuple assign 2" + + gdb_test_exact "set var vs2 := \[ 10, \[ \"foo\" , 42, \[ b \] \] \]" {} + gdb_test_exact "print vs2" \ + { = [.i: 10, .s: [.str: "foo", .i: 42, .ps: [b]]]} \ + "print vs2 after tuple assign 1" + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact "set var vs2 := \[ 10+3, m_s1\[ \"foo\" , 42, m_ps\[ b \] \] \]" {} + setup_xfail "i*86-pc-linux*-gnu" "sparc-*-solaris*" "sparc-*-sunos*" + gdb_test_exact "print vs2" \ + { = [.i: 13, .s: [.str: "foo", .i: 42, .ps: [b]]]} \ + "print vs2 after tuple assign 2" + + gdb_test_exact "set var vs3 := \[ 33, \[ -1, -2, -3 \] \]" {} + gdb_test_exact "print vs3" {[.i: 33, .a: [(1): -1, (2): -2, (3): -3]]} \ + "print vs3 after tuple assign" + gdb_test_exact "set var \$k := m_s3\[ 33, m_arr\[ 4, 3, 2 \] \]" {} + gdb_test_exact {print $k} { = [.i: 33, .a: [(1): 4, (2): 3, (3): 2]]} \ + "print \$k after tuple assign" + +} + +do_tests |