aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1995-02-12 17:55:09 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1995-02-12 17:55:09 +0000
commitc44c67b5ae95c3e4201e0cbed7ebf429bc2d664a (patch)
tree5d83675cd0e69cbeead93e8359c2e659582fae7f
parent21af55c92d1da8777dd6b71b686f6672670bf3ba (diff)
downloadgdb-c44c67b5ae95c3e4201e0cbed7ebf429bc2d664a.zip
gdb-c44c67b5ae95c3e4201e0cbed7ebf429bc2d664a.tar.gz
gdb-c44c67b5ae95c3e4201e0cbed7ebf429bc2d664a.tar.bz2
* gdb.base/langs.exp, gdb.base/langs*: New test.
* gdb.base/Makefile.in: Build it. * TODO: Remove item about checking that C names don't get C++ demangling applied; this test tests it.
-rw-r--r--gdb/testsuite/ChangeLog7
-rw-r--r--gdb/testsuite/gdb.base/.Sanitize6
-rw-r--r--gdb/testsuite/gdb.base/langs0.c24
-rw-r--r--gdb/testsuite/gdb.base/langs1.c33
-rw-r--r--gdb/testsuite/gdb.base/langs1.f7
-rw-r--r--gdb/testsuite/gdb.base/langs2.c15
-rw-r--r--gdb/testsuite/gdb.base/langs2.cxx13
7 files changed, 105 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a068761..3814532 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+Sun Feb 12 08:11:58 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * gdb.base/langs.exp, gdb.base/langs*: New test.
+ * gdb.base/Makefile.in: Build it.
+ * TODO: Remove item about checking that C names don't get C++
+ demangling applied; this test tests it.
+
Thu Feb 9 12:43:56 1995 Jim Kingdon (kingdon@lioth.cygnus.com)
* gdb.stabs/weird.exp: Remove "Haven't examined" comment which
diff --git a/gdb/testsuite/gdb.base/.Sanitize b/gdb/testsuite/gdb.base/.Sanitize
index 364d600..b42f6e8 100644
--- a/gdb/testsuite/gdb.base/.Sanitize
+++ b/gdb/testsuite/gdb.base/.Sanitize
@@ -50,6 +50,12 @@ i486-elf.u
i860-elf.u
interrupt.c
interrupt.exp
+langs.exp
+langs0.c
+langs1.c
+langs1.f
+langs2.c
+langs2.cxx
list.exp
list0.c
list0.h
diff --git a/gdb/testsuite/gdb.base/langs0.c b/gdb/testsuite/gdb.base/langs0.c
new file mode 100644
index 0000000..2790e2d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/langs0.c
@@ -0,0 +1,24 @@
+/* This file is actually in C, it is not supposed to simulate something
+ translated from another language or anything like that. */
+int
+csub (x)
+ int x;
+{
+ return x + 1;
+}
+
+int
+langs0__2do ()
+{
+ return fsub_ () + 2;
+}
+
+int
+main ()
+{
+ if (langs0__2do () == 5003)
+ /* Success. */
+ return 0;
+ else
+ return 1;
+}
diff --git a/gdb/testsuite/gdb.base/langs1.c b/gdb/testsuite/gdb.base/langs1.c
new file mode 100644
index 0000000..7842259
--- /dev/null
+++ b/gdb/testsuite/gdb.base/langs1.c
@@ -0,0 +1,33 @@
+/* langs1.f -- translated by f2c (version of 5 May 1990 1:12:08). */
+
+/* f2c output hacked as follows for GDB testsuite:
+ 1. Change commented out "#" lines to #line directives.
+ I don't know why this behavior isn't the default for f2c -g.
+ 2. Remove include of f2c.h and put in just a typedef for "integer".
+ Additional notes:
+ 3. f2c was called as "f2c -g langs1.f".
+ 4. We don't need to use the fortran libraries. */
+
+typedef int integer;
+
+/* Table of constant values */
+
+static integer c__10000 = 10000;
+
+/* I am not sure whether there is a way to have a fortran program without */
+/* a MAIN, but it does not really harm us to have one. */
+/* Main program */ MAIN__()
+{
+} /* MAIN__ */
+
+#line 4 "langs1.f"
+/* Subroutine */ int fsub_()
+{
+ extern integer cppsub_();
+
+#line 5 "langs1.f"
+#line 6 "langs1.f"
+ return cppsub_(&c__10000);
+#line 7 "langs1.f"
+} /* fsub_ */
+
diff --git a/gdb/testsuite/gdb.base/langs1.f b/gdb/testsuite/gdb.base/langs1.f
new file mode 100644
index 0000000..35ce691
--- /dev/null
+++ b/gdb/testsuite/gdb.base/langs1.f
@@ -0,0 +1,7 @@
+c I am not sure whether there is a way to have a fortran program without
+c a MAIN, but it does not really harm us to have one.
+ end
+ subroutine fsub
+ integer*4 cppsub
+ return (cppsub (10000))
+ end
diff --git a/gdb/testsuite/gdb.base/langs2.c b/gdb/testsuite/gdb.base/langs2.c
new file mode 100644
index 0000000..69f290d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/langs2.c
@@ -0,0 +1,15 @@
+/* This is intended to be a vague simulation of cfront output. */
+#line 1 "langs2.cxx"
+extern int csub ();
+int
+foo__Fi (x) int x;
+{
+ return csub (x / 2);
+}
+
+extern int cppsub_ (int *);
+int
+cppsub_ (y) int *y;
+{
+ return foo__Fi (*y);
+}
diff --git a/gdb/testsuite/gdb.base/langs2.cxx b/gdb/testsuite/gdb.base/langs2.cxx
new file mode 100644
index 0000000..d8ee56c
--- /dev/null
+++ b/gdb/testsuite/gdb.base/langs2.cxx
@@ -0,0 +1,13 @@
+extern "C" int csub (int);
+int
+foo (int x)
+{
+ return csub (x / 2);
+}
+
+extern "C" int cppsub_ (int);
+int
+cppsub_ (int *y)
+{
+ return foo (*y);
+}