* result.ch, result.exp, Makefile.in: New test case.
authorPer Bothner <per@bothner.com>
Tue, 14 Jun 1994 23:23:14 +0000 (23:23 +0000)
committerPer Bothner <per@bothner.com>
Tue, 14 Jun 1994 23:23:14 +0000 (23:23 +0000)
* pr-4975.ch, pr-4975-grt.ch, pr-4975.exp, Makefile.in:  Ditto.

gdb/testsuite/gdb.chill/.Sanitize
gdb/testsuite/gdb.chill/ChangeLog
gdb/testsuite/gdb.chill/Makefile.in
gdb/testsuite/gdb.chill/pr-4975-grt.ch [new file with mode: 0644]
gdb/testsuite/gdb.chill/pr-4975.ch [new file with mode: 0644]
gdb/testsuite/gdb.chill/pr-4975.exp [new file with mode: 0644]
gdb/testsuite/gdb.chill/result.ch [new file with mode: 0644]
gdb/testsuite/gdb.chill/result.exp [new file with mode: 0644]

index fffff90..05a0805 100644 (file)
@@ -28,10 +28,15 @@ chexp.exp
 chillvars.ch
 chillvars.exp
 configure.in
+pr-4975.ch
+pr-4975-grt.ch
+pr-4975.exp
 pr-5020.ch
 pr-5020.exp
 pr-5022.ch
 pr-5022.exp
+result.ch
+result.exp
 
 Things-to-lose:
 
index 3626013..1a6e158 100644 (file)
@@ -1,3 +1,8 @@
+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.
index da50374..6922f85 100644 (file)
@@ -102,7 +102,12 @@ GDBFLAGS = -nx
 
 #### host, target, and site specific Makefile frags come in here.
 
-EXECUTABLES = chillvars.exe pr-5020.exe pr-5022.exe
+EXECUTABLES = chillvars.exe result.exe \
+  pr-4975.exe pr-5020.exe pr-5022.exe
+
+# To force pr-4975-grt to be compiled before pr-4975, so the
+# latter can use the former's grant file.
+pr-4975.o: pr-4975-grt.o
 
 all:   $(EXECUTABLES)
 
diff --git a/gdb/testsuite/gdb.chill/pr-4975-grt.ch b/gdb/testsuite/gdb.chill/pr-4975-grt.ch
new file mode 100644 (file)
index 0000000..7796362
--- /dev/null
@@ -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 (file)
index 0000000..dbba064
--- /dev/null
@@ -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 (file)
index 0000000..cd11f34
--- /dev/null
@@ -0,0 +1,58 @@
+# Copyright (C) 1992, 1994 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
+
+# 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 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 $objdir/$subdir/$binfile
+
+    send "set language chill\n" ; expect -re "$prompt $"
+
+    # This is needed (at least on SunOS4) to make sure the
+    # the symbol table is read.
+    runto "x"
+    gdb_test "finish" "You loose" "Runs and reads symbols OK"
+}
+
+# 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 binfile "pr-4975.exe"
+set srcfile $binfile.ch
+
+if ![file exists $objdir/$subdir/$binfile] then {
+       warning "$objdir/$subdir/$binfile does not exist; tests suppressed."
+} else {
+    do_tests
+}
diff --git a/gdb/testsuite/gdb.chill/result.ch b/gdb/testsuite/gdb.chill/result.ch
new file mode 100644 (file)
index 0000000..71e6400
--- /dev/null
@@ -0,0 +1,16 @@
+test_result:  MODULE
+
+  DCL i INT := 5;
+
+  simple_func: PROC () RETURNS (INT);
+    DCL j INT := i;
+    RESULT 10;
+    i + := 2;
+    RESULT j + 2;
+    i + := 2;
+  END simple_func;
+
+  i := simple_func ();
+  i := simple_func ();
+  i * := 10;
+END test_result;
diff --git a/gdb/testsuite/gdb.chill/result.exp b/gdb/testsuite/gdb.chill/result.exp
new file mode 100644 (file)
index 0000000..ba3f024
--- /dev/null
@@ -0,0 +1,69 @@
+# Copyright (C) 1994 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
+
+# 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 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 $objdir/$subdir/$binfile
+
+    send "set language chill\n" ; expect -re "$prompt $"
+
+    send "set width 0\n" ; expect -re "$prompt $"
+    send "set print sevenbit-strings\n" ; expect -re "$prompt $"
+    send "set print address off\n" ; expect -re "$prompt $"
+
+    runto simple_func
+    send "step 2\n" ; expect -re "$prompt $"
+    gdb_test "print j" "= 5"
+    gdb_test "p RESULT" "= 10"
+    send "continue\n" ; expect -re "$prompt $"
+    gdb_test "print i" "= 7"
+    send "step 4\n" ; expect -re "$prompt $"
+    send "set RESULT := 50\n" ; expect -re "$prompt $"
+    send "finish\n" ; expect -re "$prompt $"
+    send "step\n" ; expect -re "$prompt $"
+    gdb_test "print i" "= 50"
+}
+
+# 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 binfile "result.exe"
+set srcfile $binfile.ch
+
+if ![file exists $objdir/$subdir/$binfile] then {
+       warning "$objdir/$subdir/$binfile does not exist; tests suppressed."
+} else {
+    do_tests
+}