From: Jim Kingdon Date: Sun, 12 Feb 1995 17:55:09 +0000 (+0000) Subject: * gdb.base/langs.exp, gdb.base/langs*: New test. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c44c67b5ae95c3e4201e0cbed7ebf429bc2d664a;p=binutils-gdb.git * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a0687612292..381453256ed 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 364d6000eef..b42f6e89538 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 00000000000..2790e2dc673 --- /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 00000000000..784225902c4 --- /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 00000000000..35ce6911472 --- /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 00000000000..69f290d7323 --- /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 00000000000..d8ee56c5317 --- /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); +}