Initial creation of sourceware repository

This commit is contained in:
Stan Shebs
1999-04-16 01:35:26 +00:00
parent cd946cff9e
commit c906108c21
2470 changed files with 976797 additions and 0 deletions

1
gdb/testsuite/.gdbinit Normal file
View File

@@ -0,0 +1 @@
set height 400

5930
gdb/testsuite/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

187
gdb/testsuite/Makefile.in Normal file
View File

@@ -0,0 +1,187 @@
# Makefile for regression testing the GNU debugger.
# Copyright (C) 1992, 1993, 1994, 1995, 1999 Free Software Foundation, Inc.
# This file is part of GDB.
# GDB 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, or (at your option)
# any later version.
# GDB 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.
VPATH = @srcdir@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
target_alias = @target_alias@
program_transform_name = @program_transform_name@
build_canonical = @build@
host_canonical = @host@
target_canonical = @target@
target_cpu = @gdb_target_cpu@
SHELL = @SHELL@
SUBDIRS = @subdirs@
RPATH_ENVVAR = @RPATH_ENVVAR@
EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
echo $${rootme}/../../expect/expect ; \
else echo expect ; fi`
RUNTEST = $(RUNTEST_FOR_TARGET)
RUNTESTFLAGS =
RUNTEST_FOR_TARGET = `\
if [ -f $${srcdir}/../../dejagnu/runtest ]; then \
echo $${srcdir}/../../dejagnu/runtest; \
else \
if [ "$(host_canonical)" = "$(target_canonical)" ]; then \
echo runtest; \
else \
t='$(program_transform_name)'; echo runtest | sed -e '' $$t; \
fi; \
fi`
#### host, target, and site specific Makefile frags come in here.
# The use of $$(x_FOR_TARGET) reduces the command line length by not
# duplicating the lengthy definition.
TARGET_FLAGS_TO_PASS = \
"prefix=$(prefix)" \
"exec_prefix=$(exec_prefix)" \
"against=$(against)" \
'CC=$$(CC_FOR_TARGET)' \
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
"CFLAGS=$(TESTSUITE_CFLAGS)" \
"CHILLFLAGS=$(CHILLFLAGS)" \
'CHILL=$$(CHILL_FOR_TARGET)' \
"CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
"CHILL_LIB=$(CHILL_LIB)" \
'CXX=$$(CXX_FOR_TARGET)' \
"CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
"CXXFLAGS=$(CXXFLAGS)" \
"MAKEINFO=$(MAKEINFO)" \
"INSTALL=$(INSTALL)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBS=$(LIBS)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)"
all:
@echo "Nothing to be done for all..."
.NOEXPORT:
INFODIRS=doc
info:
install-info:
dvi:
install:
uninstall: force
site.exp: ./config.status Makefile
@echo "Making a new config file..."
-@rm -f ./tmp?
@touch site.exp
-@mv site.exp site.bak
@echo "## these variables are automatically generated by make ##" > ./tmp0
@echo "# Do not edit here. If you wish to override these values" >> ./tmp0
@echo "# add them to the last section" >> ./tmp0
@echo "set host_alias $(host_alias)" >> ./tmp0
@echo "set host_triplet ${host_canonical}" >> ./tmp0
@echo "set target_alias $(target_alias)" >> ./tmp0
@echo "set target_triplet ${target_canonical}" >> ./tmp0
@echo "set build_triplet ${build_canonical}" >> ./tmp0
@echo "set srcdir ${srcdir}" >> ./tmp0
@echo "set tool gdb" >> ./tmp0
@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
@cat ./tmp0 > site.exp
@cat site.bak | sed \
-e '1,/^## All variables above are.*##/ d' >> site.exp
-@rm -f ./tmp?
installcheck:
check: site.exp all just-check
just-check:
rootme=`pwd`; export rootme; \
srcdir=${srcdir} ; export srcdir ; \
EXPECT=${EXPECT} ; export EXPECT ; \
$(RPATH_ENVVAR)=$$rootme/../../expect:$$rootme/../../libstdc++:$$rootme/../../tk/unix:$$rootme/../../tcl/unix:$$rootme/../../bfd:$$rootme/../../opcodes:$$$(RPATH_ENVVAR); \
export $(RPATH_ENVVAR); \
if [ -f $${rootme}/../../expect/expect ] ; then \
TCL_LIBRARY=$${srcdir}/../../tcl/library ; \
export TCL_LIBRARY ; fi ; \
$(RUNTEST) $(RUNTESTFLAGS)
subdir_do: force
@for i in $(DODIRS); do \
if [ -d ./$$i ] ; then \
if (rootme=`pwd`/ ; export rootme ; \
rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
cd ./$$i; \
$(MAKE) $(TARGET_FLAGS_TO_PASS) $(DO)) ; then true ; \
else exit 1 ; fi ; \
else true ; fi ; \
done
force:;
subdirs:
for dir in ${SUBDIRS} ; \
do \
echo "$$dir:" ; \
if [ -d $$dir ] ; then \
(rootme=`pwd`/ ; export rootme ; \
rootsrc=`cd $(srcdir); pwd`/ ; export rootsrc ; \
cd $$dir; $(MAKE) $(TARGET_FLAGS_TO_PASS)); \
fi; \
done
clean mostlyclean:
-rm -f *~ core *.o a.out xgdb *.x *.grt
if [ x"${SUBDIRS}" != x ] ; then \
for dir in ${SUBDIRS}; \
do \
echo "$$dir:"; \
if [ -d $$dir ]; then \
(cd $$dir; $(MAKE) clean); \
fi; \
done ; \
else true; fi
distclean maintainer-clean realclean: clean
-rm -f *~ core
-rm -f Makefile config.status *-init.exp
-rm -fr *.log summary detail *.plog *.sum *.psum site.*
if [ x"${SUBDIRS}" != x ] ; then \
for dir in ${SUBDIRS}; \
do \
echo "$$dir:"; \
if [ -d $$dir ]; then \
(cd $$dir; $(MAKE) distclean); \
fi; \
done ; \
else true; fi
Makefile : Makefile.in config.status $(host_makefile_frag) $(target_makefile_frag)
$(SHELL) config.status
config.status: configure
$(SHELL) config.status --recheck

202
gdb/testsuite/TODO Normal file
View File

@@ -0,0 +1,202 @@
The highest priority item is not on this list: Fix bugs in the
existing testsuite, fix the GDB/compiler/shell/etc bugs which it
detects (particularly when they are hard to XFAIL), make it run
reliably without unexpected failures on the "standard" machines, etc.
This list exists largely as "tests we can add when we are ready to
risk destabilizing it again".
There are some tests which are only run on some platforms because they
have not been tested on more platforms. Enable them and fix any
problems. A partial list: recurse.exp, watchpoint.exp
(test_watchpoint_triggered_in_syscall, test_complex_watchpoint).
Test printing of structures passed by value, for the 7th, 8th, and 9th
arguments (PR 1714). Test printing structure arguments of
2,4,6,8,12,16,and 20 bytes. Same for structure return of all those
sizes ("return", "finish", and call function).
Get crossload tests to use --enable-targets and reenable them.
corefile.exp:
Test ability to run program when there is a core target, then go
back to the core file when the program exits.
Test handling of floating point variables
1. float, double, or long double
2. in register or saved register or memory. Also the case where a
double is in two float registers and only one of them is saved.
3. print them or set them
4. (Alpha) integer (32 or 64 bit) in floating point register.
Print registers--"p $r5", "p sizeof ($r5)". Test that they print
appropriately (integer registers in decimal, registers which always
contain addresses (pc, probably sp and fp, maybe others) in hex,
floating point).
Test completer. Test that it completes a variety of things correctly
(see the list of test cases in main.c in the gdb source). Test TAB,
M-?, and the "complete" command.
Test "info line" with all kinds of linespecs. Test that the last line
of the file works right.
weird.exp--test that unrecognized cross-reference types or
unrecognized visibility or virtual characters get skipped properly
(see stabs.texinfo).
Test C++ nested types (especially if PR 1954 is fixed; even if not
*some* things already should work even in the presence of nested
types). Test classes nested more than 9 levels deep (g++ mangles
these differently) (both a demangle test and some tests which also
test the compiler). Test calling a method of a class nested more than
9 levels (for gdb_mangle_name and demangling).
Test static member functions (C++). Test that "ptype" shows them
correctly, both before and after they have been converted from stub
methods. Test that we can call them.
Test printing complicated types, including functions, pointers to
arrays of pointers of functions, functions which return pointers to
functions, etc.
printcmd.exp--test printing enum values. Test printing an enum
variable whose value is out of range. Test "p (int)enum_var", "p/x
enum_var". Test that in something like "enum {FOO, LAST_THING=FOO}"
we print FOO, not LAST_THING.
Test GDB expressions--test all operators (and overloaded operators for
C++). Test integer constants which are signed or unsigned int, long,
or long long. Test detection of overflow of an integer constant.
Here are a few integer constants to test (test they get the right
types): 5, 5LL, 5LuL, 5L6u (invalid), 5LU. Maybe things like
0x12345678, 0x87654321, etc., but their types depend on sizes of int,
long, etc.
Test that printing const-qualified versions of various types works.
In particular, on the sparc and probably other machines, "double" is
handled differently from most types because it requires more alignment
and thus goes in a different section (there is a gcc 2.4.5 bug with
"const double" on sparc).
Test that GDB's "source" command works and that things work if stdin
is redirected (to a file or a pipe). Test user defined command. Run
an inferior each of these ways (to test that inflow.c works). Test
that GDB works if the last line of stdin or a source'd file lacks a
newline.
Test that unmatched single quotes produce error messages, both in
expressions and linespecs.
Test "cd". "foo/bar/.." should get simplified to "foo". "/../.."
should not get simplified (for Mach). "/.." should not get simplified
(for other networked OSes; POSIX.1 section B.2.3.7). All these
examples should continue to work with trailing slashes.
Test scoping; here is a start
1 int i=2;
2 int j=3;
3 main()
4 {
5 int i;
6 for (i=600; i>0; i--)
7 print_line(i);
8 }
9
10 print_line(i)
11 int i;
12 {
13 h();
14 printf("%d\n",i);
15 }
16
17 h()
18 {
19 printf("In h...");
20 }
Set a breakpoint in h, and print i, print_line::i, and main::i. Set a
breakpoint in main (or don't run the program), and test that
print_line::i is an error. But if i were static, "p main::i" should
work even if the program is not being run.
Write a test for the reentracy bug with rs6000_struct_return_address
in rs6000-tdep.c.
Test "return" from dummy frames. Test "return" from non-innermost
frame. Test that "return" from a non-innermost frame restores
registers which are saved not in that frame but in a frame more inner
(I believe this currently works on few if any architectures).
FORTRAN common blocks (a.out and xcoff--weird.exp has the start of
one but it is not quite right as of 19 Nov 1993).
Test that "x" command sets $_ and $__. Test $_ in general.
Test that "p/a" works when given addresses in text, data, and bss
segments. Test that it works if program is compiled with or without
-g. Test that it works if preceding symbol is static or if it is
extern.
Given `char abc[] = "abc\0def";' test "x/s abc" followed by "x/s"
(should display "abc" followed by "def"). Test this works with no
error message even if this is the last thing in the section (tests
that val_print_string ignores an error if the error occurs after the
'\0').
Test ability to process NMAGIC a.out files.
Test shared libraries: "next" over printf, "step" into a function in
a shared library which has line number info, breakpoint in a function
in a shared library (either before or after the program is run and the
shared libraries are loaded--also maybe write a test where the PLT
will be in an unloaded state even though the shared library is loaded).
If there are two breakpoints in the same place, and exactly one of
them has its condition true, test that the correct breakpoint gets
printed.
Test "jump" including jump to a breakpoint (the latter will need an
xfail for UDI and probably VxWorks (PR 1786 for vxworks; PR 2416
contains some info for 29k).
Set a watchpoint on a local variable (to be interesting, make a few
calls, to be more interesting, make a recursive call). Test that it
gets disabled when leaving that scope.
Test calling a function, hitting a breakpoint in the called function,
calling another function, and hitting a breakpoint. Test backtrace
works in the presence of multiple dummy frames. Test that "continue"
will get you out of the inner called function, and "continue" again
will get you back to where you were when you called the first one.
Test special longjmp handling in wait_for_inferior (need to figure out
in detail what the proper behavior in each case is). Test longjmp to
a place where there is a breakpoint (such that
BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE happens). In general, test
interactions between longjmp and watchpoints, breakpoints, stepping,
call function, etc.
Test jumping right past a breakpoint (the case where wait_for_inferior
passes not_a_breakpoint to bpstat_stop_status). Might already be
tested by some of the sun3 tests. Probably want a .s test to avoid
compiler dependencies.
Test more obscure wait_for_inferior cases, expanding on the tests in
watchpoint.exp, signals.exp, etc.
Test stepping into functions which are one line long and functions
which are on line 1 of the source file. (there is a class of bugs in
which gdb doesn't find the line number information, and thus doesn't
step into the function).
Test that prologue recognition, backtrace, printing locals, etc.,
still work in the presence of large frames (the point being that at
some point immediate fields in RISC instructions will overflow and
prologues will need to look different. For sparc, the immediate field
is 13 bits (signed), so I believe the threshold would be 4K bytes in a
frame).
(this is for editing this file with GNU emacs)
Local Variables:
mode: text
End:

583
gdb/testsuite/aclocal.m4 vendored Normal file
View File

@@ -0,0 +1,583 @@
dnl This file is duplicated in four places:
dnl * gdb/aclocal.m4
dnl * gdb/testsuite/aclocal.m4
dnl * expect/aclocal.m4
dnl * dejagnu/aclocal.m4
dnl Consider modifying all copies in parallel.
dnl written by Rob Savoye <rob@cygnus.com> for Cygnus Support
dnl CYGNUS LOCAL: This gets the right posix flag for gcc
AC_DEFUN(CY_AC_TCL_LYNX_POSIX,
[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([to see if this is LynxOS])
AC_CACHE_VAL(ac_cv_os_lynx,
[AC_EGREP_CPP(yes,
[/*
* The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__"
*/
#if defined(__Lynx__) || defined(Lynx)
yes
#endif
], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)])
#
if test "$ac_cv_os_lynx" = "yes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE(LYNX)
AC_MSG_CHECKING([whether -mposix or -X is available])
AC_CACHE_VAL(ac_cv_c_posix_flag,
[AC_TRY_COMPILE(,[
/*
* This flag varies depending on how old the compiler is.
* -X is for the old "cc" and "gcc" (based on 1.42).
* -mposix is for the new gcc (at least 2.5.8).
*/
#if defined(__GNUC__) && __GNUC__ >= 2
choke me
#endif
], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")])
CC="$CC $ac_cv_c_posix_flag"
AC_MSG_RESULT($ac_cv_c_posix_flag)
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN(CY_AC_PATH_TCLH, [
#
# Ok, lets find the tcl source trees so we can use the headers
# Warning: transition of version 9 to 10 will break this algorithm
# because 10 sorts before 9. We also look for just tcl. We have to
# be careful that we don't match stuff like tclX by accident.
# the alternative search directory is involked by --with-tclinclude
#
no_tcl=true
AC_MSG_CHECKING(for Tcl private headers)
AC_ARG_WITH(tclinclude, [ --with-tclinclude directory where tcl private headers are], with_tclinclude=${withval})
AC_CACHE_VAL(ac_cv_c_tclh,[
# first check to see if --with-tclinclude was specified
if test x"${with_tclinclude}" != x ; then
if test -f ${with_tclinclude}/tclInt.h ; then
ac_cv_c_tclh=`(cd ${with_tclinclude}; pwd)`
else
AC_MSG_ERROR([${with_tclinclude} directory doesn't contain private headers])
fi
fi
# next check in private source directory
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` \
${srcdir}/../../tcl \
`ls -dr ${srcdir}/../../tcl[[0-9]]* 2>/dev/null` \
${srcdir}/../../../tcl \
`ls -dr ${srcdir}/../../../tcl[[0-9]]* 2>/dev/null ` ; do
if test -f $i/tclInt.h ; then
ac_cv_c_tclh=`(cd $i; pwd)`
break
fi
# Tcl 7.5 and greater puts headers in subdirectory.
if test -f $i/generic/tclInt.h ; then
ac_cv_c_tclh=`(cd $i; pwd)`/generic
break
fi
done
fi
# finally check in a few common install locations
#
# since ls returns lowest version numbers first, reverse its output
if test x"${ac_cv_c_tclh}" = x ; then
for i in \
`ls -dr /usr/local/src/tcl[[0-9]]* 2>/dev/null` \
`ls -dr /usr/local/lib/tcl[[0-9]]* 2>/dev/null` \
/usr/local/src/tcl \
/usr/local/lib/tcl \
${prefix}/include ; do
if test -f $i/tclInt.h ; then
ac_cv_c_tclh=`(cd $i; pwd)`
break
fi
done
fi
# see if one is installed
if test x"${ac_cv_c_tclh}" = x ; then
AC_HEADER_CHECK(tclInt.h, ac_cv_c_tclh=installed, ac_cv_c_tclh="")
fi
])
if test x"${ac_cv_c_tclh}" = x ; then
TCLHDIR="# no Tcl private headers found"
AC_MSG_ERROR([Can't find Tcl private headers])
fi
if test x"${ac_cv_c_tclh}" != x ; then
no_tcl=""
if test x"${ac_cv_c_tclh}" = x"installed" ; then
AC_MSG_RESULT([is installed])
TCLHDIR=""
else
AC_MSG_RESULT([found in ${ac_cv_c_tclh}])
# this hack is cause the TCLHDIR won't print if there is a "-I" in it.
TCLHDIR="-I${ac_cv_c_tclh}"
fi
fi
AC_MSG_CHECKING([Tcl version])
orig_includes="$CPPFLAGS"
if test x"${TCLHDIR}" != x ; then
CPPFLAGS="$CPPFLAGS $TCLHDIR"
fi
# Get major and minor versions of Tcl. Use funny names to avoid
# clashes with eg SunOS.
cat > conftest.c <<'EOF'
#include "tcl.h"
MaJor = TCL_MAJOR_VERSION
MiNor = TCL_MINOR_VERSION
EOF
tclmajor=
tclminor=
if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
# Success.
tclmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
tclminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
fi
rm -f conftest.c conftest.out
if test -z "$tclmajor" || test -z "$tclminor"; then
AC_MSG_RESULT([fatal error: could not find major or minor version number of Tcl])
exit 1
fi
AC_MSG_RESULT(${tclmajor}.${tclminor})
CPPFLAGS="${orig_includes}"
AC_PROVIDE([$0])
AC_SUBST(TCLHDIR)
])
AC_DEFUN(CY_AC_PATH_TCLLIB, [
#
# Ok, lets find the tcl library
# First, look for one uninstalled.
# the alternative search directory is invoked by --with-tcllib
#
if test $tclmajor -ge 7 -a $tclminor -ge 4 ; then
installedtcllibroot=tcl$tclversion
else
installedtcllibroot=tcl
fi
if test x"${no_tcl}" = x ; then
# we reset no_tcl incase something fails here
no_tcl=true
AC_ARG_WITH(tcllib, [ --with-tcllib directory where the tcl library is],
with_tcllib=${withval})
AC_MSG_CHECKING([for Tcl library])
AC_CACHE_VAL(ac_cv_c_tcllib,[
# First check to see if --with-tcllib was specified.
# This requires checking for both the installed and uninstalled name-styles
# since we have no idea if it's installed or not.
if test x"${with_tcllib}" != x ; then
if test -f "${with_tcllib}/lib$installedtcllibroot.so" ; then
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.so
elif test -f "${with_tcllib}/libtcl.so" ; then
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.so
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtcl will be built first.
elif test -f "${with_tcllib}/lib$installedtcllibroot.a" ; then
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/lib$installedtcllibroot.a
elif test -f "${with_tcllib}/libtcl.a" ; then
ac_cv_c_tcllib=`(cd ${with_tcllib}; pwd)`/libtcl.a
else
AC_MSG_ERROR([${with_tcllib} directory doesn't contain libraries])
fi
fi
# then check for a private Tcl library
# Since these are uninstalled, use the simple lib name root.
if test x"${ac_cv_c_tcllib}" = x ; then
for i in \
../tcl \
`ls -dr ../tcl[[0-9]]* 2>/dev/null` \
../../tcl \
`ls -dr ../../tcl[[0-9]]* 2>/dev/null` \
../../../tcl \
`ls -dr ../../../tcl[[0-9]]* 2>/dev/null` ; do
# Tcl 7.5 and greater puts library in subdir. Look there first.
if test -f "$i/unix/libtcl.so" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
break
elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
break
# look for a freshly built dynamically linked library
elif test -f "$i/libtcl.so" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
break
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtcl will be
# built first.
elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
break
fi
done
fi
# check in a few common install locations
if test x"${ac_cv_c_tcllib}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
# first look for a freshly built dynamically linked library
if test -f "$i/lib$installedtcllibroot.so" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.so
break
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtcl will be built first.
elif test -f "$i/lib$installedtcllibroot.a" -o -f "$i/Makefile" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/lib$installedtcllibroot.a
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tcllib}" = x ; then
for i in \
${srcdir}/../tcl \
`ls -dr ${srcdir}/../tcl[[0-9]]* 2>/dev/null` ; do
# Tcl 7.5 and greater puts library in subdir. Look there first.
if test -f "$i/unix/libtcl.so" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.so
break
elif test -f "$i/unix/libtcl.a" -o -f "$i/unix/Makefile"; then
ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtcl.a
break
# look for a freshly built dynamically linked library
elif test -f "$i/libtcl.so" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.so
break
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtcl will be
# built first.
elif test -f "$i/libtcl.a" -o -f "$i/Makefile" ; then
ac_cv_c_tcllib=`(cd $i; pwd)`/libtcl.a
break
fi
done
fi
# see if one is conveniently installed with the compiler
if test x"${ac_cv_c_tcllib}" = x ; then
orig_libs="$LIBS"
LIBS="$LIBS -l$installedtcllibroot -lm"
AC_TRY_RUN([
Tcl_AppInit()
{ exit(0); }], ac_cv_c_tcllib="-l$installedtcllibroot", ac_cv_c_tcllib=""
, ac_cv_c_tclib="-l$installedtcllibroot")
LIBS="${orig_libs}"
fi
])
if test x"${ac_cv_c_tcllib}" = x ; then
TCLLIB="# no Tcl library found"
AC_MSG_WARN(Can't find Tcl library)
else
TCLLIB=${ac_cv_c_tcllib}
AC_MSG_RESULT(found $TCLLIB)
no_tcl=
fi
fi
AC_PROVIDE([$0])
AC_SUBST(TCLLIB)
])
AC_DEFUN(CY_AC_PATH_TKH, [
#
# Ok, lets find the tk source trees so we can use the headers
# If the directory (presumably symlink) named "tk" exists, use that one
# in preference to any others. Same logic is used when choosing library
# and again with Tcl. The search order is the best place to look first, then in
# decreasing significance. The loop breaks if the trigger file is found.
# Note the gross little conversion here of srcdir by cd'ing to the found
# directory. This converts the path from a relative to an absolute, so
# recursive cache variables for the path will work right. We check all
# the possible paths in one loop rather than many seperate loops to speed
# things up.
# the alternative search directory is invoked by --with-tkinclude
#
AC_MSG_CHECKING(for Tk private headers)
AC_ARG_WITH(tkinclude, [ --with-tkinclude directory where the tk private headers are],
with_tkinclude=${withval})
no_tk=true
AC_CACHE_VAL(ac_cv_c_tkh,[
# first check to see if --with-tkinclude was specified
if test x"${with_tkinclude}" != x ; then
if test -f ${with_tkinclude}/tk.h ; then
ac_cv_c_tkh=`(cd ${with_tkinclude}; pwd)`
else
AC_MSG_ERROR([${with_tkinclude} directory doesn't contain private headers])
fi
fi
# next check in private source directory
#
# since ls returns lowest version numbers first, reverse the entire list
# and search for the worst fit, overwriting it with better fits as we find them
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
${srcdir}/../tk \
`ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` \
${srcdir}/../../tk \
`ls -dr ${srcdir}/../../tk[[0-9]]* 2>/dev/null` \
${srcdir}/../../../tk \
`ls -dr ${srcdir}/../../../tk[[0-9]]* 2>/dev/null ` ; do
if test -f $i/tk.h ; then
ac_cv_c_tkh=`(cd $i; pwd)`
break
fi
# Tk 4.1 and greater puts this in a subdir.
if test -f $i/generic/tk.h; then
ac_cv_c_tkh=`(cd $i; pwd)`/generic
fi
done
fi
# finally check in a few common install locations
#
# since ls returns lowest version numbers first, reverse the entire list
# and search for the worst fit, overwriting it with better fits as we find them
if test x"${ac_cv_c_tkh}" = x ; then
for i in \
`ls -dr /usr/local/src/tk[[0-9]]* 2>/dev/null` \
`ls -dr /usr/local/lib/tk[[0-9]]* 2>/dev/null` \
/usr/local/src/tk \
/usr/local/lib/tk \
${prefix}/include ; do
if test -f $i/tk.h ; then
ac_cv_c_tkh=`(cd $i; pwd)`
break
fi
done
fi
# see if one is installed
if test x"${ac_cv_c_tkh}" = x ; then
AC_HEADER_CHECK(tk.h, ac_cv_c_tkh=installed)
fi
])
if test x"${ac_cv_c_tkh}" != x ; then
no_tk=""
if test x"${ac_cv_c_tkh}" = x"installed" ; then
AC_MSG_RESULT([is installed])
TKHDIR=""
else
AC_MSG_RESULT([found in $ac_cv_c_tkh])
# this hack is cause the TKHDIR won't print if there is a "-I" in it.
TKHDIR="-I${ac_cv_c_tkh}"
fi
else
TKHDIR="# no Tk directory found"
AC_MSG_WARN([Can't find Tk private headers])
no_tk=true
fi
# if Tk is installed, extract the major/minor version
if test x"${no_tk}" = x ; then
AC_MSG_CHECKING([Tk version])
orig_includes="$CPPFLAGS"
if test x"${TCLHDIR}" != x ; then
CPPFLAGS="$CPPFLAGS $TCLHDIR"
fi
if test x"${TKHDIR}" != x ; then
CPPFLAGS="$CPPFLAGS $TKHDIR"
fi
if test x"${x_includes}" != x -a x"${x_includes}" != xNONE ; then
CPPFLAGS="$CPPFLAGS -I$x_includes"
fi
# Get major and minor versions of Tk. Use funny names to avoid
# clashes with eg SunOS.
cat > conftest.c <<'EOF'
#include "tk.h"
MaJor = TK_MAJOR_VERSION
MiNor = TK_MINOR_VERSION
EOF
tkmajor=
tkminor=
if (eval "$CPP $CPPFLAGS conftest.c") 2>/dev/null >conftest.out; then
# Success.
tkmajor=`egrep '^MaJor = ' conftest.out | sed -e 's/^MaJor = *//' -e 's/ *$//'`
tkminor=`egrep '^MiNor = ' conftest.out | sed -e 's/^MiNor = *//' -e 's/ *$//'`
fi
rm -f conftest.c conftest.out
if test -z "$tkmajor" || test -z "$tkminor"; then
AC_MSG_RESULT([fatal error: could not find major or minor version number of Tk])
exit 1
fi
AC_MSG_RESULT(${tkmajor}.${tkminor})
CPPFLAGS="${orig_includes}"
fi
AC_PROVIDE([$0])
AC_SUBST(TKHDIR)
])
AC_DEFUN(CY_AC_PATH_TKLIB, [
AC_REQUIRE([CY_AC_PATH_TCL])
#
# Ok, lets find the tk library
# First, look for the latest private (uninstalled) copy
# Notice that the destinations in backwards priority since the tests have
# no break.
# Then we look for either .a, .so, or Makefile. A Makefile is acceptable
# is it indicates the target has been configured and will (probably)
# soon be built. This allows an entire tree of Tcl software to be
# configured at once and then built.
# the alternative search directory is invoked by --with-tklib
#
if test x"${no_tk}" = x ; then
# reset no_tk incase something fails here
no_tk="true"
if test $tkmajor -ge 4 ; then
installedtklibroot=tk$tkversion
else
installedtkllibroot=tk
fi
AC_ARG_WITH(tklib, [ --with-tklib directory where the tk library is],
with_tklib=${withval})
AC_MSG_CHECKING([for Tk library])
AC_CACHE_VAL(ac_cv_c_tklib,[
# first check to see if --with-tklib was specified
# This requires checking for both the installed and uninstalled name-styles
# since we have no idea if it's installed or not.
if test x"${with_tklib}" != x ; then
if test -f "${with_tklib}/lib$installedtklibroot.so" ; then
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.so
no_tk=""
elif test -f "${with_tklib}/libtk.so" ; then
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.so
no_tk=""
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtk will be built
elif test -f "${with_tklib}/lib$installedtklibroot.a" ; then
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/lib$installedtklibroot.a
no_tk=""
elif test -f "${with_tklib}/libtk.a" ; then
ac_cv_c_tklib=`(cd ${with_tklib}; pwd)`/libtk.a
no_tk=""
else
AC_MSG_ERROR([${with_tklib} directory doesn't contain libraries])
fi
fi
# then check for a private Tk library
# Since these are uninstalled, use the simple lib name root.
if test x"${ac_cv_c_tklib}" = x ; then
for i in \
../tk \
`ls -dr ../tk[[0-9]]* 2>/dev/null` \
../../tk \
`ls -dr ../../tk[[0-9]]* 2>/dev/null` \
../../../tk \
`ls -dr ../../../tk[[0-9]]* 2>/dev/null` ; do
# Tk 4.1 and greater puts things in subdirs. Check these first.
if test -f "$i/unix/libtk.so" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
no_tk=
break
elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.a
no_tk=
break
# look for a freshly built dynamically linked library
elif test -f "$i/libtk.so" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
no_tk=
break
# then look for a freshly built statically linked library
# if Makefile exists we assume its configured and libtk will be built
elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
no_tk=""
break
fi
done
fi
# finally check in a few common install locations
if test x"${ac_cv_c_tklib}" = x ; then
for i in `ls -d ${prefix}/lib /usr/local/lib 2>/dev/null` ; do
# first look for a freshly built dynamically linked library
if test -f "$i/lib$installedtklibroot.so" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.so
no_tk=""
break
# then look for a freshly built statically linked library
# if Makefile exists, we assume it's configured and libtcl will be built
elif test -f "$i/lib$installedtklibroot.a" -o -f "$i/Makefile" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/lib$installedtklibroot.a
no_tk=""
break
fi
done
fi
# check in a few other private locations
if test x"${ac_cv_c_tklib}" = x ; then
for i in \
${srcdir}/../tk \
`ls -dr ${srcdir}/../tk[[0-9]]* 2>/dev/null` ; do
# Tk 4.1 and greater puts things in subdirs. Check these first.
if test -f "$i/unix/libtk.so" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/unix/libtk.so
no_tk=
break
elif test -f "$i/unix/libtk.a" -o -f "$i/unix/Makefile"; then
ac_cv_c_tcllib=`(cd $i; pwd)`/unix/libtk.a
no_tk=
break
# look for a freshly built dynamically linked library
elif test -f "$i/libtk.so" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.so
no_tk=""
break
# then look for a freshly built statically linked library
# if Makefile exists, we assume it's configured and libtcl will be built
elif test -f "$i/libtk.a" -o -f "$i/Makefile" ; then
ac_cv_c_tklib=`(cd $i; pwd)`/libtk.a
no_tk=""
break
fi
done
fi
# see if one is conveniently installed with the compiler
if test x"${ac_cv_c_tklib}" = x ; then
AC_REQUIRE([AC_PATH_X])
orig_libs="$LIBS"
LIBS="$LIBS -l$installedtklibroot $x_libraries $ac_cv_c_tcllib -lm"
AC_TRY_RUN([
Tcl_AppInit()
{ exit(0); }], ac_cv_c_tklib="-l$installedtklibroot", ac_cv_c_tklib=""
, ac_cv_c_tklib="-l$installedtklibroot")
LIBS="${orig_libs}"
fi
])
if test x"${ac_cv_c_tklib}" = x ; then
TKLIB="# no Tk library found"
AC_MSG_WARN(Can't find Tk library)
else
TKLIB=$ac_cv_c_tklib
AC_MSG_RESULT(found $TKLIB)
no_tk=
fi
fi
AC_PROVIDE([$0])
AC_SUBST(TKLIB)
])
AC_DEFUN(CY_AC_PATH_TK, [
CY_AC_PATH_TKH
CY_AC_PATH_TKLIB
])
AC_DEFUN(CY_AC_PATH_TCL, [
CY_AC_PATH_TCLH
CY_AC_PATH_TCLLIB
])

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1 @@
load_lib "../config/monitor.exp";

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1 @@
load_lib "../config/monitor.exp";

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib "../config/monitor.exp"

View File

@@ -0,0 +1,23 @@
# Copyright (C) 1998 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
load_lib ../config/monitor.exp
set timeout 1000
verbose "Timeout is now $timeout seconds" 2

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,104 @@
# Test Framework Driver for GDB using the extended gdb remote protocol
# Copyright 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.
#
# For this to function correctly, you need to set a number of variables
# in your gdb/site.exp file
#
# set noargs 1 -- we can't pass arguments (yet)
# set noinferiorio 1 -- we can't get io to/from the inferior
# set targethost <host> -- name of the remote system (runs gdbserver)
# set debughost <host> -- name of the system running gdb
# set port <number> -- starting port number for communication
# set gdbserver <path> -- path (on the remote side) to find
# gdbserver
# set rsh <path> -- path (on debughost side) to rsh
# set rcp <path> -- path (on debughost side) to rcp
#
# You will need to be able to spawn processes from gdbhost to run on
# targethost via rsh (this is how we start gdbserver); similarly
# you need to be able to rcp files from gdbhost to targethost.
#
# We don't do much error checking, if something goes wrong, you'll probably
# just get a tcl error and everything will die. FIXME
#
# Load the basic gdb testing library
load_lib gdb.exp
load_lib monitor.exp
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
# Loading a file in the gdbsrever framework is a little strange in that
# we also create the inferior (which is stopped at the first instruction
# in the program when we get control).
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global gdb_prompt
global debughost
global port
# bump the port number to avoid conflicts with hung ports
set targethost [target_info gdb_server_host];
set debughost [target_info gdb_debug_host];
if [target_info exists gdb_server_prog] {
set gdbserver [target_info gdb_server_prog];
} else {
set gdbserver "gdbserver";
}
incr port
set serialport $targethost:$port
# Copy the file down to the remote host.
set file [remote_download host $arg];
# now start gdbserver on the remote side
remote_spawn host "$gdbserver $debughost:$port $file >& /dev/null < /dev/null"
# give it plenty of time to get going (lynx)
sleep 30
# tell gdb we are remote debugging
if [gdb_target_monitor $arg] {
return -1;
}
return 1
}
#
# gdb_start -- start GDB running.
#
proc gdb_start { } {
global gdb_prompt
# do the usual stuff
catch default_gdb_start
# FIXME: This shouldn't be necessary, but lots of PA tests fail
# without it.
send "set remotecache 0\n"
expect {
-re "set remotecache 0\[\r\n\]+.*$gdb_prompt $" {}
default { fail "gdb_start"}
}
}

View File

@@ -0,0 +1 @@
load_lib "../config/monitor.exp";

View File

@@ -0,0 +1,22 @@
# Copyright (C) 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
# Support for testing against a Hitachi SH3 target rom
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,24 @@
# Copyright (C) 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
load_lib ../config/monitor.exp
# Hppro monitor is very slow...
set timeout 540
verbose "Timeout is now $timeout seconds" 2

View File

@@ -0,0 +1 @@
load_lib "../config/monitor.exp"

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1 @@
load_lib "../../testsuite/config/sparclet.exp"

View File

@@ -0,0 +1,23 @@
# Copyright (C) 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
load_lib ../config/monitor.exp
set timeout 120
verbose "Timeout is now $timeout seconds" 2

View File

@@ -0,0 +1,17 @@
load_lib gdb.exp
load_lib "../config/monitor.exp"
proc gdb_emclaptop_command { command } {
global board_info;
set tname [board_info target name];
if ![info exists board_info($tname,m68k_connected)] {
m68k_emc_board_connect target;
}
# This is about all we can do for now. *sigh*
set dos_host [board_info target dos_host];
remote_send $dos_host "${command}\n";
#remote_expect $dos_host {
#}
}

View File

@@ -0,0 +1,22 @@
# Copyright (C) 1993, 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:
# DejaGnu@cygnus.com
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,22 @@
# Copyright (C) 1993, 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:
# DejaGnu@cygnus.com
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,23 @@
# Copyright (C) 1998 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
load_lib ../config/monitor.exp
set timeout 1000
verbose "Timeout is now $timeout seconds" 2

View File

@@ -0,0 +1,230 @@
# Test Framework Driver for GDB driving a ROM monitor (via monitor.c).
# Copyright 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.
load_lib gdb.exp
#
# gdb_target_monitor
# Set gdb to target the monitor
#
proc gdb_target_monitor { exec_file } {
global gdb_prompt
global exit_status
global timeout
if [target_info exists gdb_protocol] {
set targetname "[target_info gdb_protocol]"
} else {
perror "No protocol specified for [target_info name].";
return -1;
}
if [target_info exists baud] {
gdb_test "set remotebaud [target_info baud]" "" ""
}
if [target_info exists gdb_serial] {
set serialport "[target_info gdb_serial]";
} elseif [target_info exists netport] {
set serialport "[target_info netport]"
} else {
set serialport "[target_info serial]"
}
for {set j 1} {$j <= 2} {incr j} {
if [gdb_file_cmd $exec_file] { return -1; }
for {set i 1} {$i <= 3} {incr i} {
send_gdb "target $targetname $serialport\n"
gdb_expect 60 {
-re "A program is being debugged already.*ill it.*y or n. $" {
send_gdb "y\n";
exp_continue;
}
-re "Couldn't establish connection to remote.*$gdb_prompt" {
verbose "Connection failed";
}
-re "Remote MIPS debugging.*$gdb_prompt" {
verbose "Set target to $targetname";
return 0;
}
-re "Remote debugging using .*$serialport.*$gdb_prompt" {
verbose "Set target to $targetname";
return 0;
}
-re "Remote target $targetname connected to.*$gdb_prompt" {
verbose "Set target to $targetname";
return 0;
}
-re "Connected to.*$gdb_prompt" {
verbose "Set target to $targetname";
return 0;
}
-re "Ending remote.*$gdb_prompt" { }
-re "Connection refused.*$gdb_prompt" {
verbose "Connection refused by remote target. Pausing, and trying again."
sleep 30
continue
}
-re "Timeout reading from remote system.*$gdb_prompt" {
verbose "Got timeout error from gdb.";
}
timeout {
send_gdb "";
break
}
}
}
gdb_target_exec;
if { $j == 1 && ![reboot_target] } {
break;
}
}
perror "Couldn't set target for $targetname, port is $serialport.";
return -1;
}
proc gdb_target_exec { } {
gdb_test "target exec" "No executable file now." "" ".*Kill it.*y or n.*" "y"
}
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global gdb_prompt
global timeout
global last_gdb_file;
if { $arg == "" } {
if [info exists last_gdb_file] {
set arg $last_gdb_file;
} else {
send_gdb "info files\n";
gdb_expect 30 {
-re "Symbols from \"(\[^\"\]+)\"" {
set arg $expect_out(1,string);
exp_continue;
}
-re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," {
set arg $expect_out(1,string);
exp_continue;
}
-re "$gdb_prompt $" { }
}
}
}
set last_gdb_file $arg;
for { set j 1; } { $j <= 2 } {incr j; } {
if [target_info exists gdb,use_standard_load] {
gdb_target_exec;
if ![target_info exists gdb,no_push_conn] {
remote_push_conn host;
}
set state [remote_ld target $arg];
if ![target_info exists gdb,no_push_conn] {
remote_close target;
remote_pop_conn host;
}
if { $state == "pass" } {
if [gdb_target_monitor $arg] { return -1; }
gdb_test "list main" ".*" ""
verbose "Loaded $arg into $GDB\n";
return 0;
}
} else {
if [gdb_target_monitor $arg] { return -1 }
if [is_remote host] {
# FIXME: Multiple downloads. bleah.
set farg [remote_download host $arg];
} else {
set farg $arg;
}
if { $arg != "" && [target_info exists gdb_sect_offset] } {
set textoff [target_info gdb_sect_offset];
send_gdb "sect .text $textoff\n";
gdb_expect 30 {
-re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" {
set dataoff $expect_out(1,string);
exp_continue;
}
-re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" {
set bssoff $expect_out(1,string);
exp_continue;
}
-re "$gdb_prompt" { }
}
set dataoff [format 0x%x [expr $dataoff + $textoff]];
set bssoff [format 0x%x [expr $bssoff + $textoff]];
send_gdb "sect .data $dataoff\n";
gdb_expect 30 {
-re "$gdb_prompt" { }
}
send_gdb "sect .bss $bssoff\n";
gdb_expect 30 {
-re "$gdb_prompt" { }
}
}
verbose "Loading $farg"
if [target_info exists gdb_load_offset] {
set command "load $farg [target_info gdb_load_offset]\n";
} else {
set command "load $farg\n";
}
send_gdb $command;
gdb_expect 1600 {
-re "\[Ff\]ailed.*$gdb_prompt $" {
verbose "load failed";
}
-re "Timeout reading from remote.*$gdb_prompt" {
}
-re "$gdb_prompt $" {
verbose "Loaded $farg into $GDB\n"
return 0;
}
timeout {
if { $verbose > 1 } {
perror "Timed out trying to load $farg."
}
}
}
}
# Make sure we don't have an open connection to the target.
gdb_target_exec;
if { $j == 1 } {
if { ![reboot_target] } {
break;
}
}
}
perror "Couldn't load file into GDB.";
return -1;
}

View File

View File

@@ -0,0 +1,59 @@
# compilers and assemblers
CC = i386-aout-gcc
CFLAGS = -g -D${target_os}
C++ = ${CC}
C++FLAGS = ${CFLAGS}
CXX = ${CC}
CXXFLAGS = ${CFLAGS}
AS = i386-aout-as
ASFLAGS =
FC =
FCFLAGS =
LD = ld
LDFLAGS =
LIBS =
# binutils
RANLIB = i386-aout-ranlib
RANLIBFLAGS =
NM = i386-aout-nm
NMFLAGS =
SIZE = i386-aout-size
SIZEFLAGS =
STRIP = i386-aout-strip
STRIPFLAGS =
OBJDUMP = i386-aout-objdump
OBJDUMPFLAGS =
DEMANGLE = i386-aout-demangle
DEMANGLEFLAGS =
COPY = i386-aout-copy
COPYFLAGS =
# other utils
LEX = flex
LEXFLAGS =
YACC = byacc
YACCFLAGS =
AR = i386-aout-ar
ARFLAGS =
CPP = ${CC} -E
CPPFLAGS =
GDB = i386-aout-gdb
GDBFLAGS = -nx
DIFF = diff
DIFFFLAGS =
RUNTEST=i386-aout-runtest
RUNTESTFLAGS=

View File

@@ -0,0 +1 @@
LDFLAGS_FOR_TARGET = -nostartfiles

View File

@@ -0,0 +1,4 @@
CFLAGS_FOR_TARGET =
STEP_EXECUTABLE = step
THREADFLAGS = -mposix -mthreads
#LDFLAGS= -L/usr/cygnus/progressive-95q1/H-sparc-sun-sunos4.1.3/i386-lynx/lib/thread

View File

@@ -0,0 +1 @@
CFLAGS_FOR_TARGET = -Tidp.ld -nostartfiles

View File

@@ -0,0 +1,2 @@
CFLAGS = -I/s1/cygnus/dejagnu/mips-idt-ecoff/include -g
LDFLAGS = -nostartfiles /s1/cygnus/dejagnu/mips-idt-ecoff/crt0.o -L/s1/cygnus/dejagnu/mips-idt-ecoff -g

View File

@@ -0,0 +1 @@
LDFLAGS = -r

View File

@@ -0,0 +1,8 @@
LIBS = -lc -lg -lgcc
CFLAGS = -g -Dusestubs
LDFLAGS = ` \
if [ -f $${rootme}/../../newlib/Makefile ]; then \
echo -L$${rootsrc}/../../libgloss/ex93x -L$${rootme}/../../libgloss/ex93x -Tex93x.ld -nostartfiles -nostdlib -N; \
else \
echo -Tex93x.ld -nostartfiles -nostdlib -N; \
fi`

View File

View File

@@ -0,0 +1 @@
CFLAGS_FOR_TARGET = -g

View File

@@ -0,0 +1,2 @@
CFLAGS = -g -Dvxworks
LDFLAGS = -Xlinker -Ur

View File

@@ -0,0 +1,218 @@
# Copyright (C) 1988, 1990, 1991, 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 J.T. Conklin. (jtc@cygnus.com)
load_lib gdb.exp
load_lib remote.exp
global shell_id
global LD
if ![info exists LD] then {
set LD [findfile "$base_dir/../../ld/ld.new"]
}
global NLMCONV
if ![info exists NLMCONV] then {
set NLMCONV [findfile "$base_dir/../../binutils/nlmconv"]
}
#
# gdb_version -- extract and print the version number of gcc
#
proc gdb_version {} {
default_gdb_version
}
#
# gdb_unload -- unload a file if one is loaded
#
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global gdb_prompt
global LD
global NLMCONV
global errorCode
global shell_id
# FIXME: this is wrong.
set targetname [target_info name];
set obj [file tail $arg]
set nlm "$obj.nlm"
set lnk "$obj.lnk"
# build *.lnk file
set fd [open $lnk w]
puts $fd "description \"[file tail $nlm]\""
puts $fd "screenname \"System Console\""
puts $fd "module clib.nlm"
puts $fd "module mathlib.nlm"
puts $fd "stack 32768"
# puts $fd "stack 64512"
puts $fd "debug"
# FIXME: don't hardcode location of prelude.o
puts $fd "input /s1/cygnus/dejagnu/i386-netware/lib/prelude.o"
puts $fd "input $arg"
puts $fd "output $nlm"
close $fd
# run nlmconv
verbose "Executing: $NLMCONV -l$LD -T$lnk" 1
catch "exec $NLMCONV -l$LD -T$lnk" output
if ![string match "" $output] then {
verbose $output 1
}
if ![string match "NONE" $errorCode] {
warning "Can't link $arg"
return -1
}
catch "exec rm -f $lnk"
# download
verbose "Downloading $nlm" 1
catch "exec cp $nlm /.NetWare/$targetname.nws/sys.nwv/tmp/x.nlm" output
if ![string match "" $output] then {
verbose $output 1
return -1
}
gdb_file_cmd $nlm
}
proc gdb_run_cmd { } {
global shell_id
global gdb_prompt
global timeout
set connhost [target_info name];
if [board_info $connhost exists serial] {
set serialport [board_info $connhost serial];
} else {
set serialport [board_info $connhost netport];
}
if [board_info $connhost exists baud] {
set baud [board_info $connhost baud];
} else {
set baud 9600;
}
# FIXME: This is wrong.
send "kill\n"
gdb_expect {
-re ".*Kill the program being debugged.*y or n. $" {
send "y\n"
exp_continue
}
-re ".*$gdb_prompt $" {}
}
verbose "Starting GDB stub on [target_info name]" 1
send -i $shell_id "load nlmstub BAUD=$baud x.nlm\r\n"
send "set remotebaud $baud\n"
gdb_expect {
-re "$gdb_prompt" {}
timeout {
perror "Couldn't set remote baud rate"
return
}
}
set otimeout $timeout
set timeout 60
verbose "Timeout is now $timeout seconds" 2
send "target remote $serialport\n"
gdb_expect {
-re "Couldn't establish connection to remote target" {
send "target remote $serialport\n"
exp_continue
}
-re "$gdb_prompt" {}
timeout {
set timeout $otimeout
verbose "Timeout restored to $timeout seconds" 2
perror "Couldn't set remote target"
return
}
}
set timeout $otimeout
verbose "Timeout restored to $timeout seconds" 2
send "continue\n"
gdb_expect {
"Continuing.$" {}
}
return
}
#
# start the remote shell
#
set shell_prompt "Password:"
set shell_id [remote_open target]
if $shell_id<0 then {
warning "Couldn't connect to target"
return -1
}
if [string match "" $passwd] then {
stty -echo
send_user "Password: "
expect_user -re "(.*)\n"
send_user "\n"
set passwd "$expect_out(1,string)"
stty echo
}
send -i $shell_id "$passwd\n"
gdb_expect {
-i $shell_id ":" {
verbose "Got termtype prompt" 0
}
-i $shell_id timeout {
warning "Connection timed out"
return -1
}
}
# FIXME: this is wrong.
set shell_prompt "[string toupper [target_info name]]:"
send -i $shell_id "1\n"
gdb_expect {
-i $shell_id -re "$shell_prompt" {}
-i $shell_id timeout {
warning "Connection timed out"
return -1
}
}

View File

@@ -0,0 +1,49 @@
# Test Framework Driver
# Copyright (C) 1988, 1990, 1991, 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:
# DejaGnu@cygnus.com
# This file was written by Rob Savoye. (rob@cygnus.com)
load_lib gdb.exp
#
# gdb_load -- load a file into the debugger.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global gdb_prompt
global GDB
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
send_user "Not implememted yet\n" ; return -1
}
#
# gdb_start -- start GDB running
#
proc gdb_start { } {
global GDB
global GDBFLAGS
global spawn_id
global gdb_prompt
global verbose
send_user "Not implememted yet\n" ; return -1
}

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,85 @@
# Test Framework Driver for GDB driving a builtin simulator
# Copyright 1994, 1997, 1998 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.
load_lib gdb.exp
#
# gdb_target_sim
# Set gdb to target the simulator
#
proc gdb_target_sim { } {
global gdb_prompt
global exit_status
set target_sim_options "[board_info target gdb,target_sim_options]";
send_gdb "target sim $target_sim_options\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re "Connected to the simulator.*$gdb_prompt $" {
verbose "Set target to sim"
}
timeout {
perror "Couldn't set target for simulator."
cleanup
exit $exit_status
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
}
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global gdb_prompt
if [gdb_file_cmd $arg] then { return -1 }
gdb_target_sim
send_gdb "load\n"
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re ".*$gdb_prompt $" {
if $verbose>1 then {
send_user "Loaded $arg into $GDB\n"
}
set timeout 30
verbose "Timeout is now $timeout seconds" 2
return 1
}
-re "$gdb_prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
}

View File

@@ -0,0 +1,183 @@
# Copyright (C) 1993, 1997, 1998 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:
# DejaGnu@cygnus.com
# This file was written by Ian Lance Taylor <ian@cygnus.com>.
# GDB support routines for a board using the MIPS remote debugging
# protocol. These are actually pretty generic.
# DejaGnu currently assumes that debugging is being done over the main
# console port. It would probably be more convenient for people using
# IDT boards to permit the debugging port and the connected port to be
# different, since an IDT board has two ports. This would require
# extending some of the tests in a fashion similar to that done for
# VxWorks, because the test output would appear on the other port,
# rather than being displayed by gdb.
load_lib remote.exp
load_lib gdb.exp
set gdb_prompt "\\(gdb\\)"
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global gdb_prompt
global GDB
global expect_out
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
gdb_file_cmd $arg
if [target_info exists gdb_protocol] {
set protocol [target_info gdb_protocol];
} else {
set protocol "sparclite"
}
if [target_info exists serial] {
set targetname [target_info serial];
set command "target $protocol [target_info serial]\n";
} else {
if ![target_info exists netport] {
perror "Need either netport or gdb_serial entry for [target_info name].";
return -1;
}
set targetname [target_info netport];
set command "target $protocol udp [target_info netport]\n";
}
set timeout 60
verbose "Timeout is now $timeout seconds" 2
set try_count 0;
send_gdb $command;
gdb_expect {
-re "Unknown response.*resetting the board.|remote timeout" {
incr try_count;
if { $try_count > 3 } {
set try_count 0;
reboot_target;
sleep 5;
}
sleep 1;
send_gdb $command;
exp_continue;
}
-re "Remote target.*$gdb_prompt $" { }
-re ".*SPARClite appears to be alive.*$gdb_prompt $" {
if $verbose>1 then {
send_user "Set target to $targetname\n"
}
}
timeout {
perror "Couldn't set SLITE target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
if { 1 } {
if [is_remote host] {
set arg [remote_download host $arg];
if { $arg == "" } {
error "download failed"
return -1;
}
}
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
set timeout 2400
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re "Loading.*$gdb_prompt $" {
verbose "Loaded $arg into $GDB" 1
set timeout 30
verbose "Timeout is now $timeout seconds" 2
}
-re "$gdb_prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
}
# Some SPARClite boards automagically do a run after the program is
# loaded.
if [target_info exists need_monitor_run] {
set timeout 10
verbose "Timeout is now $timeout seconds, doing monitor run" 2
send_gdb "monitor run\n";
sleep 2;
send_gdb "";
gdb_expect {
-re ".*$gdb_prompt $" { verbose "Run command succeded" }
default {
perror "error sending monitor run command";
}
}
} else {
sleep 2;
}
if [target_info exists gdb_serial] {
set serial [target_info gdb_serial];
} else {
set serial [target_info serial];
}
send_gdb "target remote $serial\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re ".*Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-re ".*$gdb_prompt $" {
verbose "Set remote target to [target_info serial]" 2
}
timeout {
perror "Couldn't set remote target."
set timeout 10
verbose "Timeout is now $timeout seconds" 2
return -1
}
}
if [info exists expect_out(buffer)] then {
send_log $expect_out(buffer)
}
return 0
}

View File

@@ -0,0 +1,391 @@
# 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:
# DejaGnu@cygnus.com
# This file was written by Michael Snyder <msnyder@cygnus.com>.
# GDB support routines for a board using the sparclet remote debugging
# protocol.
load_lib remote.exp
load_lib gdb.exp
#
# Sparclet remote run command.
#
proc gdb_start { } {
global gdb_prompt
if ![file exists loader] {
global libdir
set loader loader;
if [target_info exists gdb_stub_offset] {
set result [target_compile "${libdir}/stub-loader.c" $loader executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"];
} else {
set result [target_compile "${libdir}/stub-loader.c" $loader executable "ldscript=[target_info gdb_stub_ldscript]"];
}
}
verbose -log "$gdb_prompt is gdb prompt"
set result 0;
for { set y 0; } { $y < 4 } { incr y } {
if { [default_gdb_start] != 0 } {
return -1;
}
if [target_info exists baud] {
send_gdb "set remotebaud [target_info baud]\n"
gdb_expect {
-re "$gdb_prompt" { }
default {
perror "Error setting baud rate."
return -1;
}
}
}
for {set x 1;} { $x < 4 } {incr x} {
set result [gdb_sparclet_startup $result];
if { $result > 0 } {
return 1;
}
# mmmmm, magic numbers.
if { $result == -42 || $result == -43 } {
break;
} else {
reboot_target;
}
}
if { $x == 4 } {
return -1;
}
gdb_exit;
sleep 5;
}
return -1;
}
proc gdb_sparclet_startup { arg } {
global gdb_prompt
global GDB
global verbose
set is_running_stub 0;
if [target_info exists serial] {
set serial [target_info serial];
} else {
set serial [target_info netport];
}
set protocol [target_info gdb_protocol];
set check_stub 1;
if { $arg != -42 } {
send_gdb "target $protocol $serial\n";
# 10 seconds may be a bit short.
gdb_expect 10 {
-re "already.*y or n." {
gdb_send "y\n";
exp_continue;
}
-re "Remote target.*connected to.*$gdb_prompt" { set check_stub 0; }
-re "$gdb_prompt" { }
timeout { }
}
if { $check_stub } {
verbose "timed out, checking if stub is already running"
send_gdb "\003";
sleep 1;
send_gdb "\003";
gdb_expect 10 {
-re "$gdb_prompt" { }
default {
remote_close host;
return -42;
}
}
}
}
if [target_info exists gdb_serial] {
set gdb_serial [target_info gdb_serial];
} else {
set gdb_serial $serial;
}
if { $check_stub } {
send_gdb "target remote $gdb_serial\n";
gdb_expect 15 {
-re "Remote debugging.*$gdb_prompt" {
verbose "stub is already running"
set is_running_stub 1;
}
default {
warning "board isn't responding";
remote_close host;
remote_reboot target;
return -43;
}
}
}
if { $is_running_stub == 0 } {
global srcdir
if [is_remote host] {
set loader [remote_download host "loader"];
} else {
set loader "loader";
}
send_gdb "file $loader\n";
gdb_expect {
-re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Reading symbols from.*done..*$gdb_prompt $" {}
-re "$gdb_prompt $" { perror "GDB couldn't find loader" }
timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
send_gdb "target $protocol $serial\n";
gdb_expect {
-re "Remote target.*connected to.*$gdb_prompt" { }
default {
perror "Error reconnecting to board.";
return -1;
}
}
send_gdb "load $loader [target_info gdb_stub_offset]\n"
verbose "Loading $loader into $GDB" 2
set no_run_command 0;
gdb_expect 1200 {
-re "Loading.*$gdb_prompt $" {
verbose "Loaded $loader into $GDB" 1
}
-re "Transfer rate:.*Switching to remote protocol.*Remote debugging" {
set no_run_command 1;
}
-re "$gdb_prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
if !$no_run_command {
send_gdb "run\n";
gdb_expect 60 {
-re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "The program being debugged .*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Starting program:.*loader.*$" {
verbose "Starting loader succeeded"
}
timeout {
perror "(timeout) starting the loader" ;
return -1
}
default {
perror "error starting the loader";
}
}
}
sleep 2;
send_gdb ""
sleep 1;
send_gdb ""
verbose "Sent ^C^C"
gdb_expect 10 {
-re "Give up .and stop debugging it.*$" {
send_gdb "y\n"
exp_continue
}
-re "$gdb_prompt $" {
verbose "Running loader succeeded"
}
timeout {
warning "(timeout) interrupting the loader" ;
remote_close host;
}
default {
warning "error interrupting the loader";
}
}
gdb_exit;
return [gdb_start];
}
return 1;
}
proc gdb_run_cmd { args } {
global gdb_prompt
gdb_breakpoint exit;
send_gdb "set \$fp=0\n";
gdb_expect {
-re "$gdb_prompt" { }
}
# This is needed for the SparcLite. Whee.
if [target_info exists gdb,start_symbol] {
set start_comm "jump *[target_info gdb,start_symbol]\n";
} else {
set start_comm "jump *start\n";
}
send_gdb "break copyloop\n";
gdb_expect 10 {
-re "Breakpoint.*$gdb_prompt $" {
set start_comm "continue\n";
}
-re "$gdb_prompt $" { }
timeout { warning "break copyloop failed badly"; }
}
send_gdb $start_comm;
gdb_expect 10 {
-re "y or n. $" {
remote_send host "y\n"
exp_continue;
}
-re "Breakpoint.*in copyloop.*$gdb_prompt $" {
remote_send host "jump relocd\n";
exp_continue;
}
-re "Continuing at.*\[\r\n\]" { }
default {
return -1;
}
}
return "";
}
#
# gdb_load -- load a file into the GDB.
# Returns a 0 if there was an error,
# 1 if it load successfully.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global gdb_prompt
global GDB
global expect_out
set loadfile [file tail $arg]
set loadpath [file dirname $arg]
set protocol [target_info gdb_protocol];
if [is_remote host] {
set arg [remote_download host $arg];
}
send_gdb "file $arg\n"
gdb_expect 30 {
-re "A program is being debug.*Kill it.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Load new symbol table.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Reading symbols from.*done..*$gdb_prompt $" {}
-re "$gdb_prompt $" { perror "GDB couldn't read file" }
timeout {
perror "(timeout) read symbol file" ;
return -1
}
}
if [target_info exists gdb_serial] {
set gdb_serial [target_info gdb_serial];
} else {
if [target_info exists serial] {
set gdb_serial [target_info serial];
} else {
set gdb_serial [target_info netport];
}
}
send_gdb "target remote $gdb_serial\n"
gdb_expect 30 {
-re "Kill it?.*y or n.*" {
send_gdb "y\n";
exp_continue
}
-re "$gdb_prompt $" {
verbose "Set remote target to $gdb_serial" 2
}
timeout {
perror "Couldn't set remote target."
return -1
}
}
if [target_info exists gdb_load_offset] {
set offset "[target_info gdb_load_offset]";
} else {
set offset "";
}
send_gdb "load $arg $offset\n"
verbose "Loading $arg into $GDB" 2
gdb_expect 1200 {
-re "Loading.*$gdb_prompt $" {
verbose "Loaded $arg into $GDB" 1
}
-re "$gdb_prompt $" {
if $verbose>1 then {
perror "GDB couldn't load."
}
}
timeout {
if $verbose>1 then {
perror "Timed out trying to load $arg."
}
}
}
send_gdb "list main\n";
gdb_expect 60 {
-re "$gdb_prompt" { }
default {
perror "command for list main never completed";
return -1;
}
}
return 0
}

View File

@@ -0,0 +1,112 @@
# Test Framework Driver for GDB driving Universal Debug Interface on 29K
# Copyright 1988, 1990, 1991, 1992, 1993, 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:
# DejaGnu@cygnus.com
# This file was written by Rob Savoye. (rob@cygnus.com)
load_lib gdb.exp
#
# gdb_target_udi
# Set gdb to the desired UDI target
#
proc gdb_target_udi { } {
global gdb_prompt
global verbose
global exit_status
set targetname [target_info mondfe,name];
# set targets hostname
send_gdb "target udi $targetname\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re "target udi $targetname\[\r\n\]+" {
exp_continue
}
-re "TIP UDI 1.2 Conformant.*$gdb_prompt $" {
verbose "Set target to $targetname"
}
-re "TIP-ipc WARNING,.*failed:" {
warning "$expect_out(buffer)"
}
-re "TIP-ipc ERROR,.*failed:" {
perror "$expect_out(buffer)"
}
-re "A program is being debugged already. Kill it\? \(y or n\)" {
send "y\n"
exp_continue
}
timeout {
perror "Couldn't set target for UDI."
cleanup
exit $exit_status
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
}
#
# gdb_load -- load a file into the debugger.
# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
global verbose
global loadpath
global loadfile
global GDB
global gdb_prompt
if [gdb_file_cmd $arg] {
return -1
}
gdb_target_udi
}
#
# gdb_start -- start GDB running. This assumes that there the
# UDICONF enviroment variable is set.
#
proc gdb_start { } {
global env;
set env(UDICONF) [target_info mondfe,udi_soc];
default_gdb_start
verbose "Setting up target, Please wait..."
gdb_target_udi
}
#
# gdb_exit -- exit gdb
#
proc gdb_exit { } {
catch default_gdb_exit
set in [open [concat "|ls -F"] r]
while {[gets $in line]>-1} {
if [regexp "=$" $line] then {
set line [string trimright $line "="]
verbose "Removing the $line named socket"
exec rm -f $line
}
}
close $in
}

View File

@@ -0,0 +1,29 @@
# Copyright (C) 1988, 1990, 1991, 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 Rob Savoye. (rob@cygnus.com)
# Set a default timeout to be used for the tests under UNIX, rather than
# accepting whatever default dejagnu gives us (apparently 10 seconds).
# When running the tests over NFS, under somewhat heavy load, 10 seconds
# does not seem to be enough. Try starting with 60.
set timeout 60
verbose "Timeout is now $timeout seconds" 2
load_lib gdb.exp

View File

@@ -0,0 +1,21 @@
# Copyright (C) 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
perror "Sorry, there is no support for this target"
exit 1

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/monitor.exp

130
gdb/testsuite/config/vx.exp Normal file
View File

@@ -0,0 +1,130 @@
# Copyright (C) 1988, 1990, 1991, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Please email any bugs, comments, and/or additions to this file to:
# DejaGnu@cygnus.com
# This file was written by Rob Savoye. (rob@cygnus.com)
#
# load support libraries
#
load_lib remote.exp
load_lib gdb.exp
set shell_prompt "->"
set gdb_prompt "\\(vxgdb\\)"
#
# gdb_version -- extract and print the version number of gcc
#
proc gdb_version {} {
default_gdb_version
}
#
# gdb_load -- load a file into the debugger.
# We have to stop and start gdb each time we do this, because when
# vxgdb loads two files in a row, the symbols in the first file loaded
# take precedence. Returns -1 on error, else 0.
#
proc gdb_load { arg } {
set result 0
if { [remote_ld target $arg] != 0 } {
perror "Couldn't load $arg"
return -1
}
return [gdb_file_cmd $arg]
}
#
# gdb_start -- start gdb running
#
proc gdb_start { } {
global gdb_prompt
global verbose
global connectmode
global reboot
# get a connection to the board
for { set x 0; } { $x < 3 } { incr x } {
set shell_id [remote_open target]
if { $shell_id > 0 } {
verbose "Spawn id for remote shell is $shell_id"
set timeout 10
verbose "Timeout is now $timeout seconds" 2
set state [spawn_vxgdb];
if { $state == "pass" } {
return 0;
}
if { $state == "fail" } {
return -1;
}
}
remote_reboot target;
}
}
proc spawn_vxgdb { } {
global gdb_prompt
default_gdb_start
# set the default arguments to "main", so that "run" with no
# arguments will work correctly.
send_gdb "set args main\n"
gdb_expect -re ".*$gdb_prompt $" {}
verbose "Setting up target, Please wait..."
# set targets hostname
send_gdb "target vxworks [target_info hostname]\n"
set timeout 60
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
-re "Done\..*$gdb_prompt $" {
verbose "Set target to [target_info hostname]" 1
set timeout 10;
return "pass";
}
-re "net_connect: RPC: (Program not registered|.*Timed out).*$" {
warning "Couldn't set GDB to target [target_info netport]."
}
timeout {
warning "Couldn't set target for vxworks."
}
}
return "retry";
}
proc gdb_exit { } {
remote_close target;
catch default_gdb_exit
}
#expect_after {
# "<return>" { send "\n"; perror "Window too small." }
# -re "\(y or n\) " { send "n\n"; perror "Got interactive prompt." }
# buffer_full { perror "internal buffer is full." }
# eof { perror "eof -- pty is hosed." }
# timeout { perror "timeout." }
# "virtual memory exhausted" { perror "virtual memory exhausted." }
# "Undefined command" { perror "send string probably wrong." }
#}

View File

@@ -0,0 +1,20 @@
# Copyright (C) 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
load_lib ../config/vx.exp

View File

@@ -0,0 +1,27 @@
# 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:
# DejaGnu@cygnus.com
# This file was written by Brendan Kehoe (brendan@cygnus.com).
# We need this file here because the targetname for the 29k board
# is `vxworks29k', not `vxworks'. That way other tools (e.g., gcc)
# can differentiate between the stuff run on that board and others.
verbose "Loading ${srcdir}/config/vx.exp"
source ${srcdir}/config/vx.exp

1058
gdb/testsuite/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,72 @@
dnl Process this file file with autoconf to produce a configure script.
dnl This file is a shell script fragment that supplies the information
dnl necessary to tailor a template configure script into the configure
dnl script appropriate for this directory. For more information, check
dnl any existing configure script.
AC_PREREQ(2.12.1)
AC_INIT(gdb.base)
CC=${CC-cc}
AC_SUBST(CC)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
AC_CANONICAL_SYSTEM
# Directories to use in all configurations.
configdirs="gdb.asm gdb.base gdb.c++ gdb.disasm gdb.chill gdb.threads gdb.trace"
# Directories to use for a configuration which uses stabs.
stabsdirs="gdb.stabs"
# this section is for targets that use stabs
# add stabs tests for appropriate targets
case "${target}" in
powerpc-*-aix*) configdirs="${configdirs} ${stabsdirs}" ;;
rs6000-*-aix*) configdirs="${configdirs} ${stabsdirs}" ;;
*-*-bsd*) configdirs="${configdirs} ${stabsdirs}" ;;
*-*-go32*) configdirs="${configdirs} ${stabsdirs}" ;;
*-*-linux*) configdirs="${configdirs} ${stabsdirs}" ;;
*-*-lynxos*) configdirs="${configdirs} ${stabsdirs}" ;;
*-sun-*) configdirs="${configdirs} ${stabsdirs}" ;;
hppa*-*-*) configdirs="${configdirs} ${stabsdirs}" ;;
*-*-elf*) configdirs="${configdirs} ${stabsdirs}" ;;
*) if test "x${with_stabs}" = x"yes" ; then
configdirs="${configdirs} ${stabsdirs}"
fi ;;
esac
# Directory with HP specific tests. They will run only with HP's compilers.
# These tests will not work on other platforms and compilers.
hpdir="gdb.hp"
case "${target}" in
hppa*-*-hpux*) configdirs="${configdirs} ${hpdir}" ;;
esac
# Begin stuff to support --enable-shared
AC_ARG_ENABLE(shared,
[ --enable-shared use shared libraries],
[case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) shared=true ;;
esac])dnl
RPATH_ENVVAR=LD_LIBRARY_PATH
# If we have shared libraries, try to set RPATH_ENVVAR reasonably.
if test "${shared}" = "true"; then
case "${host}" in
*-*-hpux*)
RPATH_ENVVAR=SHLIB_PATH
;;
esac
fi
AC_SUBST(RPATH_ENVVAR)
# End stuff to support --enable-shared
# configure the subdirectories too
AC_CONFIG_SUBDIRS($configdirs)
dnl AC_SUBST(gdb_target_cpu)
AC_OUTPUT(Makefile)

View File

@@ -0,0 +1,33 @@
VPATH = @srcdir@
srcdir = @srcdir@
EXECUTABLES =
# uuencoded format to avoid SCCS/RCS problems with binary files.
CROSS_EXECUTABLES =
all:
@echo "Nothing to be done for all..."
info:
install-info:
dvi:
install:
uninstall: force
installcheck:
check:
clean mostlyclean:
-rm -f *~ *.o a.out xgdb *.x $(CROSS_EXECUTABLES) *.ci *.tmp
-rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
-rm -f twice-tmp.c
distclean maintainer-clean realclean: clean
-rm -f *~ core
-rm -f Makefile config.status config.log
-rm -f arch.inc
-rm -f *-init.exp
-rm -fr *.log summary detail *.plog *.sum *.psum site.*
Makefile : $(srcdir)/Makefile.in $(srcdir)/configure.in
$(SHELL) ./config.status --recheck

View File

@@ -0,0 +1,99 @@
# Copyright (C) 1998 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 Kendra.
if $tracelevel then {
strace $tracelevel
}
#
# Test debugging assembly level programs.
# This file uses asmsrc[12].s for input.
#
set prms_id 0
set bug_id 0
if [istarget "d10v-*-*"] then {
set asm-arch d10v
} else {
verbose "Skipping assembly source test -- not implemented for this target."
return
}
set testfile "asm-source"
set binfile ${objdir}/${subdir}/${testfile}
set src1 ${srcdir}/${subdir}/asmsrc1.s
set src2 ${srcdir}/${subdir}/asmsrc2.s
set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}"
if {[gdb_compile ${src1} asmsrc1.o object "additional_flags=${asm-flags}"] != ""} then {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if {[gdb_compile ${src2} asmsrc2.o object "additional_flags=${asm-flags}"] != ""} then {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if { [gdb_compile "asmsrc1.o asmsrc2.o" ${binfile} executable "ldflags=-nodefaultlibs"] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}"
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# Run to `main' where we begin our tests.
#
if ![runto_main] then {
gdb_suppress_tests
}
# Execute the `f' command and see if the result includes source info.
gdb_test "f" "asmsrc1\[.\]s:18.*several_nops" "f at main"
# See if we properly `next' over a macro with several insns.
gdb_test "n" "22\[ \]*.*foo2" "next over macro"
# See if we can properly `step' into a subroutine call.
gdb_test "s" "8\[ \]*.*" "step into foo2"
# See if `f' prints the right source file.
gdb_test "f" ".*asmsrc2\[.\]s:8.*" "f in foo2"
# `next' one insn (or macro) to set up our stackframe (for the following bt).
gdb_test "n" "12\[ \]*.*foo3" "n in foo2"
# See if `bt' prints the right source files.
gdb_test "bt" "\#0.*foo2.*asmsrc2\[.\]s:12.*\#1.*main.*asmsrc1\[.\]s:22" "bt in foo2"
# Step into another subroutine which lives back in the first source file.
gdb_test "s" "" "s 2"
# Next over insns to set up the stack frame.
gdb_test "n" "" "n 2"
# Now see if `bt' is correct.
gdb_test "bt" "\#0.*foo3.*asmsrc1\[.\]s:33.*\#1.*foo2.*asmsrc2\[.\]s:12.*\#2.*main.*asmsrc1\[.\]s:22" "bt in foo3"

View File

@@ -0,0 +1,37 @@
.include "common.inc"
.include "arch.inc"
comment "main routine for assembly source debugging test"
comment "This particular testcase uses macros in <arch>.inc to achieve"
comment "machine independence. This file must be compiled with -Darch=foo."
comment "WARNING: asm-source.exp checks for line numbers printed by gdb,"
comment "therefore be careful about changing this file without also changing"
comment "asm-source.exp."
.global main
main:
enter
comment "Call a macro that consists of several lines of assembler code."
several_nops
comment "Call a subroutine in another file."
call foo2
comment "All done."
exit0
comment "A routine for foo2 to call."
.global foo3
foo3:
enter
leave
.global exit
exit:
exit0

View File

@@ -0,0 +1,16 @@
.include "common.inc"
.include "arch.inc"
comment "Second file in assembly source debugging testcase."
.global foo2
foo2:
enter
comment "Call someplace else."
call foo3
comment "All done, return."
leave

View File

@@ -0,0 +1,18 @@
.macro comment text
.endm
comment "Can't rely on assembler comment character so do this."
.macro include arch file
.include "\arch\file"
.endm
comment "arch.inc is responsible for defining the following macros:"
comment "enter - subroutine prologue"
comment "leave - subroutine epilogue"
comment "call - call a named subroutine"
comment "several_nops - execute several (typically 4) nops"
comment "exit0 - exit (0)"
comment "macros to label a subroutine may also eventually be needed"
comment "i.e. .global foo\nfoo:\n"

950
gdb/testsuite/gdb.asm/configure vendored Executable file
View File

@@ -0,0 +1,950 @@
#! /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=asm-source.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}-
archinc=common.inc
case ${target} in
d10v-*-*) archinc=d10v.inc ;;
esac
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
ac_sources="$archinc"
ac_dests="arch.inc"
EOF
cat >> $CONFIG_STATUS <<\EOF
srcdir=$ac_given_srcdir
while test -n "$ac_sources"; do
set $ac_dests; ac_dest=$1; shift; ac_dests=$*
set $ac_sources; ac_source=$1; shift; ac_sources=$*
echo "linking $srcdir/$ac_source to $ac_dest"
if test ! -r $srcdir/$ac_source; then
{ echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
fi
rm -f $ac_dest
# Make relative symlinks.
# Remove last slash and all that follows it. Not all systems have dirname.
ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
# The dest file is in a subdirectory.
test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
# A "../" for each directory in $ac_dest_dir_suffix.
ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
else
ac_dest_dir_suffix= ac_dots=
fi
case "$srcdir" in
[/$]*) ac_rel_source="$srcdir/$ac_source" ;;
*) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
esac
# Make a symlink if possible; otherwise try a hard link.
if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
ln $srcdir/$ac_source $ac_dest; then :
else
{ echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
fi
done
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

View File

@@ -0,0 +1,22 @@
dnl Process this file file with autoconf to produce a configure script.
dnl This file is a shell script fragment that supplies the information
dnl necessary to tailor a template configure script into the configure
dnl script appropriate for this directory. For more information, check
dnl any existing configure script.
AC_PREREQ(2.5)
AC_INIT(asm-source.exp)
CC=${CC-cc}
AC_SUBST(CC)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
AC_CANONICAL_SYSTEM
dnl In default case we need to link with some file so use common.inc.
archinc=common.inc
case ${target} in
d10v-*-*) archinc=d10v.inc ;;
esac
AC_LINK_FILES($archinc,arch.inc)
AC_OUTPUT(Makefile)

View File

@@ -0,0 +1,28 @@
comment "subroutine prologue"
.macro enter
st r13,@-sp
.endm
comment "subroutine epilogue"
.macro leave
ld r13,@sp+
jmp r13
.endm
.macro call subr
bl \subr
.endm
.macro several_nops
nop
nop
nop
nop
.endm
comment "exit (0)"
.macro exit0
ldi r4, 1
ldi r0, 0
trap 15
.endm

View File

@@ -0,0 +1,46 @@
VPATH = @srcdir@
srcdir = @srcdir@
EXECUTABLES = all-types bitfields break \
call-ar-st call-rt-st call-strs callfuncs callfuncs2 commands \
compiler condbreak constvars coremaker display \
ending-run exprs funcargs int-type interrupt \
jump langs \
list long_long \
mips_pro miscexprs nodebug opaque pointers pointers2 printcmds ptype \
recurse reread reread1 restore return run \
scope section_command setshow setvar \
shmain sigall signals smoke \
solib so-impl-ld so-indr-cl \
step-test structs structs2 twice-tmp varargs watchpoint whatis
# uuencoded format to avoid SCCS/RCS problems with binary files.
CROSS_EXECUTABLES = i486-elf i860-elf m68k-elf m68k-aout m68k-aout2 \
mips-ecoff sparc-aout sparc-elf
MISCELLANEOUS = coremmap.data shr1.sl shr2.sl solib1.sl solib2.sl
all:
@echo "Nothing to be done for all..."
info:
install-info:
dvi:
install:
uninstall: force
installcheck:
check:
clean mostlyclean:
-rm -f *~ *.o a.out xgdb *.x $(CROSS_EXECUTABLES) *.ci *.tmp
-rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
-rm -f $(MISCELLANEOUS) twice-tmp.c
distclean maintainer-clean realclean: clean
-rm -f *~ core
-rm -f Makefile config.status config.log
-rm -f *-init.exp
-rm -fr *.log summary detail *.plog *.sum *.psum site.*
Makefile : $(srcdir)/Makefile.in $(srcdir)/configure.in
$(SHELL) ./config.status --recheck

View File

@@ -0,0 +1,13 @@
Information about the various executables found in this test:
BFD CPU Objfile
Executable Target Type Type Info about compilation machine
---------- ------ ---- ------- -------------------------------
i486-elf elf-little i486 ELF NCR 3000, /usr/ccs/ATT/cc
i860-elf elf-big i860 ELF Stratus
m68k-elf elf-big m68k ELF Amiga 3000 UX, /usr/ccs/bin/cc
m68k-aout a.out-newsos3 m68k a.out Sony NEWS
m68k-aout2 a.out-sunos-big m68k a.out SunOS 4.1, gcc cygnus-2.0.1
sparc-aout a.out-sunos-big sparc a.out Sun 4, SunOS 4.1.1, gcc 2.1
sparc-elf elf-big sparc ELF Sun 4, Solaris 1.0, gcc 2.0.2
mips-ecoff ecoff-bigmips mips ecoff IRIX 4.0.1

View File

@@ -0,0 +1,426 @@
# Copyright (C) 1988, 1990, 1991, 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 Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
# are we on a target board
if [is_remote target] {
return
}
if [istarget "m68k*-*-hpux*"] then {
# The top-level makefile passes CFLAGS= (no -g) for hp300. This probably
# should be fixed (it is only needed for gcc bootstrapping, not gdb),
# but until then.....
setup_xfail "*-*-*"
fail "cannot test self if compiled without debug info"
return -1
}
# Not all of the lines of code near the start of main are executed for
# every machine. Also, optimization may reorder some of the lines.
# So all we do is try to step or next over everything until we get
# to a line that we know is always executed.
proc do_steps_and_nexts {} {
global gdb_prompt
global srcdir
gdb_reinitialize_dir $srcdir/..
for {set count 0} {$count < 20} {incr count} {
send_gdb "list\n"
gdb_expect {
-re ".*symarg = NULL.*$gdb_prompt $" {
set description "step over symarg initialization"
set command "step"
}
-re ".*execarg = NULL.*$gdb_prompt $" {
set description "step over execarg initialization"
set command "step"
}
-re ".*corearg = NULL.*$gdb_prompt $" {
set description "step over corearg initialization"
set command "step"
}
-re ".*cdarg = NULL.*$gdb_prompt $" {
set description "step over cdarg initialization"
set command "step"
}
-re ".*ttyarg = NULL.*$gdb_prompt $" {
set description "step over ttyarg initialization"
set command "step"
}
-re ".*time_at_startup = get_run_time.*$gdb_prompt $" {
set description "next over get_run_time and everything it calls"
set command "next"
}
-re ".*START_PROGRESS.*$gdb_prompt $" {
set description "next over START_PROGRESS and everything it calls"
set command "next"
}
-re ".*mac_init.*$gdb_prompt $" {
set description "next over mac_init and everything it calls"
set command "next"
}
-re ".*init_malloc.*$gdb_prompt $" {
set description "next over init_malloc and everything it calls"
set command "next"
}
-re ".*count . 0x3.*$gdb_prompt $" {
set description "next over conditional stack alignment code 1"
set command "next"
}
-re ".*if .i != 0.*$gdb_prompt $" {
set description "next over conditional stack alignment code 2"
set command "next"
}
-re ".*alloca .i - 4.*$gdb_prompt $" {
set description "next over conditional stack alignment alloca"
set command "next"
}
-re ".*SET_TOP_LEVEL.*$gdb_prompt $" {
set description "next over SET_TOP_LEVEL call"
set command "next"
}
-re ".*cmdsize = 1.*$gdb_prompt $" {
set description "step over cmdsize initialization"
set command "next"
}
-re ".*cmdarg = .* xmalloc.*$gdb_prompt $" {
set description "next over cmdarg initialization via xmalloc"
set command "next"
}
-re ".*ncmd = 0.*$gdb_prompt $" {
set description "next over ncmd initialization"
set command "next"
}
-re ".*dirsize = 1.*$gdb_prompt $" {
set description "next over dirsize initialization"
set command "next"
}
-re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
return
}
-re "\[ \t\]+\{\r\n$gdb_prompt $" {
setup_xfail "mips-*-irix5*"
fail "$description ended up at odd location"
}
-re ".*main.c.*No such file or directory.*$gdb_prompt $" {
setup_xfail "rs6000-*-aix3*"
fail "must be able to list source lines"
return
}
-re ".*$gdb_prompt $" {
fail "unknown source line after $description"
return
}
default {
fail "unknown source line near main"
return
}
}
send_gdb "$command\n"
gdb_expect {
-re ".*No such file or directory.\r\n$gdb_prompt $" {
fail "$description (no source available)"
}
-re ".*A file or directory .* does not exist..\r\n$gdb_prompt $" {
fail "$description (no source available)"
}
-re ".*$gdb_prompt $" {
pass "$description"
}
timeout {
fail "$description (timeout)"
}
}
}
}
proc test_with_self { executable } {
global gdb_prompt
global tool
global det_file
global decimal
global timeout
# load yourself into the debugger
# This can take a relatively long time, particularly for testing where
# the executable is being accessed over a network, or where gdb does not
# support partial symbols for a particular target and has to load the
# entire symbol table. Set the timeout to 10 minutes, which should be
# adequate for most environments (it *has* timed out with 5 min on a
# SPARCstation SLC under moderate load, so this isn't unreasonable).
# After gdb is started, set the timeout to 30 seconds for the duration
# of this test, and then back to the original value.
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
if {[gdb_load $executable] <0} then {
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
return -1
}
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
# disassemble yourself
gdb_test "x/10i main" \
"x/10i.*main.*main.$decimal.*main.$decimal.*" \
"Disassemble main"
# Set a breakpoint at main
gdb_test "break main" \
"Breakpoint.*at.* file.*, line.*" \
"breakpoint in main"
# We'll need this when we send a ^C to GDB. Need to do it before we
# run the program and gdb starts saving and restoring tty states.
# On Ultrix, we don't need it and it is really slow (because shell_escape
# doesn't use vfork).
if ![istarget "*-*-ultrix*"] then {
gdb_test "shell stty intr '^C'" "" \
"set interrupt character in test_with_self"
}
# FIXME: If we put this after the run to main, the first list
# command doesn't print the same line as the current line where
# gdb is stopped.
gdb_test "set listsize 1" "" "set listsize to 1"
# run yourself
# It may take a very long time for the inferior gdb to start (lynx),
# so we bump it back up for the duration of this command.
set timeout 600
set description "run until breakpoint at main"
send_gdb "run -nw\n"
gdb_expect {
-re "Starting program.*Breakpoint \[0-9\]+,.*main .argc.*argv.* at .*main.c:.*$gdb_prompt $" {
pass "$description"
}
-re "Starting program.*Breakpoint \[0-9\]+,.*main .argc.*argv.*$gdb_prompt $" {
xfail "$description (line numbers scrambled?)"
}
-re "vfork: No more processes.*$gdb_prompt $" {
fail "$description (out of virtual memory)"
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
return -1
}
-re ".*$gdb_prompt $" {
fail "$description"
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
return -1
}
timeout {
fail "$description (timeout)"
}
}
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
# do we have a version number ?
send_gdb "print version\n"
gdb_expect {
-re ".\[0-9\]+ = +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version"
}
-re ".\[0-9\]+ = +.+ +0x.*\[0-9.\]+.*$gdb_prompt $" {
pass "printed version with cast"
}
-re ".*$gdb_prompt $" { fail "printed version" }
timeout { fail "(timeout) printed version" }
}
do_steps_and_nexts
gdb_test "print \"foo\"" ".\[0-9\]+ = \"foo\"" "print a string"
# do_steps_and_nexts left us ready to execute an xmalloc call,
# so give that a try.
# If we don't actually enter the xmalloc call when we give a
# step command that seems like a genuine bug. It seems to happen
# on most RISC processors.
setup_xfail "alpha-*-*" "hppa*-*-*" "mips-*-*"
set description "step into xmalloc call"
send_gdb "step\n"
gdb_expect {
-re "xmalloc.*size=.*at.*utils.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*No such file or directory.\r\n$gdb_prompt $" {
pass "$description (no source available)"
}
-re "A file or directory .* does not exist..\r\n$gdb_prompt $" {
pass "$description (no source available)"
}
-re ".*$gdb_prompt $" {
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
# start the "xgdb" process
send_gdb "continue\n"
gdb_expect {
-re "GNU gdb \[0-9\.\]*.*
Copyright \[0-9\]* Free Software Foundation, Inc.*
GDB is free software, covered by the GNU General Public License, and you are.*
welcome to change it and/or distribute copies of it under certain conditions.*
Type \"show copying\" to see the conditions.*
There is absolutely no warranty for GDB. Type \"show warranty\" for details.*
This GDB was configured as .*$gdb_prompt $"\
{ pass "xgdb is at prompt" }
-re "GDB is free software and you are welcome to distribute copies of it.*
under certain conditions; type \"show copying\" to see the conditions..*
There is absolutely no warranty for GDB; type \"show warranty\" for details..*
GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
{ pass "xgdb is at prompt (obsolescent gdb)" }
-re ".*$gdb_prompt $" { fail "xgdb is at prompt" }
timeout { fail "(timeout) xgdb is at prompt" }
}
# set xgdb prompt so we can tell which is which
send_gdb "set prompt (xgdb) \n"
gdb_expect {
-re "\[(\]xgdb\[)\].*\[(\]xgdb\[)\] $" { pass "Set xgdb prompt" }
-re ".*$gdb_prompt $" { fail "Set xgdb prompt" }
default { fail "(timeout) Set xgdb prompt" }
}
# kill the xgdb process
set description "send ^C to child process"
send_gdb "\003"
gdb_expect {
-re "Program received signal SIGINT.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
set description "send SIGINT signal to child process"
send_gdb "signal SIGINT\n"
gdb_expect {
-re "Continuing with signal SIGINT.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
# get a stack trace
#
# This fails on some linux systems for unknown reasons. On the
# systems where it fails, sometimes it works fine when run manually.
# The testsuite failures may not be limited to just aout systems.
setup_xfail "i*86-pc-linuxaout-gnu" "hppa*-*-hpux*"
set description "backtrace through signal handler"
send_gdb "backtrace\n"
gdb_expect {
-re "#0.*read.*in main \\(.*\\) at .*main\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
# On the alpha, we hit the infamous problem about gdb
# being unable to get the frame pointer (mentioned in
# gdb/README). As it is intermittent, there is no way to
# XFAIL it which will give us an XPASS if the problem goes
# away.
setup_xfail "alpha*-*-osf*"
fail "$description"
}
timeout {
fail "$description (timeout)"
}
}
# Set the timeout back to the value it had when we were called.
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
# Restart gdb in case next test expects it to be started already.
return 0
}
# Find a pathname to a file that we would execute if the shell was asked
# to run $arg using the current PATH.
proc find_gdb { arg } {
# If the arg directly specifies an existing executable file, then
# simply use it.
if [file executable $arg] then {
return $arg
}
set result [which $arg]
if [string match "/" [ string range $result 0 0 ]] then {
return $result
}
# If everything fails, just return the unqualified pathname as default
# and hope for best.
return $arg
}
# Run the test with self.
# Copy the file executable file in case this OS doesn't like to edit its own
# text space.
set GDB_FULLPATH [find_gdb $GDB]
# Remove any old copy lying around.
remote_file host delete x$tool
gdb_start
set file [remote_download host $GDB_FULLPATH x$tool]
set result [test_with_self $file];
gdb_exit;
catch "remote_file host delete $file";
if {$result <0} then {
warning "Couldn't test self"
return -1
}

View File

@@ -0,0 +1,253 @@
# Copyright (C) 1988, 1990, 1991, 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 Rob Savoye. (rob@cygnus.com)
# These tests don't work for targets can't take arguments...
if [target_info exists noargs] then {
verbose "Skipping a2-run.exp because of noargs."
return
}
if [target_info exists gdb,noinferiorio] {
verbose "Skipping a2-run.exp because of noinferiorio."
return
}
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "run"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Run with no arguments.
# On VxWorks this justs make sure the program was run.
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
"Program exited normally" {
unresolved "run \"$testfile\" with no args"
}
-re "usage: factorial <number>" {
pass "run \"$testfile\" with no args"
}
timeout {
fail "(timeout) run \"$testfile\" with no args"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
gdb_expect {
-re ".*usage: factorial <number>.*Program exited with code 01.*$gdb_prompt $" {
pass "run \"$testfile\" with no args"
}
-re ".*$gdb_prompt $" {
fail "run \"$testfile\" with no args"
verbose "expect_out is $expect_out(buffer)" 2
}
timeout {
fail "(timeout) run \"$testfile\" no args"
}
}
}
# Now run with some arguments
if [istarget "*-*-vxworks*"] then {
send_gdb "run vxmain \"5\"\n"
gdb_expect -re "run vxmain \"5\"\r\n" {}
set timeout 120
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
"Program exited normally" {
unresolved "run \"$testfile\" with arg"
}
"120" {
pass "run \"$testfile\" with arg"
}
timeout {
fail "(timeout) run \"$testfile\" with arg"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
setup_xfail "mips-idt-*" "arm-*-coff"
gdb_run_cmd 5
gdb_expect {
-re ".*120.*$gdb_prompt $"\
{ pass "run \"$testfile\" with arg" }
-re ".*$gdb_prompt $" { fail "run \"$testfile\" with arg" }
timeout { fail "(timeout) run \"$testfile\" with arg" }
}
}
# Run again with same arguments.
setup_xfail "mips-idt-*"
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
"Program exited normally" {
unresolved "run \"$testfile\" again with same args"
}
"120" { pass "run \"$testfile\" again with same args" }
timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
setup_xfail "arm-*-coff"
gdb_expect {
-re ".*120.*$gdb_prompt $"\
{ pass "run \"$testfile\" again with same args" }
-re ".*$gdb_prompt $" { fail "run \"$testfile\" again with same args" }
timeout { fail "(timeout) run \"$testfile\" again with same args" }
}
}
# Use "set args" command to specify no arguments as default and run again.
if [istarget "*-*-vxworks*"] then {
send_gdb "set args main\n"
} else {
send_gdb "set args\n"
}
gdb_expect -re "$gdb_prompt $"
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
"Program exited normally" {
unresolved "run after setting args to nil"
}
"usage: factorial <number>" {
pass "run after setting args to nil"
}
timeout {
fail "(timeout) run after setting args to nil"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
gdb_expect {
-re ".*usage: factorial <number>.*$gdb_prompt $" {
pass "run after setting args to nil"
}
-re ".*$gdb_prompt $" {
fail "run after setting args to nil"
}
timeout {
fail "(timeout) run after setting args to nil"
}
}
}
# Use "set args" command to specify an argument and run again.
setup_xfail "mips-idt-*"
if [istarget "*-*-vxworks*"] then {
send_gdb "set args vxmain \"6\"\n"
} else {
send_gdb "set args 6\n"
}
gdb_expect -re "$gdb_prompt $"
gdb_run_cmd
if [istarget "*-*-vxworks*"] then {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
gdb_expect {
"Program exited normally" {
unresolved "run \"$testfile\" again after setting args"
}
"720" {
pass "run \"$testfile\" again after setting args"
}
timeout {
fail "(timeout) run \"$testfile\" again after setting args"
}
}
set timeout 10
verbose "Timeout is now $timeout seconds" 2
gdb_expect -re "$gdb_prompt $" {}
} else {
setup_xfail "arm-*-coff"
gdb_expect {
-re ".*720.*$gdb_prompt $" {
pass "run \"$testfile\" again after setting args"
}
-re ".*$gdb_prompt $" {
fail "run \"$testfile\" again after setting args"
}
timeout {
fail "(timeout) run \"$testfile\" again after setting args"
}
}
}
# GOAL: Test that shell is being used with "run". For remote debugging
# targets, there is no guarantee that a "shell" (whatever that is) is used.
if [isnative] then {
send_gdb "run `echo 8`\n"
gdb_expect {
-re "Starting program.*40320.*$gdb_prompt $" {
pass "run \"$testfile\" with shell"
}
-re ".*$gdb_prompt $" {
fail "run \"$testfile\" with shell"
}
timeout {
fail "(timeout) run \"$testfile\" with shell"
}
}
}
# Reset the default arguments for VxWorks
if [istarget "*-*-vxworks*"] then {
send_gdb "set args main\n"
gdb_expect -re ".*$gdb_prompt $" {}
}

View File

@@ -0,0 +1,467 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# tests for arithmetic, logical and relational operators
# with mixed types
#
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "all-types"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
gdb_test "next" "return 0;" "continuing after dummy()"
send_gdb "print v_int+v_char\n"
gdb_expect {
-re ".*71.*$gdb_prompt $" {
pass "print value of v_int+v_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_char" }
timeout { fail "(timeout) print value of v_int+v_char" }
}
send_gdb "print v_int+v_short\n"
gdb_expect {
-re ".*9.*$gdb_prompt $" {
pass "print value of v_int+v_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_short" }
timeout { fail "(timeout) print value of v_int+v_short" }
}
send_gdb "print v_int+v_signed_char\n"
gdb_expect {
-re ".*72.*$gdb_prompt $" {
pass "print value of v_int+v_signed_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_char" }
timeout { fail "(timeout) print value of v_int+v_signed_char" }
}
send_gdb "print v_int+v_unsigned_char\n"
gdb_expect {
-re ".*73.*$gdb_prompt $" {
pass "print value of v_int+v_unsigned_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_char" }
timeout { fail "(timeout) print value of v_int+v_unsigned_char" }
}
send_gdb "print v_int+v_signed_short\n"
gdb_expect {
-re ".*10.*$gdb_prompt $" {
pass "print value of v_int+v_signed_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_short" }
timeout { fail "(timeout) print value of v_int+v_signed_short" }
}
send_gdb "print v_int+v_unsigned_short\n"
gdb_expect {
-re ".*11.*$gdb_prompt $" {
pass "print value of v_int+v_unsigned_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_short" }
timeout { fail "(timeout) print value of v_int+v_unsigned_short" }
}
send_gdb "print v_int+v_signed_int\n"
gdb_expect {
-re ".*13.*$gdb_prompt $" {
pass "print value of v_int+v_signed_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_int" }
timeout { fail "(timeout) print value of v_int+v_signed_int" }
}
send_gdb "print v_int+v_unsigned_int\n"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
pass "print value of v_int+v_unsigned_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_int" }
timeout { fail "(timeout) print value of v_int+v_unsigned_int" }
}
send_gdb "print v_int+v_long\n"
gdb_expect {
-re ".*15.*$gdb_prompt $" {
pass "print value of v_int+v_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_long" }
timeout { fail "(timeout) print value of v_int+v_long" }
}
send_gdb "print v_int+v_signed_long\n"
gdb_expect {
-re ".*16.*$gdb_prompt $" {
pass "print value of v_int+v_signed_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_signed_long" }
timeout { fail "(timeout) print value of v_int+v_signed_long" }
}
send_gdb "print v_int+v_unsigned_long\n"
gdb_expect {
-re ".*17.*$gdb_prompt $" {
pass "print value of v_int+v_unsigned_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_unsigned_long" }
timeout { fail "(timeout) print value of v_int+v_unsigned_long" }
}
send_gdb "print v_int+v_float\n"
gdb_expect {
-re ".*106.34343.*$gdb_prompt $" {
pass "print value of v_int+v_float"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_float" }
timeout { fail "(timeout) print value of v_int+v_float" }
}
send_gdb "print v_int+v_double\n"
gdb_expect {
-re ".*206.56565.*$gdb_prompt $" {
pass "print value of v_int+v_double"
}
-re ".*$gdb_prompt $" { fail "print value of v_int+v_double" }
timeout { fail "(timeout) print value of v_int+" }
}
#
# test the relational operators with mixed types
#
send_gdb "print v_int <= v_char\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_char" }
timeout { fail "(timeout) print value of v_int<=v_char" }
}
send_gdb "print v_int <= v_short\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int<=v_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" }
timeout { fail "(timeout) print value of v_int<=v_short" }
}
send_gdb "print v_int <= v_signed_char\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_signed_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_char" }
timeout { fail "(timeout) print value of v_int<=v_signed_char" }
}
send_gdb "print v_int <= v_unsigned_char\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_unsigned_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_char" }
timeout { fail "(timeout) print value of v_int<=v_unsigned_char" }
}
send_gdb "print v_int <= v_signed_short\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int<=v_signed_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" }
timeout { fail "(timeout) print value of v_int<=v_signed_short" }
}
send_gdb "print v_int <= v_unsigned_short\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int<=v_unsigned_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" }
timeout { fail "(timeout) print value of v_int<=v_unsigned_short" }
}
send_gdb "print v_int <= v_signed_int\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_signed_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" }
timeout { fail "(timeout) print value of v_int<=v_signed_int" }
}
send_gdb "print v_int <= v_unsigned_int\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_unsigned_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" }
timeout { fail "(timeout) print value of v_int<=v_unsigned_int" }
}
send_gdb "print v_int <= v_long\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" }
timeout { fail "(timeout) print value of v_int<=v_long" }
}
send_gdb "print v_int <= v_signed_long\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_signed_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" }
timeout { fail "(timeout) print value of v_int<=v_signed_long" }
}
send_gdb "print v_int <= v_unsigned_long\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_unsigned_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" }
timeout { fail "(timeout) print value of v_int<=v_unsigned_long" }
}
send_gdb "print v_int <= v_float\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_float"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" }
timeout { fail "(timeout) print value of v_int<=v_float" }
}
send_gdb "print v_int <= v_double\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int<=v_double"
}
-re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" }
timeout { fail "(timeout) print value of v_int<=v_double" }
}
#
# test the logical operators with mixed types
#
gdb_test "set variable v_char=0" "" "set v_char=0"
gdb_test "set variable v_double=0.0" "" "set v_double=0"
gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0"
send_gdb "print v_int && v_char\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int&&v_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" }
timeout { fail "(timeout) print value of v_int&&v_char" }
}
send_gdb "print v_int && v_short\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" }
timeout { fail "(timeout) print value of v_int&&v_short" }
}
send_gdb "print v_int && v_signed_char\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_signed_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" }
timeout { fail "(timeout) print value of v_int&&v_signed_char" }
}
send_gdb "print v_int && v_unsigned_char\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_unsigned_char"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" }
timeout { fail "(timeout) print value of v_int&&v_unsigned_char" }
}
send_gdb "print v_int && v_signed_short\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_signed_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" }
timeout { fail "(timeout) print value of v_int&&v_signed_short" }
}
send_gdb "print v_int && v_unsigned_short\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_unsigned_short"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" }
timeout { fail "(timeout) print value of v_int&&v_unsigned_short" }
}
send_gdb "print v_int && v_signed_int\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_signed_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" }
timeout { fail "(timeout) print value of v_int&&v_signed_int" }
}
send_gdb "print v_int && v_unsigned_int\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_unsigned_int"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" }
timeout { fail "(timeout) print value of v_int&&v_unsigned_int" }
}
send_gdb "print v_int && v_long\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" }
timeout { fail "(timeout) print value of v_int&&v_long" }
}
send_gdb "print v_int && v_signed_long\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_signed_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" }
timeout { fail "(timeout) print value of v_int&&v_signed_long" }
}
send_gdb "print v_int && v_unsigned_long\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int&&v_unsigned_long"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" }
timeout { fail "(timeout) print value of v_int&&v_unsigned_long" }
}
send_gdb "print v_int && v_float\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of v_int&&v_float"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" }
timeout { fail "(timeout) print value of v_int&&v_float" }
}
send_gdb "print v_int && v_double\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of v_int&&v_double"
}
-re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" }
timeout { fail "(timeout) print value of v_int&&v_double" }
}

View File

@@ -0,0 +1,62 @@
/*
* the basic C types.
*/
#if !defined (__STDC__) && !defined (_AIX)
#define signed /**/
#endif
char v_char;
signed char v_signed_char;
unsigned char v_unsigned_char;
short v_short;
signed short v_signed_short;
unsigned short v_unsigned_short;
int v_int;
signed int v_signed_int;
unsigned int v_unsigned_int;
long v_long;
signed long v_signed_long;
unsigned long v_unsigned_long;
float v_float;
double v_double;
int main ()
{
extern void dummy();
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
dummy();
return 0;
}
void dummy()
{
/* Some linkers (e.g. on AIX) remove unreferenced variables,
so make sure to reference them. */
v_char = 'A';
v_signed_char = 'B';
v_unsigned_char = 'C';
v_short = 3;
v_signed_short = 4;
v_unsigned_short = 5;
v_int = 6;
v_signed_int = 7;
v_unsigned_int = 8;
v_long = 9;
v_signed_long = 10;
v_unsigned_long = 11;
v_float = 100.343434;
v_double = 200.565656;
}

View File

@@ -0,0 +1,375 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# tests for correctness of arithmetic operators, associativity and precedence
# with integer type variables
#
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "int-type"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
#
# test expressions with "int" types
#
gdb_test "set variable x=14" "" "set variable x=14"
gdb_test "set variable y=2" "" "set variable y=2"
gdb_test "set variable z=2" "" "set variable z=2"
gdb_test "set variable w=3" "" "set variable w=3"
send_gdb "print x\n"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
pass "print value of x"
}
-re ".*$gdb_prompt $" { fail "print value of x" }
timeout { fail "(timeout) print value of x" }
}
send_gdb "print y\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of y"
}
-re ".*$gdb_prompt $" { fail "print value of y" }
timeout { fail "(timeout) print value of y" }
}
send_gdb "print z\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of z"
}
-re ".*$gdb_prompt $" { fail "print value of z" }
timeout { fail "(timeout) print value of z" }
}
send_gdb "print w\n"
gdb_expect {
-re ".*3.*$gdb_prompt $" {
pass "print value of w"
}
-re ".*$gdb_prompt $" { fail "print value of w" }
timeout { fail "(timeout) print value of w" }
}
send_gdb "print x+y\n"
gdb_expect {
-re ".*16.*$gdb_prompt $" {
pass "print value of x+y"
}
-re ".*$gdb_prompt $" { fail "print value of x+y" }
timeout { fail "(timeout) print value of x+y" }
}
send_gdb "print x-y\n"
gdb_expect {
-re ".*12.*$gdb_prompt $" {
pass "print value of x-y"
}
-re ".*$gdb_prompt $" { fail "print value of x-y" }
timeout { fail "(timeout) print value of x-y" }
}
send_gdb "print x*y\n"
gdb_expect {
-re ".*28.*$gdb_prompt $" {
pass "print value of x*y"
}
-re ".*$gdb_prompt $" { fail "print value of x*y" }
timeout { fail "(timeout) print value of x*y" }
}
send_gdb "print x/y\n"
gdb_expect {
-re ".*7.*$gdb_prompt $" {
pass "print value of x/y"
}
-re ".*$gdb_prompt $" { fail "print value of x/y" }
timeout { fail "(timeout) print value of x/y" }
}
send_gdb "print x%y\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of x%y"
}
-re ".*$gdb_prompt $" { fail "print value of x%y" }
timeout { fail "(timeout) print value of x%y" }
}
# Test associativity of +, -, *, % ,/
send_gdb "print x+y+z\n"
gdb_expect {
-re ".*18.*$gdb_prompt $" {
pass "print value of x+y"
}
-re ".*$gdb_prompt $" { fail "print value of x+y" }
timeout { fail "(timeout) print value of x+y" }
}
send_gdb "print x-y-z\n"
gdb_expect {
-re ".*10.*$gdb_prompt $" {
pass "print value of x-y"
}
-re ".*$gdb_prompt $" { fail "print value of x-y" }
timeout { fail "(timeout) print value of x-y" }
}
send_gdb "print x*y*z\n"
gdb_expect {
-re ".*56.*$gdb_prompt $" {
pass "print value of x*y"
}
-re 8".*$gdb_prompt $" { fail "print value of x*y" }
timeout { fail "(timeout) print value of x*y" }
}
send_gdb "print x/y/z\n"
gdb_expect {
-re ".*3.*$gdb_prompt $" {
pass "print value of x/y"
}
-re ".*$gdb_prompt $" { fail "print value of x/y" }
timeout { fail "(timeout) print value of x/y" }
}
send_gdb "print x%y%z\n"
gdb_expect {
-re ".*0.*$gdb_prompt $" {
pass "print value of x%y"
}
-re ".*$gdb_prompt $" { fail "print value of x%y" }
timeout { fail "(timeout) print value of x%y" }
}
# test precedence rules on pairs of arithmetic operators
gdb_test "set variable x=10" "" "set variable x"
gdb_test "set variable y=4" "" "set variable y"
gdb_test "set variable z=2" "" "set variable z"
# x y z
# 10 4 2
send_gdb "print x+y-z\n"
gdb_expect {
-re ".*12.*$gdb_prompt $" {
pass "print value of x+y-z"
}
-re ".*$gdb_prompt $" { fail "print value of x+y-z" }
timeout { fail "(timeout) print value of x+y-z" }
}
# 10 4 2
send_gdb "print x+y*z\n"
gdb_expect {
-re ".*18.*$gdb_prompt $" {
pass "print value of x+y*z"
}
-re ".*$gdb_prompt $" { fail "print value of x+y*z" }
timeout { fail "(timeout) print value of x+y*z" }
}
gdb_test "set variable z=3" "" "set variable z"
# 10 4 3
send_gdb "print x+y%z\n"
gdb_expect {
-re ".*11.*$gdb_prompt $" {
pass "print value of x+y%z"
}
-re ".*$gdb_prompt $" { fail "print value of x+y%z" }
timeout { fail "(timeout) print value of x+y%z" }
}
# 10 4 3
send_gdb "print x+y/z\n"
gdb_expect {
-re ".*11.*$gdb_prompt $" {
pass "print value of x+y/z"
}
-re ".*$gdb_prompt $" { fail "print value of x+y/z" }
timeout { fail "(timeout) print value of x+y/z" }
}
gdb_test "set variable z=2" "" " set variable z"
# 10 4 2
send_gdb "print x-y*z\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "print value of x-y*z"
}
-re ".*$gdb_prompt $" { fail "print value of x-y*z" }
timeout { fail "(timeout) print value of x-y*z" }
}
# 10 4 2
send_gdb "print x-y%z\n"
gdb_expect {
-re ".*10.*$gdb_prompt $" {
pass "print value of x-y%z"
}
-re ".*$gdb_prompt $" { fail "print value of x-y%z" }
timeout { fail "(timeout) print value of x-y%z" }
}
# 10 4 2
send_gdb "print x-y/z\n"
gdb_expect {
-re ".*8.*$gdb_prompt $" {
pass "print value of x-y/z"
}
-re ".*$gdb_prompt $" { fail "print value of x-y/z" }
timeout { fail "(timeout) print value of x-y/z" }
}
# 10 4 2
send_gdb "print x*y/z\n"
gdb_expect {
-re ".*20.*$gdb_prompt $" {
pass "print value of x*y/z"
}
-re ".*$gdb_prompt $" { fail "print value of x*y/z" }
timeout { fail "(timeout) print value of x*y/z" }
}
gdb_test "set variable z=3" "" "set z to 3"
# 10 4 3
send_gdb "print x*y%z\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "print value of x*y%z"
}
-re ".*$gdb_prompt $" { fail "print value of x*y%z" }
timeout { fail "(timeout) print value of x*y%z" }
}
# 10 4 3
send_gdb "print x/y%z\n"
gdb_expect {
-re ".*2\r\n$gdb_prompt $" {
pass "print value of x/y%z"
}
-re ".*$gdb_prompt $" { fail "print value of x/y%z" }
timeout { fail "(timeout) print value of x/y%z" }
}
# test use of parenthesis to enforce different order of evaluation
# 10 4 3
send_gdb "print x-(y+z)\n"
gdb_expect {
-re ".*3\r\n$gdb_prompt $" {
pass "print value of x-(y+z)"
}
-re ".*$gdb_prompt $" { fail "print value of x-(y+z)" }
timeout { fail "(timeout) print value of x-(y+z)" }
}
# 10 4 3
send_gdb "print x/(y*z)\n"
gdb_expect {
-re ".*0\r\n$gdb_prompt $" {
pass "print value of x/(y*z)"
}
-re ".*$gdb_prompt $" { fail "print value of x/(y*z)" }
timeout { fail "(timeout) print value of x/(y*z)" }
}
# 10 4 3
send_gdb "print x-(y/z)\n"
gdb_expect {
-re ".*9\r\n$gdb_prompt $" {
pass "print value of x-(y/z)"
}
-re ".*$gdb_prompt $" { fail "print value of x-(y/z)" }
timeout { fail "(timeout) print value of x-(y/z)" }
}
# 10 4 3
send_gdb "print (x+y)*z\n"
gdb_expect {
-re ".*42\r\n$gdb_prompt $" {
pass "print value of (x+y)*z"
}
-re ".*$gdb_prompt $" { fail "print value of (x+y)*z" }
timeout { fail "(timeout) print value of (x+y)*z" }
}

View File

@@ -0,0 +1,446 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# tests for all the assignemnt operators
# with mixed types and with int type variables
#
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "all-types"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
gdb_test "next" "return 0;" "continuing after dummy()"
send_gdb "print v_int=57\n"
gdb_expect {
-re ".*57.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*57.*$gdb_prompt $" {
pass "v_int=57"
}
-re ".*$gdb_prompt $" { fail "v_int=57" }
timeout { fail "(timeout) v_int=57" }
}
}
-re ".*$gdb_prompt $" { fail "v_int=57" }
timeout { fail "(timeout) v_int=57" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=57\n"
gdb_expect {
-re ".*63.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*63.*$gdb_prompt $" {
pass "v_int+=57"
}
-re ".*$gdb_prompt $" { fail "v_int+=57" }
timeout { fail "(timeout) v_int+=57" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=57" }
timeout { fail "(timeout) v_int+=57" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int-=57\n"
gdb_expect {
-re ".*-51.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*-51.*$gdb_prompt $" {
pass "v_int-=57"
}
-re ".*$gdb_prompt $" { fail "v_int-=57" }
timeout { fail "(timeout) v_int-=57" }
}
}
-re ".*$gdb_prompt $" { fail "v_int-=57" }
timeout { fail "(timeout) v_int-=57" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int*=5\n"
gdb_expect {
-re ".*30.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*30.*$gdb_prompt $" {
pass "v_int*=5"
}
-re ".*$gdb_prompt $" { fail "v_int*=5" }
timeout { fail "(timeout) v_int*=5" }
}
}
-re ".*$gdb_prompt $" { fail "v_int*=5" }
timeout { fail "(timeout) v_int*=5" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int/=4\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*1.*$gdb_prompt $" {
pass "v_int/=4"
}
-re ".*$gdb_prompt $" { fail "v_int/=4" }
timeout { fail "(timeout) v_int/=4" }
}
}
-re ".*$gdb_prompt $" { fail "v_int/=4" }
timeout { fail "(timeout) v_int/=4" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int%=4\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*2.*$gdb_prompt $" {
pass "v_int%=4"
}
-re ".*$gdb_prompt $" { fail "v_int%=4" }
timeout { fail "(timeout) v_int%=4" }
}
}
-re ".*$gdb_prompt $" { fail "v_int%=4" }
timeout { fail "(timeout) v_int%=4" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_char\n"
gdb_expect {
-re ".*71.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*71.*$gdb_prompt $" {
pass "v_int+=char"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_char" }
timeout { fail "(timeout) v_int+=v_char" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_char" }
timeout { fail "(timeout) v_int+=v_char" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_signed_char\n"
gdb_expect {
-re ".*72.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*72.*$gdb_prompt $" {
pass "v_int+=signed_char"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
timeout { fail "(timeout) v_int+=v_signed_char" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_char" }
timeout { fail "(timeout) v_int+=v_signed_char" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_unsigned_char\n"
gdb_expect {
-re ".*73.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*73.*$gdb_prompt $" {
pass "v_int+=unsigned_char"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
timeout { fail "(timeout) v_int+=v_unsigned_char" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_char" }
timeout { fail "(timeout) v_int+=v_unsigned_char" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_short\n"
gdb_expect {
-re ".*9.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*9.*$gdb_prompt $" {
pass "v_int+=short"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_short" }
timeout { fail "(timeout) v_int+=v_short" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_short" }
timeout { fail "(timeout) v_int+=v_short" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_signed_short\n"
gdb_expect {
-re ".*10.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*10.*$gdb_prompt $" {
pass "v_int+=signed_short"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
timeout { fail "(timeout) v_int+=v_signed_short" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_short" }
timeout { fail "(timeout) v_int+=v_signed_short" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_unsigned_short\n"
gdb_expect {
-re ".*11.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*11.*$gdb_prompt $" {
pass "v_int=+unsigned_short"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
timeout { fail "(timeout) v_int+=v_unsigned_short" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_short" }
timeout { fail "(timeout) v_int+=v_unsigned_short" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_signed_int\n"
gdb_expect {
-re ".*13.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*13.*$gdb_prompt $" {
pass "v_int+=signed_int"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
timeout { fail "(timeout) v_int+=v_signed_int" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_int" }
timeout { fail "(timeout) v_int+=v_signed_int" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_unsigned_int\n"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*14.*$gdb_prompt $" {
pass "v_int+=unsigned_int"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
timeout { fail "(timeout) v_int+=v_unsigned_int" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_int" }
timeout { fail "(timeout) v_int+=v_unsigned_int" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_long\n"
gdb_expect {
-re ".*15.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*15.*$gdb_prompt $" {
pass "v_int+=long"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_long" }
timeout { fail "(timeout) v_int+=v_long" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_long" }
timeout { fail "(timeout) v_int+=v_long" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_signed_long\n"
gdb_expect {
-re ".*16.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*16.*$gdb_prompt $" {
pass "v_int+=signed_long"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
timeout { fail "(timeout) v_int+=v_signed_long" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
timeout { fail "(timeout) v_int+=v_signed_long" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_unsigned_long\n"
gdb_expect {
-re ".*17.*$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*17.*$gdb_prompt $" {
pass "v_int+=unsigned_long"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
timeout { fail "(timeout) v_int+=v_unsigned_long" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_unsigned_long" }
timeout { fail "(timeout) v_int+=v_unsigned_long" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_float\n"
gdb_expect {
-re ".*106\r\n$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*106\r\n$gdb_prompt $" {
pass "v_int+=v_float"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_float" }
timeout { fail "(timeout) v_int+=v_float" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_float" }
timeout { fail "(timeout) v_int+=v_float" }
}
gdb_test "set variable v_int = 6" "" "set v_int to 6"
send_gdb "print v_int+=v_double\n"
gdb_expect {
-re ".*206\r\n$gdb_prompt $" {
send_gdb "print v_int\n"
gdb_expect {
-re ".*206\r\n$gdb_prompt $" {
pass "v_int+=double"
}
-re ".*$gdb_prompt $" { fail "v_int+=v_double" }
timeout { fail "(timeout) v_int+=v_double" }
}
}
-re ".*$gdb_prompt $" { fail "v_int+=v_signed_long" }
timeout { fail "(timeout) v_int+=v_double" }
}

View File

@@ -0,0 +1,9 @@
static int barx __attribute__ ((section (".data01"))) = 'b' + 'a' + 'r';
int bar (int x)
{
if (x)
return barx;
else
return 0;
}

View File

@@ -0,0 +1,9 @@
static int bazx __attribute__ ((section (".data02"))) = 'b' + 'a' + 'z';
int baz (int x)
{
if (x)
return bazx;
else
return 0;
}

View File

@@ -0,0 +1,194 @@
/* Test program to test bit field operations */
/* For non-ANSI compilers, use plain ints for the signed bit fields. However,
whether they actually end up signed or not is implementation defined, so
this may cause some tests to fail. But at least we can still compile
the test program and run the tests... */
#ifndef __STDC__
#define signed /**/
#endif
struct fields
{
unsigned char uc ;
signed int s1 : 1;
unsigned int u1 : 1;
signed int s2 : 2;
unsigned int u2 : 2;
signed int s3 : 3;
unsigned int u3 : 3;
signed int s9 : 9;
unsigned int u9 : 9;
signed char sc ;
} flags;
void break1 ()
{
}
void break2 ()
{
}
void break3 ()
{
}
void break4 ()
{
}
void break5 ()
{
}
void break6 ()
{
}
void break7 ()
{
}
void break8 ()
{
}
void break9 ()
{
}
void break10 ()
{
}
/* This is used by bitfields.exp to determine if the target understands
signed bitfields. */
int i;
int main ()
{
/* For each member, set that member to 1, allow gdb to verify that the
member (and only that member) is 1, and then reset it back to 0. */
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
flags.uc = 1;
break1 ();
flags.uc = 0;
flags.s1 = 1;
break1 ();
flags.s1 = 0;
flags.u1 = 1;
break1 ();
flags.u1 = 0;
flags.s2 = 1;
break1 ();
flags.s2 = 0;
flags.u2 = 1;
break1 ();
flags.u2 = 0;
flags.s3 = 1;
break1 ();
flags.s3 = 0;
flags.u3 = 1;
break1 ();
flags.u3 = 0;
flags.s9 = 1;
break1 ();
flags.s9 = 0;
flags.u9 = 1;
break1 ();
flags.u9 = 0;
flags.sc = 1;
break1 ();
flags.sc = 0;
/* Fill alternating fields with all 1's and verify that none of the bits
"bleed over" to the other fields. */
flags.uc = 0xFF;
flags.u1 = 0x1;
flags.u2 = 0x3;
flags.u3 = 0x7;
flags.u9 = 0x1FF;
break2 ();
flags.uc = 0;
flags.u1 = 0;
flags.u2 = 0;
flags.u3 = 0;
flags.u9 = 0;
flags.s1 = 0x1;
flags.s2 = 0x3;
flags.s3 = 0x7;
flags.s9 = 0x1FF;
flags.sc = 0xFF;
break2 ();
flags.s1 = 0;
flags.s2 = 0;
flags.s3 = 0;
flags.s9 = 0;
flags.sc = 0;
/* Fill the unsigned fields with the maximum positive value and verify
that the values are printed correctly. */
/* Maximum positive values */
flags.u1 = 0x1;
flags.u2 = 0x3;
flags.u3 = 0x7;
flags.u9 = 0x1FF;
break3 ();
flags.u1 = 0;
flags.u2 = 0;
flags.u3 = 0;
flags.u9 = 0;
/* Fill the signed fields with the maximum positive value, then the maximally
negative value, then -1, and verify in each case that the values are
printed correctly. */
/* Maximum positive values */
flags.s1 = 0x0;
flags.s2 = 0x1;
flags.s3 = 0x3;
flags.s9 = 0xFF;
break4 ();
/* Maximally negative values */
flags.s1 = 0x1;
flags.s2 = 0x2;
flags.s3 = 0x4;
flags.s9 = 0x100;
/* Extract bitfield value so that bitfield.exp can check if the target
understands signed bitfields. */
i = flags.s9;
break4 ();
/* -1 */
flags.s1 = 0x1;
flags.s2 = 0x3;
flags.s3 = 0x7;
flags.s9 = 0x1FF;
break4 ();
flags.s1 = 0;
flags.s2 = 0;
flags.s3 = 0;
flags.s9 = 0;
return 0;
}

View File

@@ -0,0 +1,268 @@
# 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 Fred Fish. (fnf@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "bitfields"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
#
# Test bitfield locating and uniqueness.
# For each member, set that member to 1 and verify that the member (and only
# that member) is 1, then reset it back to 0.
#
proc bitfield_uniqueness {} {
global decimal
global hex
global gdb_prompt
global srcfile
if { ! [runto break1] } {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 1 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #1"] {
gdb_suppress_tests;
}
# Note that we check for s1 as either 1 or -1, so that failure to
# treat it correctly as a signed 1bit field (values 0 or -1) while
# printing its value does not cause a spurious failure. We do the
# signedness preservation test later.
if [gdb_test "print flags" ".*uc = 0 .*, s1 = (1|-1), u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s1)"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #2"] {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u1)"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #3"] {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s2)"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #4"] {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 1, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u2)"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #5"] {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 1, u3 = 0, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (s3)"] {
gdb_suppress_tests;
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #6"] {
gdb_suppress_tests;
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 1, s9 = 0, u9 = 0, sc = 0.*" "bitfield uniqueness (u3)"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #7"] {
gdb_suppress_tests
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 1, u9 = 0, sc = 0.*" "bitfield uniqueness (s9)"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #8"] {
gdb_suppress_tests
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 1, sc = 0.*" "bitfield uniqueness (u9)"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break1 \\(\\) at .*$srcfile:$decimal.*" "continuing to break1 #9"] {
gdb_suppress_tests
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 0, s2 = 0, u2 = 0, s3 = 0, u3 = 0, s9 = 0, u9 = 0, sc = 1.*" "bitfield uniqueness (sc)"] {
gdb_suppress_tests
}
# Hmmmm?
gdb_stop_suppressing_tests;
}
#
# Test bitfield containment.
# Fill alternating fields with all 1's and verify that none of the bits
# "bleed over" to the other fields.
#
proc bitfield_containment {} {
global decimal
global hex
global gdb_prompt
global srcfile
delete_breakpoints
if { ![runto break2] } {
gdb_suppress_tests
}
if [gdb_test "print/x flags" "= {uc = 0xff, s1 = 0x0, u1 = 0x1, s2 = 0x0, u2 = 0x3, s3 = 0x0, u3 = 0x7, s9 = 0x0, u9 = 0x1ff, sc = 0x0}" "bitfield containment #1"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break2 \\(\\) at .*$srcfile:$decimal.*" "continuing to break2"] {
gdb_suppress_tests
}
# If program is compiled with Sun CC, then these print out as their
# actual sizes; if compiled with gcc, they print out as 0xffffffff
# (which strikes me as bogus, but accept it at least for now).
if [gdb_test "print/x flags" "= {uc = 0x0, s1 = 0x(1|f*), u1 = 0x0, s2 = 0x(3|f*), u2 = 0x0, s3 = 0x(7|f*), u3 = 0x0, s9 = 0x(1ff|f*), u9 = 0x0, sc = 0xff}" "bitfield containment #2"] {
gdb_suppress_tests
}
gdb_stop_suppressing_tests;
}
# Test unsigned bitfields for unsignedness and range.
# Fill the unsigned fields with the maximum positive value and verify that
# the values are printed correctly.
proc bitfield_unsignedness {} {
global decimal
global hex
global gdb_prompt
global srcfile
delete_breakpoints
if { ![runto break3] } {
gdb_suppress_tests
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = 0, u1 = 1, s2 = 0, u2 = 3, s3 = 0, u3 = 7, s9 = 0, u9 = 511, sc = 0.*" "unsigned bitfield ranges"] {
gdb_suppress_tests
}
gdb_stop_suppressing_tests;
}
#
# Test signed bitfields for signedness and range.
# Fill the signed fields with the maximum positive value, then the maximally
# negative value, then -1, and verify in each case that the values are
# printed correctly.
#
proc bitfield_signedness {} {
global decimal
global hex
global gdb_prompt
global srcfile
delete_breakpoints
if { ! [runto break4] } {
gdb_suppress_tests
}
if [gdb_test "print flags" "= {uc = 0 .*, s1 = 0, u1 = 0, s2 = 1, u2 = 0, s3 = 3, u3 = 0, s9 = 255, u9 = 0, sc = 0 .*}" "signed bitfields, max positive values"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break4 \\(\\) at .*$srcfile:$decimal.*" "continuing to break4 #1"] {
gdb_suppress_tests
}
# Determine if the target has signed bitfields so we can xfail the
# the signed bitfield tests if it doesn't.
send_gdb "print i\n"
gdb_expect {
-re ".* = -256.*$gdb_prompt $" {
pass "determining signed-ness of bitfields"
}
-re ".* = 256.*$gdb_prompt $" {
pass "determining signed-ness of bitfields"
setup_xfail "*-*-*"
}
-re ".*$gdb_prompt $" {
fail "determining signed-ness of bitfields"
gdb_suppress_tests
}
default {
fail "determining signed-ness of bitfields" ;
gdb_suppress_tests;
}
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -2, u2 = 0, s3 = -4, u3 = 0, s9 = -256, u9 = 0, sc = 0.*" "signed bitfields, max negative values"] {
gdb_suppress_tests
}
if [gdb_test "cont" "Break.*break4 \\(\\) at .*$srcfile:$decimal.*" "continuing to break4 #2"] {
gdb_suppress_tests
}
if [gdb_test "print flags" ".*uc = 0 .*, s1 = -1, u1 = 0, s2 = -1, u2 = 0, s3 = -1, u3 = 0, s9 = -1, u9 = 0, sc = 0.*" "signed bitfields with -1"] {
gdb_suppress_tests
}
# Hmmmm???
gdb_stop_suppressing_tests;
}
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
bitfield_uniqueness
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
}
bitfield_containment
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
}
bitfield_unsignedness
if [istarget "mips-idt-*"] then {
# Restart because IDT/SIM runs out of file descriptors.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
}
bitfield_signedness

View File

@@ -0,0 +1,365 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# tests expressions with bitwise operators, and some
# logical operators
# Does not use a target program
#
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
send_gdb "print !1\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of !1"
}
-re ".*$gdb_prompt $" { fail "print value of !1" }
timeout { fail "(timeout) print value of !1" }
}
send_gdb "print !0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of !0"
}
-re ".*$gdb_prompt $" { fail "print value of !0" }
timeout { fail "(timeout) print value of !0" }
}
send_gdb "print !100\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of !100"
}
-re ".*$gdb_prompt $" { fail "print value of !100" }
timeout { fail "(timeout) print value of !100" }
}
send_gdb "print !1000\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of !1000"
}
-re ".*$gdb_prompt $" { fail "print value of !1000" }
timeout { fail "(timeout) print value of !1000" }
}
send_gdb "print !10\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of !10"
}
-re ".*$gdb_prompt $" { fail "print value of !10" }
timeout { fail "(timeout) print value of !10" }
}
send_gdb "print !2\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of !2 "
}
-re ".*$gdb_prompt $" { fail "print value of !2" }
timeout { fail "(timeout) print value of !2" }
}
send_gdb "print 10 | 5\n"
gdb_expect {
-re ".\[0-9\]* = 15.*$gdb_prompt $" {
pass "print value of 10 | 5"
}
-re ".*$gdb_prompt $" { fail "print value of 10 | 5" }
timeout { fail "(timeout) print value of 10 | 5" }
}
send_gdb "print 10 & 5\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 10 & 5"
}
-re ".*$gdb_prompt $" { fail "print value of 10 & 5" }
timeout { fail "(timeout) print value of 10 & 5" }
}
send_gdb "print 10 ^ 5\n"
gdb_expect {
-re ".\[0-9\]* = 15.*$gdb_prompt $" {
pass "print value of 10 ^ 5"
}
-re ".*$gdb_prompt $" { fail "print value of 10 ^ 5" }
timeout { fail "(timeout) print value of 10 ^ 5" }
}
send_gdb "print -!0\n"
gdb_expect {
-re ".\[0-9\]* = -1.*$gdb_prompt $" {
pass "print value of -!0"
}
-re ".*$gdb_prompt $" { fail "print value of -!0" }
timeout { fail "(timeout) print value of -!0" }
}
send_gdb "print ~-!0\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of ~-!0"
}
-re ".*$gdb_prompt $" { fail "print value of ~-!0" }
timeout { fail "(timeout) print value of ~-!0" }
}
send_gdb "print 3 * 2 / 4.0 * 2.0\n"
gdb_expect {
-re ".\[0-9\]* = 3.*$gdb_prompt $" {
pass "print value of 3 * 2 / 4.0 * 2.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3 * 2 / 4.0 * 2.0" }
timeout { fail "(timeout) print value of 3 * 2 / 4.0 * 2.0" }
}
send_gdb "print 8 << 2 >> 4\n"
gdb_expect {
-re ".\[0-9\]* = 2.*$gdb_prompt $" {
pass "print value of 8 << 2 >> 4"
}
-re ".*$gdb_prompt $" { fail "print value of 8 << 2 >> 4" }
timeout { fail "(timeout) print value of 8 << 2 >> 4" }
}
send_gdb "print -1 < 0 > 1\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of -1 < 0 > 1"
}
-re ".*$gdb_prompt $" { fail "print value of -1 < 0 > 1" }
timeout { fail "(timeout) print value of -1 < 0 > 1" }
}
send_gdb "print 15 ^ 10 ^ 5 ^ 7\n"
gdb_expect {
-re ".\[0-9\]* = 7.*$gdb_prompt $" {
pass "print value of 15 ^ 10 ^ 5 ^ 7"
}
-re ".*$gdb_prompt $" { fail "print value of 15 ^ 10 ^ 5 ^ 7" }
timeout { fail "(timeout) print value of 15 ^ 10 ^ 5 ^ 7" }
}
send_gdb "print 3.5 < 4.0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 3.5 < 4.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3.5 < 4.0" }
timeout { fail "(timeout) print value of 3.5 < 4.0" }
}
send_gdb "print 3.5 < -4.0\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 3.5 < -4.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3.5 < -4.0" }
timeout { fail "(timeout) print value of 3.5 < -4.0" }
}
send_gdb "print 2 > -3\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 2 > -3"
}
-re ".*$gdb_prompt $" { fail "print value of 2 > -3" }
timeout { fail "(timeout) print value of 2 > -3" }
}
send_gdb "print -3>4\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of -3>4"
}
-re ".*$gdb_prompt $" { fail "print value of -3>4" }
timeout { fail "(timeout) print value of -3>4" }
}
send_gdb "print (-3 > 4)\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of (-3 > 4)"
}
-re ".*$gdb_prompt $" { fail "print value of (-3 > 4)" }
timeout { fail "(timeout) print value of (-3 > 4)" }
}
send_gdb "print 3>=2.5\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 3>=2.5"
}
-re ".*$gdb_prompt $" { fail "print value of 3>=2.5" }
timeout { fail "(timeout) print value of 3>=2.5" }
}
send_gdb "print 3>=4.5\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 3>=4.5"
}
-re ".*$gdb_prompt $" { fail "print value of 3>=4.5" }
timeout { fail "(timeout) print value of 3>=4.5" }
}
send_gdb "print 3==3.0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 3==3.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3==3.0" }
timeout { fail "(timeout) print value of 3==3.0" }
}
send_gdb "print 3==4.0\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 3==4.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3==4.0" }
timeout { fail "(timeout) print value of 3==4.0" }
}
send_gdb "print 3!=3.0\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 3!=3.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3!=3.0" }
timeout { fail "(timeout) print value of 3!=3.0" }
}
send_gdb "print 3!=5.0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 3!=5.0"
}
-re ".*$gdb_prompt $" { fail "print value of 3!=5.0" }
timeout { fail "(timeout) print value of 3!=5.0" }
}
send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2"
}
-re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8 > 128 >>1 +2 *2" }
}
send_gdb "print 1.0 || 0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 1.0 || 0"
}
-re ".*$gdb_prompt $" { fail "print value of 1.0 || 0" }
timeout { fail "(timeout) print value of 1.0 || 0" }
}
send_gdb "print 0.0 || 1.0\n"
gdb_expect {
-re ".\[0-9\]* = 1.*$gdb_prompt $" {
pass "print value of 0.0 || 1.0"
}
-re ".*$gdb_prompt $" { fail "print value of 0.0 || 1.0" }
timeout { fail "(timeout) print value of 0.0 || 1.0" }
}
send_gdb "print 0.0 || 0\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 0.0 || 0"
}
-re ".*$gdb_prompt $" { fail "print value of 0.0 || 0" }
timeout { fail "(timeout) print value of 0.0 || 0" }
}
send_gdb "print 0 || 1 && 0 | 0 ^ 0 == 8\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 0 || 1 && 0 | 0 ^ 0 == 8"
}
-re ".*$gdb_prompt $" { fail "print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
timeout { fail "(timeout) print value of 0 || 1 && 0 | 0 ^ 0 == 8" }
}
send_gdb "print 0 == 8 > 128 >> 1 + 2 * 2\n"
gdb_expect {
-re ".\[0-9\]* = 0.*$gdb_prompt $" {
pass "print value of 0 == 8 > 128 >> 1 + 2 * 2"
}
-re ".*$gdb_prompt $" { fail "print value of 0 == 8 > 128 >> 1 + 2 * 2" }
timeout { fail "(timeout) print value of 0 == 8 > 128 >> 1 + 2 * 2" }
}

View File

@@ -0,0 +1,113 @@
/* Tests for single stepping through various branch conditions */
int noscramble(int a)
{
return a ;
}
int echo(int a)
{ return noscramble(a) ; }
int equaltest(int a,int b)
{ int retval ;
if (a == b)
retval = noscramble(1) ;
else retval = noscramble(0) ;
return retval ;
}
int neqtest(int a , int b)
{ int retval ;
if (a != b)
retval = echo(1) ;
else retval = echo(2) ;
return retval ;
}
int zerotest(int a )
{ int retval ;
a = echo(a) ;
if (a ==0)
retval = echo(1) ;
else
retval = echo(0) ;
retval = echo(retval) ;
return retval ;
}
int zerotest2(int a)
{
return (a==0) ;
}
int nonzerotest(int a)
{
int retval ;
if (a != 0)
retval = echo(0) ;
else retval = echo(1) ;
return retval ;
}
int whiletest(int a)
{
while (a > 0)
{
a-- ;
}
return 0 ;
}
int whiletest2(int a)
{
while (a > 0)
{
a = noscramble(a) ;
a-- ;
}
return a ;
}
int decr(int x) { return x - 1 ; }
int while3(int a)
{
int b = a ;
while (a == b)
{
a = echo(a) ;
b = decr(b) ;
}
return a ;
}
void done (int x) { }
int main()
{
int a,b,c,d ;
done(1) ;
a = echo(123456) ;
b = echo(123456) ;
c = echo(56789) ;
d = echo(0) ;
#if 1
equaltest(a,b) ;
done(7) ;
equaltest(a,c) ;
done(8) ;
whiletest(3) ; /* worked */
done(3) ;
while3(3) ;
done(6) ;
#endif
neqtest(a,b) ;
neqtest(a,b) ;
neqtest(a,c) ;
zerotest(d) ;
zerotest(a) ;
done(5) ;
nonzerotest(d) ;
done(4) ;
nonzerotest(a) ;
done(111) ;
return 1 ;
}

View File

@@ -0,0 +1,81 @@
#ifdef vxworks
# include <stdio.h>
/* VxWorks does not supply atoi. */
static int
atoi (z)
char *z;
{
int i = 0;
while (*z >= '0' && *z <= '9')
i = i * 10 + (*z++ - '0');
return i;
}
/* I don't know of any way to pass an array to VxWorks. This function
can be called directly from gdb. */
vxmain (arg)
char *arg;
{
char *argv[2];
argv[0] = "";
argv[1] = arg;
main (2, argv, (char **) 0);
}
#else /* ! vxworks */
# include <stdio.h>
#endif /* ! vxworks */
/*
* The following functions do nothing useful. They are included simply
* as places to try setting breakpoints at. They are explicitly
* "one-line functions" to verify that this case works (some versions
* of gcc have or have had problems with this).
*/
int marker1 () { return (0); }
int marker2 (a) int a; { return (1); }
void marker3 (a, b) char *a, *b; {}
void marker4 (d) long d; {}
/*
* This simple classical example of recursion is useful for
* testing stack backtraces and such.
*/
int
main (argc, argv, envp)
int argc;
char *argv[], **envp;
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
if (argc == 123456) {
fprintf (stderr, "usage: factorial <number>\n");
return 1;
}
printf ("%d\n", factorial (atoi ("6")));
marker1 ();
marker2 (43);
marker3 ("stack", "trace");
marker4 (177601976L);
return 0;
}
int factorial (value)
int value;
{
if (value > 1) {
value *= factorial (value - 1);
}
return (value);
}

View File

@@ -0,0 +1,769 @@
# Copyright (C) 1988, 1990, 1991, 1992, 1994, 1997, 1998
# 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 Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "break"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if [target_info exists gdb_stub] {
gdb_step_for_stub;
}
#
# test simple breakpoint setting commands
#
# Test deleting all breakpoints when there are none installed,
# GDB should not prompt for confirmation.
# Note that gdb-init.exp provides a "delete_breakpoints" proc
# for general use elsewhere.
send_gdb "delete breakpoints\n"
gdb_expect {
-re "Delete all breakpoints.*$" {
send_gdb "y\n"
gdb_expect {
-re "$gdb_prompt $" {
fail "Delete all breakpoints when none (unexpected prompt)"
}
timeout { fail "Delete all breakpoints when none (timeout after unexpected prompt)" }
}
}
-re ".*$gdb_prompt $" { pass "Delete all breakpoints when none" }
timeout { fail "Delete all breakpoints when none (timeout)" }
}
#
# test break at function
#
gdb_test "break main" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"breakpoint function"
#
# test break at function in file
#
gdb_test "break $srcfile:factorial" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"breakpoint function in file"
#
# test break at line number
#
gdb_test "break 64" \
"Breakpoint.*at.* file .*$srcfile, line 64\\." \
"breakpoint line number"
#
# test duplicate breakpoint
#
gdb_test "break 64" \
"Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 64\\." \
"breakpoint duplicate"
#
# test break at line number in file
#
gdb_test "break $srcfile:70" \
"Breakpoint.*at.* file .*$srcfile, line 70\\." \
"breakpoint line number in file"
#
# check to see what breakpoints are set
#
if [target_info exists gdb_stub] {
set main_line 57
} else {
set main_line 60
}
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:76.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:70" \
"breakpoint info"
# FIXME: The rest of this test doesn't work with anything that can't
# handle arguments.
# Huh? There doesn't *appear* to be anything that passes arguments
# below.
if [istarget "mips-idt-*"] then {
return
}
#
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
if ![target_info exists use_gdb_stub] {
if [istarget "*-*-vxworks*"] then {
send_gdb "run vxmain \"2\"\n"
set timeout 120
verbose "Timeout is now $timeout seconds" 2
} else {
send_gdb "run\n"
}
gdb_expect {
-re "The program .* has been started already.*y or n. $" {
send_gdb "y\n"
exp_continue
}
-re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$gdb_prompt $"\
{ pass "run until function breakpoint" }
-re ".*$gdb_prompt $" { fail "run until function breakpoint" }
timeout { fail "run until function breakpoint (timeout)" }
}
} else {
if ![target_info exists gdb_stub] {
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:60.*60\[\t \]+if .argc.*\{" "stub continue"
}
}
#
# run until the breakpoint at a line number
#
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \
"run until breakpoint set at a line number"
#
# Run until the breakpoint set in a function in a file
#
for {set i 6} {$i >= 1} {incr i -1} {
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:76.*76\[\t \]+if .value > 1. \{" \
"run until file:function($i) breakpoint"
}
#
# run until the file:function breakpoint at a line number in a file
#
gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:70.*70\[\t \]+return 0;" \
"run until file:linenum breakpoint"
#
# delete all breakpoints so we can start over, course this can be a test too
#
delete_breakpoints
#
# test temporary breakpoint at function
#
gdb_test "tbreak main" "Breakpoint.*at.* file .*$srcfile, line.*" "Temporary breakpoint function"
#
# test break at function in file
#
gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" \
"Temporary breakpoint function in file"
#
# test break at line number
#
send_gdb "tbreak 64\n"
gdb_expect {
-re "Breakpoint.*at.* file .*$srcfile, line 64.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
-re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" }
timeout { fail "breakpoint line number #1 (timeout)" }
}
gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number #2"
#
# test break at line number in file
#
send_gdb "tbreak $srcfile:70\n"
gdb_expect {
-re "Breakpoint.*at.* file .*$srcfile, line 70.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
-re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" }
timeout { fail "Temporary breakpoint line number in file #1 (timeout)" }
}
gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file #2"
#
# check to see what breakpoints are set (temporary this time)
#
gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*" "Temporary breakpoint info"
#***********
# Verify that catchpoints for fork, vfork and exec don't trigger
# inappropriately. (There are no calls to those system functions
# in this test program.)
#
if ![runto_main] then { fail "break tests suppressed" }
send_gdb "catch\n"
gdb_expect {
-re "Catch requires an event name.*$gdb_prompt $"\
{pass "catch requires an event name"}
-re "$gdb_prompt $"\
{fail "catch requires an event name"}
timeout {fail "(timeout) catch requires an event name"}
}
set name "set catch fork, never expected to trigger"
send_gdb "catch fork\n"
gdb_expect {
-re "Catchpoint \[0-9\]* .fork..*$gdb_prompt $"
{pass $name}
-re "Catch of fork not yet implemented.*$gdb_prompt $"
{pass $name}
-re "$gdb_prompt $"
{fail $name}
timeout {fail "(timeout) $name"}
}
set name "set catch vfork, never expected to trigger"
send_gdb "catch vfork\n"
# If we are on HP-UX 10.20, we expect an error message to be
# printed if we type "catch vfork" at the gdb gdb_prompt. This is
# because on HP-UX 10.20, we cannot catch vfork events.
if [istarget "hppa*-hp-hpux10.20"] then {
gdb_expect {
-re "Catch of vfork events not supported on HP-UX 10.20..*$gdb_prompt $"
{pass $name}
-re "$gdb_prompt $"
{fail $name}
timeout {fail "(timeout) $name"}
}
} else {
gdb_expect {
-re "Catchpoint \[0-9\]* .vfork..*$gdb_prompt $"
{pass $name}
-re "Catch of vfork not yet implemented.*$gdb_prompt $"
{pass $name}
-re "$gdb_prompt $"
{fail $name}
timeout {fail "(timeout) $name"}
}
}
set name "set catch exec, never expected to trigger"
send_gdb "catch exec\n"
gdb_expect {
-re "Catchpoint \[0-9\]* .exec..*$gdb_prompt $"
{pass $name}
-re "Catch of exec not yet implemented.*$gdb_prompt $"
{pass $name}
-re "$gdb_prompt $" {fail $name}
timeout {fail "(timeout) $name"}
}
# Verify that "until <location>" works. (This is really just syntactic
# sugar for "tbreak <location>; continue".)
#
send_gdb "until 64\n"
gdb_expect {
-re "main .* at .*:64.*$gdb_prompt $"\
{pass "until 64"}
-re "$gdb_prompt $"\
{fail "until 64"}
timeout {fail "(timeout) until 64"}
}
# Verify that a malformed "until" is gracefully caught.
#
send_gdb "until 65 then stop\n"
gdb_expect {
-re "Junk at end of arguments..*$gdb_prompt $"\
{pass "malformed until"}
-re "$gdb_prompt $"\
{fail "malformed until"}
timeout {fail "(timeout) malformed until"}
}
# Verify that GDB responds gracefully when asked to set a breakpoint
# on a nonexistent source line.
#
send_gdb "break 999\n"
gdb_expect {
-re "No line 999 in file .*$gdb_prompt $"\
{pass "break on non-existent source line"}
-re "$gdb_prompt $"\
{fail "break on non-existent source line"}
timeout {fail "(timeout) break on non-existent source line"}
}
# Verify that GDB allows one to just say "break", which is treated
# as the "default" breakpoint. Note that GDB gets cute when printing
# the informational message about other breakpoints at the same
# location. We'll hit that bird with this stone too.
#
send_gdb "break\n"
gdb_expect {
-re "Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 1st time"}
-re "$gdb_prompt $"\
{fail "break on default location, 1st time"}
timeout {fail "(timeout) break on default location, 1st time"}
}
send_gdb "break\n"
gdb_expect {
-re "Note: breakpoint \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 2nd time"}
-re "$gdb_prompt $"\
{fail "break on default location, 2nd time"}
timeout {fail "(timeout) break on default location, 2nd time"}
}
send_gdb "break\n"
gdb_expect {
-re "Note: breakpoints \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 3rd time"}
-re "$gdb_prompt $"\
{fail "break on default location, 3rd time"}
timeout {fail "(timeout) break on default location, 3rd time"}
}
send_gdb "break\n"
gdb_expect {
-re "Note: breakpoints \[0-9\]*, \[0-9\]* and \[0-9\]* also set at .*Breakpoint \[0-9\]*.*$gdb_prompt $"\
{pass "break on default location, 4th time"}
-re "$gdb_prompt $"\
{fail "break on default location, 4th time"}
timeout {fail "(timeout) break on default location, 4th time"}
}
# Verify that a "silent" breakpoint can be set, and that GDB is indeed
# "silent" about its triggering.
#
if ![runto_main] then { fail "break tests suppressed" }
send_gdb "break 64\n"
gdb_expect {
-re "Breakpoint (\[0-9\]*) at .*, line 64.*$gdb_prompt $"\
{pass "set to-be-silent break 64"}
-re "$gdb_prompt $"\
{fail "set to-be-silent break 64"}
timeout {fail "(timeout) set to-be-silent break 64"}
}
send_gdb "commands $expect_out(1,string)\n"
send_gdb "silent\n"
send_gdb "end\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "set silent break 64"}
timeout {fail "(timeout) set silent break 64"}
}
send_gdb "info break $expect_out(1,string)\n"
gdb_expect {
-re "\[0-9\]*\[ \t\]*breakpoint.*:64\r\n\[ \t\]*silent.*$gdb_prompt $"\
{pass "info silent break 64"}
-re "$gdb_prompt $"\
{fail "info silent break 64"}
timeout {fail "(timeout) info silent break 64"}
}
send_gdb "continue\n"
gdb_expect {
-re "Continuing.\r\n$gdb_prompt $"\
{pass "hit silent break 64"}
-re "$gdb_prompt $"\
{fail "hit silent break 64"}
timeout {fail "(timeout) hit silent break 64"}
}
send_gdb "bt\n"
gdb_expect {
-re "#0 main .* at .*:64.*$gdb_prompt $"\
{pass "stopped for silent break 64"}
-re "$gdb_prompt $"\
{fail "stopped for silent break 64"}
timeout {fail "(timeout) stopped for silent break 64"}
}
# Verify that GDB can at least parse a breakpoint with the
# "thread" keyword. (We won't attempt to test here that a
# thread-specific breakpoint really triggers appropriately.
# The gdb.threads subdirectory contains tests for that.)
#
send_gdb "break 65 thread 999\n"
gdb_expect {
-re "Unknown thread 999.*$gdb_prompt $"\
{pass "thread-specific breakpoint on non-existent thread disallowed"}
-re "$gdb_prompt $"\
{fail "thread-specific breakpoint on non-existent thread disallowed"}
timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"}
}
send_gdb "break 65 thread foo\n"
gdb_expect {
-re "Junk after thread keyword..*$gdb_prompt $"\
{pass "thread-specific breakpoint on bogus thread ID disallowed"}
-re "$gdb_prompt $"\
{fail "thread-specific breakpoint on bogus thread ID disallowed"}
timeout {fail "(timeout) thread-specific breakpoint on bogus thread ID disallowed"}
}
# Verify that GDB responds gracefully to a breakpoint command with
# trailing garbage.
#
send_gdb "break 65 foo\n"
gdb_expect {
-re "Junk at end of arguments..*$gdb_prompt $"\
{pass "breakpoint with trailing garbage disallowed"}
-re "$gdb_prompt $"\
{fail "breakpoint with trailing garbage disallowed"}
timeout {fail "(timeout) breakpoint with trailing garbage disallowed"}
}
# Verify that GDB responds gracefully to a "clear" command that has
# no matching breakpoint. (First, get us off the current source line,
# which we know has a breakpoint.)
#
send_gdb "next\n"
gdb_expect {
-re ".*$gdb_prompt $"\
{pass "step over breakpoint"}
timeout {fail "(timeout) step over breakpoint"}
}
send_gdb "clear 66\n"
gdb_expect {
-re "No breakpoint at 66..*$gdb_prompt $"\
{pass "clear line has no breakpoint disallowed"}
-re "$gdb_prompt $"\
{fail "clear line has no breakpoint disallowed"}
timeout {fail "(timeout) clear line has no breakpoint disallowed"}
}
send_gdb "clear\n"
gdb_expect {
-re "No breakpoint at this line..*$gdb_prompt $"\
{pass "clear current line has no breakpoint disallowed"}
-re "$gdb_prompt $"\
{fail "clear current line has no breakpoint disallowed"}
timeout {fail "(timeout) clear current line has no breakpoint disallowed"}
}
# Verify that a breakpoint can be set via a convenience variable.
#
send_gdb "set \$foo=66\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "set convenience variable \$foo to 66"}
timeout {fail "(timeout) set convenience variable \$foo to 66"}
}
send_gdb "break \$foo\n"
gdb_expect {
-re "Breakpoint (\[0-9\]*) at .*, line 66.*$gdb_prompt $"\
{pass "set breakpoint via convenience variable"}
-re "$gdb_prompt $"\
{fail "set breakpoint via convenience variable"}
timeout {fail "(timeout) set breakpoint via convenience variable"}
}
# Verify that GDB responds gracefully to an attempt to set a
# breakpoint via a convenience variable whose type is not integer.
#
send_gdb "set \$foo=66.5\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "set convenience variable \$foo to 66.5"}
timeout {fail "(timeout) set convenience variable \$foo to 66.5"}
}
send_gdb "break \$foo\n"
gdb_expect {
-re "Convenience variables used in line specs must have integer values..*$gdb_prompt $"\
{pass "set breakpoint via non-integer convenience variable disallowed"}
-re "$gdb_prompt $"\
{fail "set breakpoint via non-integer convenience variable disallowed"}
timeout {fail "(timeout) set breakpoint via non-integer convenience variable disallowed"}
}
# Verify that we can set and trigger a breakpoint in a user-called function.
#
send_gdb "break marker2\n"
gdb_expect {
-re "Breakpoint (\[0-9\]*) at .*, line 42.*$gdb_prompt $"\
{pass "set breakpoint on to-be-called function"}
-re "$gdb_prompt $"\
{fail "set breakpoint on to-be-called function"}
timeout {fail "(timeout) set breakpoint on to-be-called function"}
}
send_gdb "print marker2(99)\n"
gdb_expect {
-re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\
{pass "hit breakpoint on called function"}
-re "$gdb_prompt $"\
{fail "hit breakpoint on called function"}
timeout {fail "(timeout) hit breakpoint on called function"}
}
# As long as we're stopped (breakpointed) in a called function,
# verify that we can successfully backtrace & such from here.
#
if [istarget "hppa*-*-hpux*"] then {
send_gdb "bt\n"
gdb_expect {
-re "#0\[ \t\]*marker2.*:42\r\n#1.*_sr4export.*$gdb_prompt $"\
{pass "backtrace while in called function"}
-re "$gdb_prompt $"\
{fail "backtrace while in called function"}
timeout {fail "(timeout) backtrace while in called function"}
}
send_gdb "finish\n"
gdb_expect {
-re "Run till exit from .*marker2.* at .*42\r\n.* in _sr4export.*$gdb_prompt $"\
{pass "finish from called function"}
-re "$gdb_prompt $"\
{fail "finish from called function"}
timeout {fail "(timeout) finish from called function"}
}
}
# Verify that GDB responds gracefully to a "finish" command with
# arguments.
#
if ![runto_main] then { fail "break tests suppressed" }
send_gdb "finish 123\n"
gdb_expect {
-re "The \"finish\" command does not take any arguments.\r\n$gdb_prompt $"\
{pass "finish with arguments disallowed"}
-re "$gdb_prompt $"\
{fail "finish with arguments disallowed"}
timeout {fail "(timeout) finish with arguments disallowed"}
}
# Verify that GDB responds gracefully to a request to "finish" from
# the outermost frame.
#
send_gdb "finish\n"
gdb_expect {
-re "\"finish\" not meaningful in the outermost frame.\r\n$gdb_prompt $"\
{pass "finish from outermost frame disallowed"}
-re "$gdb_prompt $"\
{fail "finish from outermost frame disallowed"}
timeout {fail "(timeout) finish from outermost frame disallowed"}
}
# Verify that we can explicitly ask GDB to stop on all shared library
# events, and that it does so.
#
if [istarget "hppa*-*-hpux*"] then {
if ![runto_main] then { fail "break tests suppressed" }
send_gdb "set stop-on-solib-events 1\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "set stop-on-solib-events"}
timeout {fail "(timeout) set stop-on-solib-events"}
}
send_gdb "run\n"
gdb_expect {
-re ".*Start it from the beginning.*y or n. $"\
{send_gdb "y\n"
gdb_expect {
-re ".*Stopped due to shared library event.*$gdb_prompt $"\
{pass "triggered stop-on-solib-events"}
-re "$gdb_prompt $"\
{fail "triggered stop-on-solib-events"}
timeout {fail "(timeout) triggered stop-on-solib-events"}
}
}
-re "$gdb_prompt $"\
{fail "rerun for stop-on-solib-events"}
timeout {fail "(timeout) rerun for stop-on-solib-events"}
}
send_gdb "set stop-on-solib-events 0\n"
gdb_expect {
-re "$gdb_prompt $"\
{pass "reset stop-on-solib-events"}
timeout {fail "(timeout) reset stop-on-solib-events"}
}
}
# Hardware breakpoints are unsupported on HP-UX. Verify that GDB
# gracefully responds to requests to create them.
#
if [istarget "hppa*-*-hpux*"] then {
if ![runto_main] then { fail "break tests suppressed" }
send_gdb "hbreak\n"
gdb_expect {
-re "No hardware breakpoint support in the target.*$gdb_prompt $"\
{pass "hw breaks disallowed"}
-re "$gdb_prompt $"\
{fail "hw breaks disallowed"}
timeout {fail "(timeout) hw breaks disallowed"}
}
send_gdb "thbreak\n"
gdb_expect {
-re "No hardware breakpoint support in the target.*$gdb_prompt $"\
{pass "temporary hw breaks disallowed"}
-re "$gdb_prompt $"\
{fail "temporary hw breaks disallowed"}
timeout {fail "(timeout) temporary hw breaks disallowed"}
}
}
#********
proc test_clear_command {} {
gdb_test "break main" "Breakpoint.*at.*" "break main #1"
gdb_test "break main" "Breakpoint.*at.*" "break main #2"
# We don't test that it deletes the correct breakpoints. We do at
# least test that it deletes more than one breakpoint.
gdb_test "clear main" {Deleted breakpoints [0-9]+ [0-9]+.*}
}
#
# Test "next" over recursive function call.
#
proc test_next_with_recursion {} {
global gdb_prompt
global decimal
global binfile
if [target_info exists use_gdb_stub] {
# Reload the program.
delete_breakpoints
gdb_load ${binfile};
} else {
# FIXME: should be using runto
gdb_test "kill" "" "kill program" "Kill the program being debugged.*y or n. $" "y"
delete_breakpoints
}
gdb_test "break factorial" "Breakpoint $decimal at .*" "break at factorial"
# Run until we call factorial with 6
if [istarget "*-*-vxworks*"] then {
send_gdb "run vxmain \"6\"\n"
} else {
gdb_run_cmd
}
gdb_expect {
-re "Break.* factorial .value=6. .*$gdb_prompt $" {}
-re ".*$gdb_prompt $" {
fail "run to factorial(6)";
gdb_suppress_tests;
}
timeout { fail "run to factorial(6) (timeout)" ; gdb_suppress_tests }
}
# Continue until we call factorial recursively with 5.
if [gdb_test "continue" \
"Continuing.*Break.* factorial .value=5. .*" \
"continue to factorial(5)"] then { gdb_suppress_tests }
# Do a backtrace just to confirm how many levels deep we are.
if [gdb_test "backtrace" \
"#0\[ \t\]+ factorial .value=5..*" \
"backtrace from factorial(5)"] then { gdb_suppress_tests }
# Now a "next" should position us at the recursive call, which
# we will be performing with 4.
if [gdb_test "next" \
".* factorial .value - 1.;.*" \
"next to recursive call"] then { gdb_suppress_tests }
# Disable the breakpoint at the entry to factorial by deleting them all.
# The "next" should run until we return to the next line from this
# recursive call to factorial with 4.
# Buggy versions of gdb will stop instead at the innermost frame on
# the line where we are trying to "next" to.
delete_breakpoints
if [istarget "mips*tx39-*"] {
set timeout 60
} else {
set timeout 20
}
gdb_test next "\[0-9\]*\[\t \]+return \\(value\\);.*" \
"next over recursive call"
# OK, we should be back in the same stack frame we started from.
# Do a backtrace just to confirm.
set result [gdb_test "backtrace" \
"#0\[ \t\]+ factorial .value=120.*\r\n#1\[ \t\]+ \[0-9a-fx\]+ in factorial .value=6..*" \
"backtrace from factorial(5.1)"]
if { $result != 0 } { gdb_suppress_tests }
if [target_info exists gdb,noresults] { gdb_suppress_tests }
if [target_info exists use_gdb_stub] {
gdb_breakpoint "exit"
gdb_test "continue" "Continuing..*Breakpoint .*exit \[(\].*=0\[)\].*" "continue until exit in recursive next test"
} else {
# Continue until we exit. Should not stop again.
# Don't bother to check the output of the program, that may be
# extremely tough for some remote systems.
gdb_test "continue"\
"Continuing.\[\r\n0-9\]+Program exited normally\\..*"\
"continue until exit in recursive next test"
}
gdb_stop_suppressing_tests;
}
test_clear_command
test_next_with_recursion
# Reset the default arguments for VxWorks
if [istarget "*-*-vxworks*"] {
set timeout 10
verbose "Timeout is now $timeout seconds" 2
send_gdb "set args main\n"
gdb_expect -re ".*$gdb_prompt $" {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,451 @@
# Copyright (C) 1998
# 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 Elena Zannoni (ezannoni@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "call-ar-st"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global gdb_prompt
send_gdb "set language c\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language c (timeout)" ; return 0; }
}
send_gdb "show language\n"
gdb_expect {
-re ".* source language is \"c\".*$gdb_prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$gdb_prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
source ${binfile}.ci
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
#go -until 1007
gdb_test "tbreak 1007" \
"Breakpoint \[0-9\]+.*file.*$srcfile, line 1007.*" \
"tbreakpoint line 1007"
gdb_test continue \
"Continuing\\..*main \\(\\) at.*$srcfile:1007.*" \
"run until breakpoint set at a line"
#call print_double_array(double_array)
send_gdb "print print_double_array(double_array)\n"
gdb_expect {
-re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
pass "print print_double_array(double_array)"
}
-re ".*$gdb_prompt $" { fail "print print_double_array(double_array)" }
timeout { fail "(timeout) print print_double_array(double_array)" }
}
#call print_char_array(char_array)
send_gdb "print print_char_array(char_array)\n"
gdb_expect {
-re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+.*\[ \t\r\n\]+.*$gdb_prompt $" {
pass "print print_char_array(char_array)"
}
-re ".*$gdb_prompt $" { fail "print print_char_array(char_array)" }
timeout { fail "(timeout) print print_char_array(char_array)" }
}
#go -until 1014
gdb_test "tbreak 1014" \
"Breakpoint.*file.*$srcfile, line 1014.*" \
"tbreakpoint line 1014"
send_gdb "continue\n"
gdb_expect {
-re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1014\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" {
pass "continue to 1014"
}
-re ".*$gdb_prompt $" { fail "continue to 1014" }
timeout { fail "(timeout) continue to 1014" }
}
# I am disabling this test, because it takes too long. I verified by
# hand that it works, feel free to check for yourself.
#call print_all_arrays(integer_array, char_array, float_array, double_array)
#send_gdb "print print_all_arrays(integer_array, char_array, float_array, double_array)\n"
#gdb_expect {
# -re ".*array_i :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0\[ \t\r\n\]+-1 -2 -3 -4 -5 -6 -7 -8\[ \t\r\n\]+-9 -10 -11 -12 -13 -14 -15 -16\[ \t\r\n\]+-17 -18 -19 -20 -21 -22 -23 -24\[ \t\r\n\]+-25 -26 -27 -28 -29 -30 -31 -32\[ \t\r\n\]+-33 -34 -35 -36 -37 -38 -39 -40\[ \t\r\n\]+-41 -42 -43 -44 -45 -46 -47 -48\[ \t\r\n\]+-49\[ \t\r\n\]+\[ \t\r\n\]+array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+array_f :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+0.142450 0.284900 0.427350 0.569801 0.712251 0.854701 0.997151 1.139601\[ \t\r\n\]+1.282051 1.424501 1.566952 1.709402 1.851852 1.994302\[ \t\r\n\]+\[ \t\r\n\]+array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.41750 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*$gdb_prompt $" {
# pass "print print_all_arrays(integer_array, char_array, float_array, double_array)"
# }
# -re ".*$gdb_prompt $" { fail "print print_all_arrays(integer_array, char_array, float_array, double_array)" }
# timeout { fail "(timeout) print print_all_arrays(integer_array, char_array, float_array, double_array)" }
# }
#set timeout $oldtimeout
#go -until 1018
gdb_test "tbreak 1018" \
"Breakpoint.* file .*$srcfile, line 1018.*" \
"tbreakpoint line 1018"
gdb_test continue \
"Continuing\\..*array_d :.*array_f :.*student id :\[\t \]+.*YELLOW.*array_i :.*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." \
"continuing to breakpoint 1018"
#step
send_gdb "step\n"
gdb_expect {
-re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:287\[ \t\r\n\]+287.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"}
-re ".*$gdb_prompt $" { fail "step inside print_all_arrays" }
timeout { fail "step inside print_all_arrays (timeout)" }
}
#step -over
send_gdb "next\n"
gdb_expect {
-re "array_i :.*288.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"}
-re ".*$gdb_prompt $" { fail "next over print_int_array in print-all_arrays" }
timeout { fail "next over print_int_array in print-all_arrays (timeout)" }
}
#call print_double_array(array_d)
send_gdb "print print_double_array(array_d)\n"
gdb_expect {
-re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" {
pass "print print_double_array(array_d)"
}
-re ".*$gdb_prompt $" { fail "print print_double_array(array_d)" }
timeout { fail "(timeout) print print_double_array(array_d)" }
}
#go -until 1034
gdb_test "tbreak 1034" \
"Breakpoint.* file .*$srcfile, line 1034.*" \
"tbreakpoint line 1034"
gdb_test continue "Continuing\\..*array_c.*array_f.*array_d.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)." "continuing to 1034"
#call sum_array_print(10, *list1, *list2, *list3, *list4)
send_gdb "print sum_array_print(10, *list1, *list2, *list3, *list4)\n"
gdb_expect {
-re ".*Sum of 4 arrays, by element \\(add in seed as well\\):\[ \t\r\n\]+Seed: 10\[ \t\r\n\]+Element Index . Sum\[ \t\r\n\]+-------------------------\[ \t\r\n\]+.*\[ \t\]+0\[ \t\]+52\[ \t\r\n\]+1\[ \t\]+60\[ \t\r\n\]+2\[ \t\]+68\[ \t\r\n\]+3\[ \t\]+76\[ \t\r\n\]+4\[ \t\]+84\[ \t\r\n\]+5\[ \t\]+92\[ \t\r\n\]+6\[ \t\]+100\[ \t\r\n\]+7\[ \t\]+108\[ \t\r\n\]+8\[ \t\]+116\[ \t\r\n\]+9\[ \t\]+124\[ \t\r\n\]+.*$gdb_prompt $" {
pass "print sum_array_print(10, *list1, *list2, *list3, *list4)"
}
-re ".*$gdb_prompt $" { fail "print sum_array_print(10, *list1, *list2, *list3, *list4)" }
timeout { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
}
#step -over
send_gdb "next\n"
gdb_expect {
-re "BYE BYE FOR NOW\[ \t\r\n\]+1035\[ \t\r\n\]+printf\\(.VERY GREEN GRASS.n.\\);\[ \t\r\n\]+.*$gdb_prompt $" { pass "next to 1035"}
-re ".*$gdb_prompt $" { fail "next to 1035" }
timeout { fail "next to 1035(timeout)" }
}
#call print_array_rep(\*list1, \*list2, \*list3)
send_gdb "print print_array_rep(\*list1, \*list2, \*list3)\n"
gdb_expect {
-re ".*.*$gdb_prompt $" {
pass "print print_array_rep(*list1, *list2, *list3)"
}
-re ".*$gdb_prompt $" { fail "print print_array_rep(*list1, *list2, *list3)" }
timeout { fail "(timeout) print print_array_rep(*list1, *list2, *list3)"# }
}
#go -until 1039
gdb_test "tbreak 1039" \
"Breakpoint..* file .*$srcfile, line 1039.*" \
"tbreakpoint line 1039"
send_gdb "continue\n"
gdb_expect {
-re ".*main \\(\\) at .*call-ar-st.c:1039\r\n1039\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" {
pass "continue to 1039"}
-re ".*$gdb_prompt $" { fail "continue to 1039"}
timeout { fail "(timeout) continue to 1039"}
}
# Run into sum_array_print, and verify that the arguments were passed
# accurately.
#
# Note that we shouldn't use a `step' here to get into
# sum_array_print; GCC may emit calls to memcpy to put the arguments
# in the right place, and a step may end up in memcpy instead. This
# may itself be a bug, but it's not the one we're trying to catch
# here. I've added something to step-test.exp for this.
gdb_test "break sum_array_print" \
".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \
"set breakpoint in sum_array_print"
gdb_test "continue" \
".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:909\[ \t\n\r\]+909.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \
"check args of sum_array_print"
#call print_array_rep(linked_list1, linked_list2, linked_list3)
# this calls works from gdb without gdb_expect. But it does seem to hang
#from within gdb_expect.
#I comment this out
#send_gdb "print print_array_rep(linked_list1, linked_list2, linked_list3)\n"
#gdb_expect {
# -re ".*Contents of linked list1:\[ \t\n\r\]+Element Value . Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*4.*1\[ \t\n\r\]+.*6.*2\[ \t\n\r\]+.*8.*3\[ \t\n\r\]+.*10.*4\[ \t\n\r\]+.*12.*5\[ \t\n\r\]+.*14.*6\[ \t\n\r\]+.*16.*7\[ \t\n\r\]+.*18.*8\[ \t\n\r\]+.*20.*9\[ \t\n\r\]+.*22.*10\[ \t\n\r\]+Contents of linked list2:\[ \t\n\r\]+Element Value | Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*8.*1\[ \t\n\r\]+.*10.*2\[ \t\n\r\]+.*12.*3\[ \t\n\r\]+.*14.*4\[ \t\n\r\]+.*16.*5\[ \t\n\r\]+.*18.*6\[ \t\n\r\]+.*20.*7\[ \t\n\r\]+.*22.*8\[ \t\n\r\]+.*24.*9\[ \t\n\r\]+.*26.*10\[ \t\n\r\]+Contents of linked list3:\[ \t\n\r\]+Element Value | Index of Next Element\[ \t\n\r\]+-------------------------------------\[ \t\n\r\]+.*\[ \t\n\r\]+.*10.*1\[ \t\n\r\]+.*12.*2\[ \t\n\r\]+.*14.*3\[ \t\n\r\]+.*16.*4\[ \t\n\r\]+.*18.*5\[ \t\n\r\]+.*20.*6\[ \t\n\r\]+.*22.*7\[ \t\n\r\]+.*24.*8\[ \t\n\r\]+.*26.*9\[ \t\n\r\]+.*28.*10\[ \t\n\r\]+.*$gdb_prompt $" {
# pass "print print_array_rep(linked_list1, linked_list2, linked_list3)"
# }
# -re ".*$gdb_prompt $" { fail "print print_array_rep(linked_list1, linked_list2, linked_list3)" }
# timeout { fail "(timeout) print print_array_rep(linked_list1, linked_list2, linked_list3)" }
#}
#go -until 1079
gdb_test "tbreak 1079" \
"Breakpoint.* file .*call-ar-st.c, line 1079.*" \
"tbreakpoint line 1079"
send_gdb "continue\n"
gdb_expect {
-re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1079.*c = 0.*$gdb_prompt $" {
pass "continue to 1079"}
-re ".*$gdb_prompt $" { fail "continue to 1079"}
timeout { fail "(timeout) continue to 1079"}
}
#call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo,
#*three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
send_gdb "print print_small_structs(*struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
gdb_expect {
-re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y\tch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a\tb\tc\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l\tm\tn\to\tp\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:.*-3.340000\[\t\r\n \]+Contents of one_double_t:.*675.091230\[\t\r\n \]+Contents of two_floats_t:.*45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:.*78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:.*-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
pass "print print_small_structs"
}
-re ".*$gdb_prompt $" { fail "print print_small_structs" }
timeout { fail "(timeout) print_small_structs" }
}
#call compute_with_small_structs(20)
send_gdb "print compute_with_small_structs(20)\n"
gdb_expect {
-re ".*\[0-9\]+ =.*$gdb_prompt $" {
pass "print compute_with_small_structs(20)"
}
-re ".*$gdb_prompt $" { fail "print compute_with_small_structs(20)" }
timeout { fail "(timeout) compute_with_small_structs(20)" }
}
#call print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)
send_gdb "print print_ten_doubles(123.456, 123.456, -0.12, -1.23, 343434.8, 89.098, 3.14, -5678.12345, -0.11111111, 216.97065)\n"
gdb_expect {
-re ".*Two Doubles : 123.456000.*123.456000\[\t\r\n \]+Two Doubles : -0.120000.*-1.230000\[\t\r\n \]+Two Doubles : 343434.800000.*89.098000\[\t\r\n \]+Two Doubles : 3.140000.*-5678.123450\[\t\r\n \]+Two Doubles : -0.111111.*216.970650\[\t\r\n \]+.*$gdb_prompt $" {
pass "print print_ten_doubles"
}
-re ".*$gdb_prompt $" { fail "print print_ten_doubles" }
timeout { fail "(timeout) print_ten_doubles" }
}
#go -until 1084
gdb_test "tbreak 1084" \
"Breakpoint .* file .*call-ar-st.c, line 1084.*" \
"tbreakpoint line 1084"
gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1084\[\t\r\n \]+1084.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1084"
send_gdb "step\n"
gdb_expect {
-re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:813\[\r\n\]+813\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"}
-re ".*$gdb_prompt $" { fail "step into print_long_arg_list" }
timeout { fail "step into print_long_arg_list (timeout)" }
}
#call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)
send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n"
gdb_expect {
-re ".*alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+alpha\[\t\r\n \]+gamma\[\t\r\n \]+epsilon\[\t\r\n \]+ch1: y\tch2: n\[\t\r\n \]+Contents of three_char_t:\[\t\r\n \]+a\tb\tc\[\t\r\n \]+Contents of five_char_t:\[\t\r\n \]+l\tm\tn\to\tp\[\t\r\n \]+Contents of int_char_combo_t:\[\t\r\n \]+123.*z\[\t\r\n \]+Sum of the 4 struct values and seed :\[\t\r\n \]+52\[\t\r\n \]+Contents of struct1:\[\t\r\n \]+6.*0\[\t\r\n \]+Contents of struct2:\[\t\r\n \]+10.*0\[\t\r\n \]+Contents of struct3:\[\t\r\n \]+12.*0\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+10.500000\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+-3.340000\[\t\r\n \]+Contents of one_double_t:\[\t\r\n \]+675.091230\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+45.234001.*43.599998\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+78.010002.*122.099998\[\t\r\n \]+Contents of two_floats_t:\[\t\r\n \]+-1232.344971.*-199.210007\[\t\r\n \]+.*$gdb_prompt $" {
pass "print print_small_structs from print_long_arg_list "
}
-re ".*$gdb_prompt $" { fail "print print_small_structs from print_long_arg_list" }
timeout { fail "(timeout) print_small_structs from print_long_arg_list" }
}
#go -until 1098
gdb_test "tbreak 1098" \
"Breakpoint.* file .*call-ar-st.c, line 1098.*" \
"tbreakpoint line 1098"
gdb_test continue "Continuing\\..*Contents of two_floats_t:.*-1232.344971.*-199.210007.*main \\(\\) at.*call-ar-st.c:1098.*1098.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \
"continue to 1098"
#step
send_gdb "step\n"
gdb_expect {
-re "
init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:385\[ \t\n\r\]+385.*bit_flags_combo->alpha = a;.*$gdb_prompt $" {
pass "step into init_bit_flags_combo"}
-re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" }
timeout { fail "step into init_bit_flags_combo (timeout)" }
}
#call print_bit_flags_combo(*bit_flags_combo)
send_gdb "print print_bit_flags_combo(*bit_flags_combo)\n"
gdb_expect {
-re ".*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*$gdb_prompt $" {
pass "print print_bit_flags_combo from init_bit_flags_combo"
}
-re ".*$gdb_prompt $" { fail "print print_bit_flags_combo from init_bit_flags_combo" }
timeout { fail "(timeout) print_bit_flags_combo from init_bit_flags_combo" }
}
#go -until 1103
gdb_test "tbreak 1103" \
"Breakpoint.* file .*call-ar-st.c, line 1103.*" \
"tbreakpoint line 1103"
gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1103\[\r\n\t \]+1103.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \
"continue to 1103"
#call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)
send_gdb "print print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3)\n"
gdb_expect {
-re ".*double : 22.220000.*double : 33.333000.*int : 0.*int : -25.*int : 100.*int : 2345.*alpha.*gamma.*epsilon.*ch1: y\tch2: n.*Contents of three_char_t:.*x\ty\tz.*Contents of five_char_t:.*h\te\tl\tl\to.*Contents of int_char_combo_t:.*123\tz.*Sum of the 4 struct values and seed :.*52.*Contents of struct1:.*6\[ \]+0.*Contents of struct2:.*10\[ \]+0.*Contents of struct3:.*12.*0.*Contents of one_double_t:\[ \n\r\t\]+1.111110\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+-345.340000\[ \n\r\t\]+Contents of one_double_t:\[ \n\r\t\]+546464.200000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+0.234000\t453.100006\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+78.345001\t23.090000\[ \n\r\t\]+Contents of two_floats_t:\[ \n\r\t\]+-2.345000\t1.000000.*$gdb_prompt $" {
pass "print print_long_arg_list"
}
-re ".*$gdb_prompt $" { fail "print print_long_arg_list" }
timeout { fail "(timeout) print_long_arg_list" }
}
#go -until 1109
gdb_test "tbreak 1109" \
"Breakpoint.* file .*call-ar-st.c, line 1109.*" \
"tbreakpoint line 1109"
gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1109\[ \t\n\r\]+1109.*compute_with_small_structs\\(35\\);" \
"continue to 1109"
#call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)
send_gdb "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)\n"
gdb_expect {
-re ".*Sum of the 4 struct values and seed :\[ \t\n\r\]+218.*$gdb_prompt $" {
pass "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)"
}
-re ".*$gdb_prompt $" { fail "print sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
timeout { fail "(timeout) sum_struct_print(10, *struct1, *struct2, *struct3, *struct4)" }
}
#call print_struct_rep(*struct1, *struct2, *struct3)
send_gdb "print print_struct_rep(*struct1, *struct2, *struct3)\n"
gdb_expect {
-re ".*Contents of struct1:\[ \t\n\r\]+ 22 0\[ \t\n\r\]+Contents of struct2:\[ \t\n\r\]+ 42 0\[ \t\n\r\]+Contents of struct3:\[ \t\n\r\]+ 62 0\[ \t\n\r\]+.*$gdb_prompt $" {
pass "print print_struct_rep(*struct1, *struct2, *struct3)"
}
-re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" }
timeout { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" }
}
send_gdb "print print_one_large_struct(*list1)\n"
gdb_expect {
-re ".* 4 1.*$gdb_prompt $" {
pass "print print_one_large_struct(*list1)"
}
-re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
timeout { fail "(timeout) print_one_large_struct(*list1)" }
}
return
~

View File

@@ -0,0 +1,530 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/**************************************************************************
* TESTS :
* function returning large structures, which go on the stack
* functions returning varied sized structs which go on in the registers.
***************************************************************************/
/* A large structure (> 64 bits) used to test passing large structures as
* parameters
*/
struct array_rep_info_t {
int next_index[10];
int values[10];
int head;
};
/*****************************************************************************
* Small structures ( <= 64 bits). These are used to test passing small
* structures as parameters and test argument size promotion.
*****************************************************************************/
/* 64 bits
*/
struct small_rep_info_t {
int value;
int head;
};
/* 6 bits : really fits in 8 bits and is promoted to 32 bits
*/
struct bit_flags_t {
unsigned alpha :1;
unsigned beta :1;
unsigned gamma :1;
unsigned delta :1;
unsigned epsilon :1;
unsigned omega :1;
};
/* 22 bits : really fits in 40 bits and is promoted to 64 bits
*/
struct bit_flags_combo_t {
unsigned alpha :1;
unsigned beta :1;
char ch1;
unsigned gamma :1;
unsigned delta :1;
char ch2;
unsigned epsilon :1;
unsigned omega :1;
};
/* 64 bits
*/
struct one_double_t {
double double1;
};
/* 64 bits
*/
struct two_floats_t {
float float1;
float float2;
};
/* 24 bits : promoted to 32 bits
*/
struct three_char_t {
char ch1;
char ch2;
char ch3;
};
/* 40 bits : promoted to 64 bits
*/
struct five_char_t {
char ch1;
char ch2;
char ch3;
char ch4;
char ch5;
};
/* 40 bits : promoted to 64 bits
*/
struct int_char_combo_t {
int int1;
char ch1;
};
/*****************************************************************
* LOOP_COUNT :
* A do nothing function. Used to provide a point at which calls can be made.
*****************************************************************/
void loop_count () {
int index;
for (index=0; index<4; index++);
}
/*****************************************************************
* INIT_BIT_FLAGS :
* Initializes a bit_flags_t structure. Can call this function see
* the call command behavior when integer arguments do not fit into
* registers and must be placed on the stack.
* OUT struct bit_flags_t *bit_flags -- structure to be filled
* IN unsigned a -- 0 or 1
* IN unsigned b -- 0 or 1
* IN unsigned g -- 0 or 1
* IN unsigned d -- 0 or 1
* IN unsigned e -- 0 or 1
* IN unsigned o -- 0 or 1
*****************************************************************/
void init_bit_flags (bit_flags,a,b,g,d,e,o)
struct bit_flags_t *bit_flags;
unsigned a;
unsigned b;
unsigned g;
unsigned d;
unsigned e;
unsigned o;
{
bit_flags->alpha = a;
bit_flags->beta = b;
bit_flags->gamma = g;
bit_flags->delta = d;
bit_flags->epsilon = e;
bit_flags->omega = o;
}
/*****************************************************************
* INIT_BIT_FLAGS_COMBO :
* Initializes a bit_flags_combo_t structure. Can call this function
* to see the call command behavior when integer and character arguments
* do not fit into registers and must be placed on the stack.
* OUT struct bit_flags_combo_t *bit_flags_combo -- structure to fill
* IN unsigned a -- 0 or 1
* IN unsigned b -- 0 or 1
* IN char ch1
* IN unsigned g -- 0 or 1
* IN unsigned d -- 0 or 1
* IN char ch2
* IN unsigned e -- 0 or 1
* IN unsigned o -- 0 or 1
*****************************************************************/
void init_bit_flags_combo (bit_flags_combo, a, b, ch1, g, d, ch2, e, o)
struct bit_flags_combo_t *bit_flags_combo;
unsigned a;
unsigned b;
char ch1;
unsigned g;
unsigned d;
char ch2;
unsigned e;
unsigned o;
{
bit_flags_combo->alpha = a;
bit_flags_combo->beta = b;
bit_flags_combo->ch1 = ch1;
bit_flags_combo->gamma = g;
bit_flags_combo->delta = d;
bit_flags_combo->ch2 = ch2;
bit_flags_combo->epsilon = e;
bit_flags_combo->omega = o;
}
/*****************************************************************
* INIT_ONE_DOUBLE :
* OUT struct one_double_t *one_double -- structure to fill
* IN double init_val
*****************************************************************/
void init_one_double (one_double, init_val)
struct one_double_t *one_double;
double init_val;
{
one_double->double1 = init_val;
}
/*****************************************************************
* INIT_TWO_FLOATS :
* OUT struct two_floats_t *two_floats -- structure to be filled
* IN float init_val1
* IN float init_val2
*****************************************************************/
void init_two_floats (two_floats, init_val1, init_val2)
struct two_floats_t *two_floats;
float init_val1;
float init_val2;
{
two_floats->float1 = init_val1;
two_floats->float2 = init_val2;
}
/*****************************************************************
* INIT_THREE_CHARS :
* OUT struct three_char_t *three_char -- structure to be filled
* IN char init_val1
* IN char init_val2
* IN char init_val3
*****************************************************************/
void init_three_chars ( three_char, init_val1, init_val2, init_val3)
struct three_char_t *three_char;
char init_val1;
char init_val2;
char init_val3;
{
three_char->ch1 = init_val1;
three_char->ch2 = init_val2;
three_char->ch3 = init_val3;
}
/*****************************************************************
* INIT_FIVE_CHARS :
* OUT struct five_char_t *five_char -- structure to be filled
* IN char init_val1
* IN char init_val2
* IN char init_val3
* IN char init_val4
* IN char init_val5
*****************************************************************/
void init_five_chars ( five_char, init_val1, init_val2, init_val3, init_val4, init_val5)
struct five_char_t *five_char;
char init_val1;
char init_val2;
char init_val3;
char init_val4;
char init_val5;
{
five_char->ch1 = init_val1;
five_char->ch2 = init_val2;
five_char->ch3 = init_val3;
five_char->ch4 = init_val4;
five_char->ch5 = init_val5;
}
/*****************************************************************
* INIT_INT_CHAR_COMBO :
* OUT struct int_char_combo_t *combo -- structure to be filled
* IN int init_val1
* IN char init_val2
*****************************************************************/
void init_int_char_combo ( combo, init_val1, init_val2)
struct int_char_combo_t *combo;
int init_val1;
char init_val2;
{
combo->int1 = init_val1;
combo->ch1 = init_val2;
}
/*****************************************************************
* INIT_STRUCT_REP :
* OUT struct small_rep_into_t *small_struct -- structure to be filled
* IN int seed
*****************************************************************/
void init_struct_rep( small_struct, seed)
struct small_rep_info_t *small_struct;
int seed;
{
small_struct->value = 2 + (seed*2);
small_struct->head = 0;
}
/*****************************************************************
* PRINT_BIT_FLAGS :
* IN struct bit_flags_t bit_flags
****************************************************************/
struct bit_flags_t print_bit_flags ( bit_flags)
struct bit_flags_t bit_flags;
{
if (bit_flags.alpha) printf("alpha\n");
if (bit_flags.beta) printf("beta\n");
if (bit_flags.gamma) printf("gamma\n");
if (bit_flags.delta) printf("delta\n");
if (bit_flags.epsilon) printf("epsilon\n");
if (bit_flags.omega) printf("omega\n");
return bit_flags;
}
/*****************************************************************
* PRINT_BIT_FLAGS_COMBO :
* IN struct bit_flags_combo_t bit_flags_combo
****************************************************************/
struct bit_flags_combo_t print_bit_flags_combo ( bit_flags_combo )
struct bit_flags_combo_t bit_flags_combo;
{
if (bit_flags_combo.alpha) printf("alpha\n");
if (bit_flags_combo.beta) printf("beta\n");
if (bit_flags_combo.gamma) printf("gamma\n");
if (bit_flags_combo.delta) printf("delta\n");
if (bit_flags_combo.epsilon) printf("epsilon\n");
if (bit_flags_combo.omega) printf("omega\n");
printf("ch1: %c\tch2: %c\n", bit_flags_combo.ch1, bit_flags_combo.ch2);
return bit_flags_combo;
}
/*****************************************************************
* PRINT_ONE_DOUBLE :
* IN struct one_double_t one_double
****************************************************************/
struct one_double_t print_one_double ( one_double )
struct one_double_t one_double;
{
printf("Contents of one_double_t: \n\n");
printf("%f\n", one_double.double1);
return one_double;
}
/*****************************************************************
* PRINT_TWO_FLOATS :
* IN struct two_floats_t two_floats
****************************************************************/
struct two_floats_t print_two_floats ( two_floats )
struct two_floats_t two_floats;
{
printf("Contents of two_floats_t: \n\n");
printf("%f\t%f\n", two_floats.float1, two_floats.float2);
return two_floats;
}
/*****************************************************************
* PRINT_THREE_CHARS :
* IN struct three_char_t three_char
****************************************************************/
struct three_char_t print_three_chars ( three_char )
struct three_char_t three_char;
{
printf("Contents of three_char_t: \n\n");
printf("%c\t%c\t%c\n", three_char.ch1, three_char.ch2, three_char.ch3);
return three_char;
}
/*****************************************************************
* PRINT_FIVE_CHARS :
* IN struct five_char_t five_char
****************************************************************/
struct five_char_t print_five_chars ( five_char )
struct five_char_t five_char;
{
printf("Contents of five_char_t: \n\n");
printf("%c\t%c\t%c\t%c\t%c\n", five_char.ch1, five_char.ch2,
five_char.ch3, five_char.ch4,
five_char.ch5);
return five_char;
}
/*****************************************************************
* PRINT_INT_CHAR_COMBO :
* IN struct int_char_combo_t int_char_combo
****************************************************************/
struct int_char_combo_t print_int_char_combo ( int_char_combo )
struct int_char_combo_t int_char_combo;
{
printf("Contents of int_char_combo_t: \n\n");
printf("%d\t%c\n", int_char_combo.int1, int_char_combo.ch1);
return int_char_combo;
}
/*****************************************************************
* PRINT_STRUCT_REP :
****************************************************************/
struct small_rep_info_t print_struct_rep( struct1 )
struct small_rep_info_t struct1;
{
printf("Contents of struct1: \n\n");
printf("%10d%10d\n", struct1.value, struct1.head);
struct1.value =+5;
return struct1;
}
struct array_rep_info_t print_one_large_struct( linked_list1 )
struct array_rep_info_t linked_list1;
{
printf("%10d%10d\n", linked_list1.values[0],
linked_list1.next_index[0]);
return linked_list1;
}
/*****************************************************************
* INIT_ARRAY_REP :
* IN struct array_rep_info_t *linked_list
* IN int seed
****************************************************************/
void init_array_rep( linked_list, seed )
struct array_rep_info_t *linked_list;
int seed;
{
int index;
for (index = 0; index < 10; index++) {
linked_list->values[index] = (2*index) + (seed*2);
linked_list->next_index[index] = index + 1;
}
linked_list->head = 0;
}
int main () {
/* variables for large structure testing
*/
int number = 10;
struct array_rep_info_t *list1;
/* variables for testing a small structures and a very long argument list
*/
struct small_rep_info_t *struct1;
struct bit_flags_t *flags;
struct bit_flags_combo_t *flags_combo;
struct three_char_t *three_char;
struct five_char_t *five_char;
struct int_char_combo_t *int_char_combo;
struct one_double_t *d1;
struct two_floats_t *f3;
/* Allocate space for large structures
*/
list1 = (struct array_rep_info_t *)malloc(sizeof(struct array_rep_info_t));
/* Initialize large structures
*/
init_array_rep(list1, 2);
/* Print large structures
*/
print_one_large_struct(*list1);
/* Allocate space for small structures
*/
struct1 = (struct small_rep_info_t *)malloc(sizeof(struct small_rep_info_t));
flags = (struct bit_flags_t *)malloc(sizeof(struct bit_flags_t));
flags_combo = (struct bit_flags_combo_t *)malloc(sizeof(struct bit_flags_combo_t));
three_char = (struct three_char_t *)malloc(sizeof(struct three_char_t));
five_char = (struct five_char_t *)malloc(sizeof(struct five_char_t));
int_char_combo = (struct int_char_combo_t *)malloc(sizeof(struct int_char_combo_t));
d1 = (struct one_double_t *)malloc(sizeof(struct one_double_t));
f3 = (struct two_floats_t *)malloc(sizeof(struct two_floats_t));
/* Initialize small structures
*/
init_one_double ( d1, 1.11111);
init_two_floats ( f3, -2.345, 1.0);
init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1,
(unsigned)0, (unsigned)1, (unsigned)0 );
init_bit_flags_combo(flags_combo, (unsigned)1, (unsigned)0, 'y',
(unsigned)1, (unsigned)0, 'n',
(unsigned)1, (unsigned)0 );
init_three_chars(three_char, 'x', 'y', 'z');
init_five_chars(five_char, 'h', 'e', 'l', 'l', 'o');
init_int_char_combo(int_char_combo, 13, '!');
init_struct_rep(struct1, 10);
/* Print small structures
*/
print_one_double(*d1);
print_two_floats(*f3);
print_bit_flags(*flags);
print_bit_flags_combo(*flags_combo);
print_three_chars(*three_char);
print_five_chars(*five_char);
print_int_char_combo(*int_char_combo);
print_struct_rep(*struct1);
loop_count();
return 0;
}

View File

@@ -0,0 +1,230 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# this file tests command line calls with functions returning structures
# corresponding source file: call_return_struct.c
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "call-rt-st"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global gdb_prompt
send_gdb "set language c\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language c (timeout)" ; return 0; }
}
send_gdb "show language\n"
gdb_expect {
-re ".* source language is \"c\".*$gdb_prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$gdb_prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
source ${binfile}.ci
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
gdb_test "break loop_count" \
"Breakpoint.* file .*call-rt-st.c, line 106\\." \
"breakpoint loop_count"
send_gdb "continue\n"
gdb_expect {
-re "Continuing\\..*Breakpoint.*loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+106\[\t \]+for \\(index=0; index.4; index..\\);\[\r\n \]+$gdb_prompt $" {
pass "continue to loop_count"}
-re ".*$gdb_prompt $" { fail "continue to loop_count"}
timeout { fail "(timeout) continue to loop_count"}
}
send_gdb "finish\n"
gdb_expect {
-re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:514\[ \t\r\n\]+514\[\t \]+return 0;.*$gdb_prompt $" {
pass "finish out from loop_count"}
-re ".*$gdb_prompt $" { fail "finish out from loop_count"}
timeout { fail "(timeout)finish out from loop_count"}
}
send_gdb "print print_struct_rep(*struct1)\n"
gdb_expect {
-re ".*Contents of struct1:\[ \t\n\r\]+22\[ \t\]+0\[ \t\n\r\]+.\[0-9\]+ = \{value = 5, head = 0\}.*$gdb_prompt $" {
pass "print print_struct_rep(*struct1, *struct2, *struct3)"
}
-re ".*$gdb_prompt $" { fail "print print_struct_rep(*struct1, *struct2, *struct3)" }
timeout { fail "(timeout) print_struct_rep(*struct1, *struct2, *struct3)" }
}
send_gdb "print print_one_large_struct(*list1)\n"
gdb_expect {
-re ".*\[ \t\]+4\[ \t\]+1\[ \r\n\]+.\[0-9\]+ = \{next_index = \{1, 2, 3, 4, 5, 6, 7, 8, 9, 10\}, values = \{4, 6, 8, 10, 12, 14, 16, 18, 20, 22\}, head = 0\}.*$gdb_prompt $" {
pass "print print_one_large_struct(*list1)"
}
-re ".*$gdb_prompt $" { fail "print print_one_large_struct(*list1)" }
timeout { fail "(timeout) print_one_large_struct(*list1)" }
}
send_gdb "print print_one_double(*d1)\n"
gdb_expect {
-re ".*Contents of one_double_t:\[ \r\n\]+1\\.111110\[ \r\n\]+.\[0-9\]+ = \{double1 = 1\\.11111\}.*$gdb_prompt $" {
pass "print print_one_double(*d1)"
}
-re ".*$gdb_prompt $" { fail "print print_one_double(*d1)" }
timeout { fail "(timeout) print_one_double(*d1)" }
}
send_gdb "print print_two_floats(*f3)\n"
gdb_expect {
-re ".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \{float1 = -2\\.34500003, float2 = 1\}.*$gdb_prompt $" {
pass "print print_two_floats(*f3)"
}
-re ".*$gdb_prompt $" { fail "print print_two_floats(*f3)" }
timeout { fail "(timeout) print_two_floats(*f3)" }
}
send_gdb "print print_bit_flags(*flags)\n"
gdb_expect {
-re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
pass "print print_bit_flags(*flags)"
}
-re ".*$gdb_prompt $" { fail "print print_bit_flags(*flags)" }
timeout { fail "(timeout) print_bit_flags(*flags)" }
}
send_gdb "print print_bit_flags_combo(*flags_combo)\n"
gdb_expect {
-re ".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+ch1: y\[ \t\]+ch2: n\[ \r\n\]+.\[0-9\]+ = \{alpha = 1, beta = 0, ch1 = 121 'y', gamma = 1, delta = 0, ch2 = 110 'n', epsilon = 1, omega = 0\}\[ \r\n\]+$gdb_prompt $" {
pass "print print_bit_flags_combo(*flags_combo)"
}
-re ".*$gdb_prompt $" { fail "print print_bit_flags_combo(*flags_combo)" }
timeout { fail "(timeout) print_bit_flags_combo(*flags_combo)" }
}
send_gdb "print print_three_chars(*three_char)\n"
gdb_expect {
-re ".*Contents of three_char_t:\[ \r\n\]+x\[ \t\]+y\[ \t\]+z\[ \r\n\]+.\[0-9\]+ = \{ch1 = 120 'x', ch2 = 121 'y', ch3 = 122 'z'\}\[ \r\n\]+$gdb_prompt $" {
pass "print print_three_chars(*three_char)"
}
-re ".*$gdb_prompt $" { fail "print print_three_chars(*three_char)" }
timeout { fail "(timeout) print_three_chars(*three_char)" }
}
send_gdb "print print_five_chars(*five_char)\n"
gdb_expect {
-re ".*Contents of five_char_t:\[ \r\n\]+h\[ \t\]+e\[ \t\]+l\[ \t\]+l\[ \t\]+o\[ \r\n\]+.\[0-9\]+ = \{ch1 = 104 'h', ch2 = 101 'e', ch3 = 108 'l', ch4 = 108 'l', ch5 = 111 'o'\}\[ \r\n\]+$gdb_prompt $" {
pass "print print_five_chars(*five_char)"
}
-re ".*$gdb_prompt $" { fail "print print_five_chars(*five_char)" }
timeout { fail "(timeout) print_five_chars(*five_char)" }
}
send_gdb "print print_int_char_combo(*int_char_combo)\n"
gdb_expect {
-re ".*Contents of int_char_combo_t:\[ \r\n\]+13\[ \t\]+!\[ \r\n\]+.\[0-9\]+ = \{int1 = 13, ch1 = 33 '!'\}\[ \r\n\]+$gdb_prompt $" {
pass "print print_int_char_combo(*int_char_combo)"
}
-re ".*$gdb_prompt $" { fail "print print_int_char_combo(*int_char_combo)" }
timeout { fail "(timeout) print_int_char_combo(*int_char_combo)" }
}
return

View File

@@ -0,0 +1,54 @@
#include <stdio.h>
char buf[100];
char bigbuf[1000];
char * s;
char * str_func1(s1)
char *s1;
{
printf("first string arg is: %s\n", s1);
strcpy(bigbuf, s1);
return bigbuf;
}
char * str_func(s1,
s2,
s3,
s4,
s5,
s6,
s7)
char * s1;
char * s2;
char * s3;
char * s4;
char * s5;
char * s6;
char * s7;
{
printf("first string arg is: %s\n", s1);
printf("second string arg is: %s\n", s2);
printf("third string arg is: %s\n", s3);
printf("fourth string arg is: %s\n", s4);
printf("fifth string arg is: %s\n", s5);
printf("sixth string arg is: %s\n", s6);
printf("seventh string arg is: %s\n", s7);
strcpy(bigbuf, s1);
strcat(bigbuf, s2);
strcat(bigbuf, s3);
strcat(bigbuf, s4);
strcat(bigbuf, s5);
strcat(bigbuf, s6);
strcat(bigbuf, s7);
return bigbuf;
}
main()
{
s = &buf[0];
strcpy(buf, "test string");
str_func("abcd", "efgh", "ijkl", "mnop", "qrst", "uvwx", "yz12");
str_func1("abcd");
}

View File

@@ -0,0 +1,242 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This test deals with calling functions which have strings as parameters.
# it plays around with constant strings.
# the corresponding source file is call-strs.c
#
#debug strarg
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "call-strs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global gdb_prompt
send_gdb "set language c\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language c (timeout)" ; return 0; }
}
send_gdb "show language\n"
gdb_expect {
-re ".* source language is \"c\".*$gdb_prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$gdb_prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
send_gdb "set print sevenbit-strings\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set print address off\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $"
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
#step
send_gdb "step\n"
gdb_expect {
-re ".*strcpy\\(buf, \"test string\"\\);.*$gdb_prompt $" {pass "step after assignment to s"}
-re ".*$gdb_prompt $" { fail "step after assignment to s" }
timeout { fail "step after assignment to s (timeout)" }
}
#step
send_gdb "step\n"
gdb_expect {
-re ".*str_func\\(\"abcd\", \"efgh\", \"ijkl\", \"mnop\", \"qrst\", \"uvwx\", \"yz12\"\\);.*$gdb_prompt $" {pass "step after strcpy"}
-re ".*$gdb_prompt $" { fail "step after strcpy" }
timeout { fail "step after strcpy (timeout)" }
}
#print buf
send_gdb "print buf\n"
gdb_expect {
-re ".*\"test string\",.*repeats 88 times.*$gdb_prompt $" {
pass "print buf"
}
-re ".*$gdb_prompt $" { fail "print buf" }
timeout { fail "(timeout) print buf" }
}
#print s
send_gdb "print s\n"
gdb_expect {
-re ".*= \"test string\".*$gdb_prompt $" {
pass "print s"
}
-re ".*$gdb_prompt $" { fail "print s" }
timeout { fail "(timeout) print sum_array_print(10, *list1, *list2, *list3, *list4)" }
}
#print str_func1(s)
send_gdb "print str_func1(s)\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "print str_func1(s)"
}
-re ".*$gdb_prompt $" { fail "print str_func1(s)" }
timeout { fail "(timeout) print str_func1(s)" }
}
#print str_func1("test string")
send_gdb "print str_func1(\"test string\")\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "print str_func1(\"test string\")"
}
-re ".*$gdb_prompt $" { fail "print str_func1(\"test string\")" }
timeout { fail "(timeout) print str_func1(\"test string\")" }
}
#call str_func1(s)
send_gdb "call str_func1(s)\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "call str_func1(s)"
}
-re ".*$gdb_prompt $" { fail "call str_func1(s)" }
timeout { fail "(timeout) call str_func1(s)" }
}
#call str_func1("test string")
send_gdb "call str_func1(\"test string\")\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "call str_func1(\"test string\")"
}
-re ".*$gdb_prompt $" { fail "call str_func1(\"test string\")" }
timeout { fail "(timeout) call str_func1(\"test string\")" }
}
#print str_func1(buf)
send_gdb "print str_func1(buf)\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "print str_func1(buf)"
}
-re ".*$gdb_prompt $" { fail "print str_func1(buf)" }
timeout { fail "(timeout) print str_func1(buf)" }
}
#call str_func1(buf)
send_gdb "call str_func1(buf)\n"
gdb_expect {
-re "first string arg is: test string.*\"test string\".*$gdb_prompt $" {
pass "call str_func1(buf)"
}
-re ".*$gdb_prompt $" { fail "call str_func1(buf)" }
timeout { fail "(timeout) call str_func1(buf)" }
}
#print str_func("a","b","c","d","e","f","g")
send_gdb "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
gdb_expect {
-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
pass "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
}
-re ".*$gdb_prompt $" { fail "print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
timeout { fail "(timeout) print str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
}
#call str_func("a","b","c","d","e","f","g")
send_gdb "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")\n"
gdb_expect {
-re "first string arg is: a\[ \t\r\n\]+second string arg is: b\[ \t\r\n\]+third string arg is: c\[ \t\r\n\]+fourth string arg is: d\[ \t\r\n\]+fifth string arg is: e\[ \t\r\n\]+sixth string arg is: f\[ \t\r\n\]+seventh string arg is: g\[ \t\r\n\]+.*= \"abcdefg\".*$gdb_prompt $" {
pass "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")"
}
-re ".*$gdb_prompt $" { fail "call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
timeout { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" }
}
#print str_func(s,s,s,s,s,s,s,s)
send_gdb "print str_func(s,s,s,s,s,s,s,s)\n"
gdb_expect {
-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
pass "print str_func(s,s,s,s,s,s,s,s)"
}
-re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s,s)" }
timeout { fail "(timeout) print str_func(s,s,s,s,s,s,s,s)" }
}
#call str_func(s,s,s,s,s,s,s,s)
send_gdb "call str_func(s,s,s,s,s,s,s,s)\n"
gdb_expect {
-re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" {
pass "call str_func(s,s,s,s,s,s,s,s)"
}
-re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s,s)" }
timeout { fail "(timeout) call str_func(s,s,s,s,s,s,s,s)" }
}
gdb_exit
return 0
~

View File

@@ -0,0 +1,280 @@
/* Support program for testing gdb's ability to call functions
in the inferior, pass appropriate arguments to those functions,
and get the returned result. */
#ifdef NO_PROTOTYPES
#define PARAMS(paramlist) ()
#else
#define PARAMS(paramlist) paramlist
#endif
char char_val1 = 'a';
char char_val2 = 'b';
short short_val1 = 10;
short short_val2 = -23;
int int_val1 = 87;
int int_val2 = -26;
long long_val1 = 789;
long long_val2 = -321;
float float_val1 = 3.14159;
float float_val2 = -2.3765;
double double_val1 = 45.654;
double double_val2 = -67.66;
#define DELTA (0.001)
char *string_val1 = "string 1";
char *string_val2 = "string 2";
char char_array_val1[] = "carray 1";
char char_array_val2[] = "carray 2";
struct struct1 {
char c;
short s;
int i;
long l;
float f;
double d;
char a[4];
} struct_val1 = { 'x', 87, 76, 51, 2.1234, 9.876, "foo" };
/* Some functions that can be passed as arguments to other test
functions, or called directly. */
int add (a, b)
int a, b;
{
return (a + b);
}
int doubleit (a)
int a;
{
return (a + a);
}
int (*func_val1) PARAMS((int,int)) = add;
int (*func_val2) PARAMS((int)) = doubleit;
/* An enumeration and functions that test for specific values. */
enum enumtype { enumval1, enumval2, enumval3 };
enum enumtype enum_val1 = enumval1;
enum enumtype enum_val2 = enumval2;
enum enumtype enum_val3 = enumval3;
int t_enum_value1 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val1);
}
int t_enum_value2 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val2);
}
int t_enum_value3 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val3);
}
/* A function that takes a vector of integers (along with an explicit
count) and returns their sum. */
int sum_args (argc, argv)
int argc;
int argv[];
{
int sumval = 0;
int idx;
for (idx = 0; idx < argc; idx++)
{
sumval += argv[idx];
}
return (sumval);
}
/* Test that we can call functions that take structs and return
members from that struct */
char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); }
int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); }
long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); }
char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); }
/* Test that calling functions works if there are a lot of arguments. */
int
sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9)
int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
{
return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9;
}
/* Test that args are passed in the right order. */
int
cmp10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9)
int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
{
return
(i0 == 0) && (i1 == 1) && (i2 == 2) && (i3 == 3) && (i4 == 4) &&
(i5 == 5) && (i6 == 6) && (i7 == 7) && (i8 == 8) && (i9 == 9);
}
/* Gotta have a main to be able to generate a linked, runnable
executable, and also provide a useful place to set a breakpoint. */
extern void * malloc() ;
int main ()
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
malloc(1);
t_structs_c(struct_val1);
return 0 ;
}
/* Functions that expect specific values to be passed and return
either 0 or 1, depending upon whether the values were
passed incorrectly or correctly, respectively. */
int t_char_values (char_arg1, char_arg2)
char char_arg1, char_arg2;
{
return ((char_arg1 == char_val1) && (char_arg2 == char_val2));
}
int
#ifdef NO_PROTOTYPES
t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
char arg1;
short arg2;
int arg3;
char arg4;
short arg5;
char arg6;
short arg7;
int arg8;
short arg9;
short arg10;
#else
t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5,
char arg6, short arg7, int arg8, short arg9, short arg10)
#endif
{
return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10;
}
int t_short_values (short_arg1, short_arg2)
short short_arg1, short_arg2;
{
return ((short_arg1 == short_val1) && (short_arg2 == short_val2));
}
int t_int_values (int_arg1, int_arg2)
int int_arg1, int_arg2;
{
return ((int_arg1 == int_val1) && (int_arg2 == int_val2));
}
int t_long_values (long_arg1, long_arg2)
long long_arg1, long_arg2;
{
return ((long_arg1 == long_val1) && (long_arg2 == long_val2));
}
int t_float_values (float_arg1, float_arg2)
float float_arg1, float_arg2;
{
return ((float_arg1 - float_val1) < DELTA
&& (float_arg1 - float_val1) > -DELTA
&& (float_arg2 - float_val2) < DELTA
&& (float_arg2 - float_val2) > -DELTA);
}
int
#ifdef NO_PROTOTYPES
/* In this case we are just duplicating t_float_values, but that is the
easiest way to deal with either ANSI or non-ANSI. */
t_float_values2 (float_arg1, float_arg2)
float float_arg1, float_arg2;
#else
t_float_values2 (float float_arg1, float float_arg2)
#endif
{
return ((float_arg1 - float_val1) < DELTA
&& (float_arg1 - float_val1) > -DELTA
&& (float_arg2 - float_val2) < DELTA
&& (float_arg2 - float_val2) > -DELTA);
}
int t_double_values (double_arg1, double_arg2)
double double_arg1, double_arg2;
{
return ((double_arg1 - double_val1) < DELTA
&& (double_arg1 - double_val1) > -DELTA
&& (double_arg2 - double_val2) < DELTA
&& (double_arg2 - double_val2) > -DELTA);
}
int t_string_values (string_arg1, string_arg2)
char *string_arg1, *string_arg2;
{
return (!strcmp (string_arg1, string_val1) &&
!strcmp (string_arg2, string_val2));
}
int t_char_array_values (char_array_arg1, char_array_arg2)
char char_array_arg1[], char_array_arg2[];
{
return (!strcmp (char_array_arg1, char_array_val1) &&
!strcmp (char_array_arg2, char_array_val2));
}
/* This used to simply compare the function pointer arguments with
known values for func_val1 and func_val2. Doing so is valid ANSI
code, but on some machines (RS6000, HPPA, others?) it may fail when
called directly by GDB.
In a nutshell, it's not possible for GDB to determine when the address
of a function or the address of the function's stub/trampoline should
be passed.
So, to avoid GDB lossage in the common case, we perform calls through the
various function pointers and compare the return values. For the HPPA
at least, this allows the common case to work.
If one wants to try something more complicated, pass the address of
a function accepting a "double" as one of its first 4 arguments. Call
that function indirectly through the function pointer. This would fail
on the HPPA. */
int t_func_values (func_arg1, func_arg2)
int (*func_arg1) PARAMS ((int, int));
int (*func_arg2) PARAMS ((int));
{
return ((*func_arg1) (5,5) == (*func_val1) (5,5)
&& (*func_arg2) (6) == (*func_val2) (6));
}
int t_call_add (func_arg1, a, b)
int (*func_arg1) PARAMS ((int, int));
int a, b;
{
return ((*func_arg1)(a, b));
}

View File

@@ -0,0 +1,269 @@
# Copyright (C) 92, 96, 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)
# and modified by Bob Manson. (manson@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "callfuncs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set prototypes 1
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
set prototypes 0;
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global gdb_prompt
send_gdb "set language c\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language c (timeout)" ; return 0; }
}
send_gdb "show language\n"
gdb_expect {
-re ".* source language is \"c\".*$gdb_prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$gdb_prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
# FIXME: Before calling this proc, we should probably verify that
# we can call inferior functions and get a valid integral value
# returned.
# Note that it is OK to check for 0 or 1 as the returned values, because C
# specifies that the numeric value of a relational or logical expression
# (computed in the inferior) is 1 for true and 0 for false.
proc do_function_calls {} {
global prototypes
global gcc_compiled
# We need to up this because this can be really slow on some boards.
set timeout 60;
gdb_test "p t_char_values(0,0)" " = 0"
gdb_test "p t_char_values('a','b')" " = 1"
gdb_test "p t_char_values(char_val1,char_val2)" " = 1"
gdb_test "p t_char_values('a',char_val2)" " = 1"
gdb_test "p t_char_values(char_val1,'b')" " = 1"
gdb_test "p t_short_values(0,0)" " = 0"
gdb_test "p t_short_values(10,-23)" " = 1"
gdb_test "p t_short_values(short_val1,short_val2)" " = 1"
gdb_test "p t_short_values(10,short_val2)" " = 1"
gdb_test "p t_short_values(short_val1,-23)" " = 1"
gdb_test "p t_int_values(0,0)" " = 0"
gdb_test "p t_int_values(87,-26)" " = 1"
gdb_test "p t_int_values(int_val1,int_val2)" " = 1"
gdb_test "p t_int_values(87,int_val2)" " = 1"
gdb_test "p t_int_values(int_val1,-26)" " = 1"
gdb_test "p t_long_values(0,0)" " = 0"
gdb_test "p t_long_values(789,-321)" " = 1"
gdb_test "p t_long_values(long_val1,long_val2)" " = 1"
gdb_test "p t_long_values(789,long_val2)" " = 1"
gdb_test "p t_long_values(long_val1,-321)" " = 1"
if ![target_info exists gdb,skip_float_tests] {
gdb_test "p t_float_values(0.0,0.0)" " = 0"
# These next four tests fail on the mn10300.
# The first value is passed in regs, the other in memory.
# Gcc emits different stabs for the two parameters; the first is
# claimed to be a float, the second a double.
# dbxout.c in gcc claims this is the desired behavior.
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(3.14159,-2.3765)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(float_val1,float_val2)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(3.14159,float_val2)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(float_val1,-2.3765)" " = 1"
# Test passing of arguments which might not be widened.
gdb_test "p t_float_values2(0.0,0.0)" " = 0"
# Although PR 5318 mentions SunOS specifically, this seems
# to be a generic problem on quite a few platforms.
if $prototypes then {
setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318
if {!$gcc_compiled} then {
setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318
}
}
gdb_test "p t_float_values2(3.14159,float_val2)" " = 1"
gdb_test "p t_small_values(1,2,3,4,5,6,7,8,9,10)" " = 55"
gdb_test "p t_double_values(0.0,0.0)" " = 0"
gdb_test "p t_double_values(45.654,-67.66)" " = 1"
gdb_test "p t_double_values(double_val1,double_val2)" " = 1"
gdb_test "p t_double_values(45.654,double_val2)" " = 1"
gdb_test "p t_double_values(double_val1,-67.66)" " = 1"
}
gdb_test "p t_string_values(string_val2,string_val1)" " = 0"
gdb_test "p t_string_values(string_val1,string_val2)" " = 1"
gdb_test "p t_string_values(\"string 1\",\"string 2\")" " = 1"
gdb_test "p t_string_values(\"string 1\",string_val2)" " = 1"
gdb_test "p t_string_values(string_val1,\"string 2\")" " = 1"
gdb_test "p t_char_array_values(char_array_val2,char_array_val1)" " = 0"
gdb_test "p t_char_array_values(char_array_val1,char_array_val2)" " = 1"
gdb_test "p t_char_array_values(\"carray 1\",\"carray 2\")" " = 1"
gdb_test "p t_char_array_values(\"carray 1\",char_array_val2)" " = 1"
gdb_test "p t_char_array_values(char_array_val1,\"carray 2\")" " = 1"
gdb_test "p doubleit(4)" " = 8"
gdb_test "p add(4,5)" " = 9"
gdb_test "p t_func_values(func_val2,func_val1)" " = 0"
gdb_test "p t_func_values(func_val1,func_val2)" " = 1"
# On the rs6000, we need to pass the address of the trampoline routine,
# not the address of add itself. I don't know how to go from add to
# the address of the trampoline. Similar problems exist on the HPPA,
# and in fact can present an unsolvable problem as the stubs may not
# even exist in the user's program. We've slightly recoded t_func_values
# to avoid such problems in the common case. This may or may not help
# the RS6000.
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*"
} else {
gdb_test "p t_func_values(add,func_val2)" " = 1"
}
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*"
} else {
gdb_test "p t_func_values(func_val1,doubleit)" " = 1"
}
gdb_test "p t_call_add(func_val1,3,4)" " = 7"
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*"
} else {
gdb_test "p t_call_add(add,3,4)" " = 7"
}
gdb_test "p t_enum_value1(enumval1)" " = 1"
gdb_test "p t_enum_value1(enum_val1)" " = 1"
gdb_test "p t_enum_value1(enum_val2)" " = 0"
gdb_test "p t_enum_value2(enumval2)" " = 1"
gdb_test "p t_enum_value2(enum_val2)" " = 1"
gdb_test "p t_enum_value2(enum_val1)" " = 0"
gdb_test "p sum_args(1,{2})" " = 2"
gdb_test "p sum_args(2,{2,3})" " = 5"
gdb_test "p sum_args(3,{2,3,4})" " = 9"
gdb_test "p sum_args(4,{2,3,4,5})" " = 14"
gdb_test "p sum10 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" " = 55"
gdb_test "p cmp10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)" " = 1"
gdb_test "p t_structs_c(struct_val1)" "= 120 'x'" \
"call inferior func with struct - returns char"
gdb_test "p t_structs_s(struct_val1)" "= 87" \
"call inferior func with struct - returns short"
gdb_test "p t_structs_i(struct_val1)" "= 76" \
"call inferior func with struct - returns int"
gdb_test "p t_structs_l(struct_val1)" "= 51" \
"call inferior func with struct - returns long"
setup_xfail "i*86-*-*"
gdb_test "p t_structs_f(struct_val1)" "= 2.12.*" \
"call inferior func with struct - returns float"
setup_xfail "i*86-*-*"
gdb_test "p t_structs_d(struct_val1)" "= 9.87.*" \
"call inferior func with struct - returns double"
gdb_test "p t_structs_a(struct_val1)" "= (.unsigned char .. )?\"foo\"" \
"call inferior func with struct - returns char *"
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "set print sevenbit-strings" ""
gdb_test "set print address off" ""
gdb_test "set width 0" ""
if { ![set_lang_c] } {
gdb_suppress_tests;
} else {
if { ![runto_main] } {
gdb_suppress_tests;
}
}
gdb_test "next" ".*"
do_function_calls
return 0

View File

@@ -0,0 +1,267 @@
/* Support program for testing gdb's ability to call functions
in an inferior which doesn't itself call malloc, pass appropriate
arguments to those functions, and get the returned result. */
#ifdef NO_PROTOTYPES
#define PARAMS(paramlist) ()
#else
#define PARAMS(paramlist) paramlist
#endif
char char_val1 = 'a';
char char_val2 = 'b';
short short_val1 = 10;
short short_val2 = -23;
int int_val1 = 87;
int int_val2 = -26;
long long_val1 = 789;
long long_val2 = -321;
float float_val1 = 3.14159;
float float_val2 = -2.3765;
double double_val1 = 45.654;
double double_val2 = -67.66;
#define DELTA (0.001)
char *string_val1 = "string 1";
char *string_val2 = "string 2";
char char_array_val1[] = "carray 1";
char char_array_val2[] = "carray 2";
struct struct1 {
char c;
short s;
int i;
long l;
float f;
double d;
char a[4];
} struct_val1 = { 'x', 87, 76, 51, 2.1234, 9.876, "foo" };
/* Some functions that can be passed as arguments to other test
functions, or called directly. */
int add (a, b)
int a, b;
{
return (a + b);
}
int doubleit (a)
int a;
{
return (a + a);
}
int (*func_val1) PARAMS((int,int)) = add;
int (*func_val2) PARAMS((int)) = doubleit;
/* An enumeration and functions that test for specific values. */
enum enumtype { enumval1, enumval2, enumval3 };
enum enumtype enum_val1 = enumval1;
enum enumtype enum_val2 = enumval2;
enum enumtype enum_val3 = enumval3;
t_enum_value1 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val1);
}
t_enum_value2 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val2);
}
t_enum_value3 (enum_arg)
enum enumtype enum_arg;
{
return (enum_arg == enum_val3);
}
/* A function that takes a vector of integers (along with an explicit
count) and returns their sum. */
int sum_args (argc, argv)
int argc;
int argv[];
{
int sumval = 0;
int idx;
for (idx = 0; idx < argc; idx++)
{
sumval += argv[idx];
}
return (sumval);
}
/* Test that we can call functions that take structs and return
members from that struct */
char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); }
short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); }
int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); }
long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); }
float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); }
double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); }
char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); }
/* Test that calling functions works if there are a lot of arguments. */
int
sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9)
int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9;
{
return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9;
}
/* Gotta have a main to be able to generate a linked, runnable
executable, and also provide a useful place to set a breakpoint. */
main ()
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
t_structs_c(struct_val1);
}
/* Functions that expect specific values to be passed and return
either 0 or 1, depending upon whether the values were
passed incorrectly or correctly, respectively. */
int t_char_values (char_arg1, char_arg2)
char char_arg1, char_arg2;
{
return ((char_arg1 == char_val1) && (char_arg2 == char_val2));
}
int
#ifdef NO_PROTOTYPES
t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
char arg1;
short arg2;
int arg3;
char arg4;
short arg5;
char arg6;
short arg7;
int arg8;
short arg9;
short arg10;
#else
t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5,
char arg6, short arg7, int arg8, short arg9, short arg10)
#endif
{
return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10;
}
int t_short_values (short_arg1, short_arg2)
short short_arg1, short_arg2;
{
return ((short_arg1 == short_val1) && (short_arg2 == short_val2));
}
int t_int_values (int_arg1, int_arg2)
int int_arg1, int_arg2;
{
return ((int_arg1 == int_val1) && (int_arg2 == int_val2));
}
int t_long_values (long_arg1, long_arg2)
long long_arg1, long_arg2;
{
return ((long_arg1 == long_val1) && (long_arg2 == long_val2));
}
int t_float_values (float_arg1, float_arg2)
float float_arg1, float_arg2;
{
return ((float_arg1 - float_val1) < DELTA
&& (float_arg1 - float_val1) > -DELTA
&& (float_arg2 - float_val2) < DELTA
&& (float_arg2 - float_val2) > -DELTA);
}
int
#ifdef NO_PROTOTYPES
/* In this case we are just duplicating t_float_values, but that is the
easiest way to deal with either ANSI or non-ANSI. */
t_float_values2 (float_arg1, float_arg2)
float float_arg1, float_arg2;
#else
t_float_values2 (float float_arg1, float float_arg2)
#endif
{
return ((float_arg1 - float_val1) < DELTA
&& (float_arg1 - float_val1) > -DELTA
&& (float_arg2 - float_val2) < DELTA
&& (float_arg2 - float_val2) > -DELTA);
}
int t_double_values (double_arg1, double_arg2)
double double_arg1, double_arg2;
{
return ((double_arg1 - double_val1) < DELTA
&& (double_arg1 - double_val1) > -DELTA
&& (double_arg2 - double_val2) < DELTA
&& (double_arg2 - double_val2) > -DELTA);
}
int t_string_values (string_arg1, string_arg2)
char *string_arg1, *string_arg2;
{
return (!strcmp (string_arg1, string_val1) &&
!strcmp (string_arg2, string_val2));
}
int t_char_array_values (char_array_arg1, char_array_arg2)
char char_array_arg1[], char_array_arg2[];
{
return (!strcmp (char_array_arg1, char_array_val1) &&
!strcmp (char_array_arg2, char_array_val2));
}
/* This used to simply compare the function pointer arguments with
known values for func_val1 and func_val2. Doing so is valid ANSI
code, but on some machines (RS6000, HPPA, others?) it may fail when
called directly by GDB.
In a nutshell, it's not possible for GDB to determine when the address
of a function or the address of the function's stub/trampoline should
be passed.
So, to avoid GDB lossage in the common case, we perform calls through the
various function pointers and compare the return values. For the HPPA
at least, this allows the common case to work.
If one wants to try something more complicated, pass the address of
a function accepting a "double" as one of its first 4 arguments. Call
that function indirectly through the function pointer. This would fail
on the HPPA. */
int t_func_values (func_arg1, func_arg2)
int (*func_arg1) PARAMS ((int, int));
int (*func_arg2) PARAMS ((int));
{
return ((*func_arg1) (5,5) == (*func_val1) (5,5)
&& (*func_arg2) (6) == (*func_val2) (6));
}
int t_call_add (func_arg1, a, b)
int (*func_arg1) PARAMS ((int, int));
int a, b;
{
return ((*func_arg1)(a, b));
}

View File

@@ -0,0 +1,276 @@
# Copyright (C) 1997, 1998 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)
# SAME tests as in callfuncs.exp but here the inferior program does not call malloc.
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
set testfile "callfuncs2"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set prototypes 1
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
set prototypes 0;
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DNO_PROTOTYPES}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# The a29k can't call functions, so don't even bother with this test.
if [target_info exists gdb,cannot_call_functions] {
setup_xfail "*-*-*" 2416
fail "This target can not call functions"
continue
}
# Set the current language to C. This counts as a test. If it
# fails, then we skip the other tests.
proc set_lang_c {} {
global gdb_prompt
send_gdb "set language c\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "set language c (timeout)" ; return 0 }
}
send_gdb "show language\n"
gdb_expect {
-re ".* source language is \"c\".*$gdb_prompt $" {
pass "set language to \"c\""
return 1
}
-re ".*$gdb_prompt $" {
fail "setting language to \"c\""
return 0
}
timeout {
fail "can't show language (timeout)"
return 0
}
}
}
# FIXME: Before calling this proc, we should probably verify that
# we can call inferior functions and get a valid integral value
# returned.
# Note that it is OK to check for 0 or 1 as the returned values, because C
# specifies that the numeric value of a relational or logical expression
# (computed in the inferior) is 1 for true and 0 for false.
proc do_function_calls {} {
global prototypes
global gcc_compiled
# We need to up this because this can be really slow on some boards.
set timeout 60;
gdb_test "p t_char_values(0,0)" " = 0"
gdb_test "p t_char_values('a','b')" " = 1"
gdb_test "p t_char_values(char_val1,char_val2)" " = 1"
gdb_test "p t_char_values('a',char_val2)" " = 1"
gdb_test "p t_char_values(char_val1,'b')" " = 1"
gdb_test "p t_short_values(0,0)" " = 0"
gdb_test "p t_short_values(10,-23)" " = 1"
gdb_test "p t_short_values(short_val1,short_val2)" " = 1"
gdb_test "p t_short_values(10,short_val2)" " = 1"
gdb_test "p t_short_values(short_val1,-23)" " = 1"
gdb_test "p t_int_values(0,0)" " = 0"
gdb_test "p t_int_values(87,-26)" " = 1"
gdb_test "p t_int_values(int_val1,int_val2)" " = 1"
gdb_test "p t_int_values(87,int_val2)" " = 1"
gdb_test "p t_int_values(int_val1,-26)" " = 1"
gdb_test "p t_long_values(0,0)" " = 0"
gdb_test "p t_long_values(789,-321)" " = 1"
gdb_test "p t_long_values(long_val1,long_val2)" " = 1"
gdb_test "p t_long_values(789,long_val2)" " = 1"
gdb_test "p t_long_values(long_val1,-321)" " = 1"
if ![target_info exists gdb,skip_float_tests] {
gdb_test "p t_float_values(0.0,0.0)" " = 0"
# These next four tests fail on the mn10300.
# The first value is passed in regs, the other in memory.
# Gcc emits different stabs for the two parameters; the first is
# claimed to be a float, the second a double.
# dbxout.c in gcc claims this is the desired behavior.
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(3.14159,-2.3765)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(float_val1,float_val2)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(3.14159,float_val2)" " = 1"
setup_xfail "mn10300-*-*"
gdb_test "p t_float_values(float_val1,-2.3765)" " = 1"
# Test passing of arguments which might not be widened.
gdb_test "p t_float_values2(0.0,0.0)" " = 0"
# Although PR 5318 mentions SunOS specifically, this seems
# to be a generic problem on quite a few platforms.
if $prototypes then {
setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318
if {!$gcc_compiled} then {
setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318
}
}
gdb_test "p t_float_values2(3.14159,float_val2)" " = 1"
gdb_test "p t_small_values(1,2,3,4,5,6,7,8,9,10)" " = 55"
gdb_test "p t_double_values(0.0,0.0)" " = 0"
gdb_test "p t_double_values(45.654,-67.66)" " = 1"
gdb_test "p t_double_values(double_val1,double_val2)" " = 1"
gdb_test "p t_double_values(45.654,double_val2)" " = 1"
gdb_test "p t_double_values(double_val1,-67.66)" " = 1"
}
gdb_test "p t_string_values(string_val2,string_val1)" " = 0"
gdb_test "p t_string_values(string_val1,string_val2)" " = 1"
gdb_test "p t_string_values(\"string 1\",\"string 2\")" " = 1"
gdb_test "p t_string_values(\"string 1\",string_val2)" " = 1"
gdb_test "p t_string_values(string_val1,\"string 2\")" " = 1"
gdb_test "p t_char_array_values(char_array_val2,char_array_val1)" " = 0"
gdb_test "p t_char_array_values(char_array_val1,char_array_val2)" " = 1"
gdb_test "p t_char_array_values(\"carray 1\",\"carray 2\")" " = 1"
gdb_test "p t_char_array_values(\"carray 1\",char_array_val2)" " = 1"
gdb_test "p t_char_array_values(char_array_val1,\"carray 2\")" " = 1"
gdb_test "p doubleit(4)" " = 8"
gdb_test "p add(4,5)" " = 9"
gdb_test "p t_func_values(func_val2,func_val1)" " = 0"
gdb_test "p t_func_values(func_val1,func_val2)" " = 1"
# On the rs6000, we need to pass the address of the trampoline routine,
# not the address of add itself. I don't know how to go from add to
# the address of the trampoline. Similar problems exist on the HPPA,
# and in fact can present an unsolvable problem as the stubs may not
# even exist in the user's program. We've slightly recoded t_func_values
# to avoid such problems in the common case. This may or may not help
# the RS6000.
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*"
} else {
gdb_test "p t_func_values(add,func_val2)" " = 1"
}
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*"
} else {
gdb_test "p t_func_values(func_val1,doubleit)" " = 1"
}
gdb_test "p t_call_add(func_val1,3,4)" " = 7"
setup_xfail "rs6000*-*-*"
setup_xfail "powerpc*-*-*"
if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then {
gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*"
} else {
gdb_test "p t_call_add(add,3,4)" " = 7"
}
gdb_test "p t_enum_value1(enumval1)" " = 1"
gdb_test "p t_enum_value1(enum_val1)" " = 1"
gdb_test "p t_enum_value1(enum_val2)" " = 0"
gdb_test "p t_enum_value2(enumval2)" " = 1"
gdb_test "p t_enum_value2(enum_val2)" " = 1"
gdb_test "p t_enum_value2(enum_val1)" " = 0"
gdb_test "p sum_args(1,{2})" " = 2"
gdb_test "p sum_args(2,{2,3})" " = 5"
gdb_test "p sum_args(3,{2,3,4})" " = 9"
gdb_test "p sum_args(4,{2,3,4,5})" " = 14"
gdb_test "p sum10 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)" " = 55"
gdb_test "p t_structs_c(struct_val1)" "= 120 'x'" \
"call inferior func with struct - returns char"
gdb_test "p t_structs_s(struct_val1)" "= 87" \
"call inferior func with struct - returns short"
gdb_test "p t_structs_i(struct_val1)" "= 76" \
"call inferior func with struct - returns int"
gdb_test "p t_structs_l(struct_val1)" "= 51" \
"call inferior func with struct - returns long"
setup_xfail "i*86-*-*"
gdb_test "p t_structs_f(struct_val1)" "= 2.12.*" \
"call inferior func with struct - returns float"
setup_xfail "i*86-*-*"
gdb_test "p t_structs_d(struct_val1)" "= 9.87.*" \
"call inferior func with struct - returns double"
gdb_test "p t_structs_a(struct_val1)" "= (.unsigned char .. )?\"foo\"" \
"call inferior func with struct - returns char *"
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test "set print sevenbit-strings" ""
gdb_test "set print address off" ""
gdb_test "set width 0" ""
if { ![set_lang_c] } {
gdb_suppress_tests;
} else {
if { ![runto_main] } {
gdb_suppress_tests;
}
}
gdb_test "next" ".*"
do_function_calls
return 0

View File

@@ -0,0 +1,248 @@
# Copyright (C) 1988, 1990, 1991, 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
if $tracelevel then {
strace $tracelevel
}
#
# test special commands (if, while, etc)
#
set prms_id 0
set bug_id 0
set testfile "run"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/commands
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
delete_breakpoints
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
proc gdbvar_simple_if_test {} {
global gdb_prompt
gdb_test "set \$foo = 0" "" "set foo in gdbvar_simple_if_test"
# All this test should do is print 0xdeadbeef once.
gdb_test "if \$foo == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xdeadbeef" "gdbvar_simple_if_test #1"
# All this test should do is print 0xfeedface once.
gdb_test "if \$foo == 0\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_if_test #2"
}
proc gdbvar_simple_while_test {} {
global gdb_prompt
gdb_test "set \$foo = 5" "" "set foo in gdbvar_simple_while_test"
# This test should print 0xfeedface five times.
gdb_test "while \$foo > 0\np/x 0xfeedface\nset \$foo -= 1\nend" "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "gdbvar_simple_while_test #1"
}
proc gdbvar_complex_if_while_test {} {
global gdb_prompt
gdb_test "set \$foo = 4" "" "set foo in gdbvar complex_if_while_test"
# This test should alternate between 0xdeadbeef and 0xfeedface two times.
gdb_test "while \$foo > 0\nset \$foo -= 1\nif \(\$foo % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "gdbvar_complex_if_while_test #1"
}
proc progvar_simple_if_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_if_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests; }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #1"
# All this test should do is print 0xdeadbeef once.
gdb_test "if value == 1\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xdeadbeef" "progvar_simple_if_test #1"
# All this test should do is print 0xfeedface once.
gdb_test "if value == 5\np/x 0xfeedface\nelse\np/x 0xdeadbeef\nend" "\\\$\[0-9\]* = 0xfeedface" "progvar_simple_if_test #2"
gdb_stop_suppressing_tests;
}
proc progvar_simple_while_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_while_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test #2"
# This test should print 0xfeedface five times.
gdb_test "while value > 0\np/x 0xfeedface\nset value -= 1\nend" "\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "progvar_simple_while_test #1"
gdb_stop_suppressing_tests;
}
proc progvar_complex_if_while_test {} {
global gdb_prompt
if [target_info exists noargs] {
verbose "Skipping progvar_simple_if_while_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=4" "" "set value to 4 in progvar_simple_if_test"
# This test should alternate between 0xdeadbeef and 0xfeedface two times.
gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "progvar_complex_if_while_test #1"
gdb_stop_suppressing_tests;
}
proc if_while_breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping if_while_breakpoint_command_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=5" "" "set value to 5 in progvar_simple_if_test"
delete_breakpoints
gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #1"
send_gdb "commands\n"
gdb_expect {
-re "End with" {
pass "commands in if_while_breakpoint_command_test"
}
default {
fail "(timeout or eof) commands in if_while_breakpoint_command_test"
}
}
# This test should alternate between 0xdeadbeef and 0xfeedface two times.
gdb_test "while value > 0\nset value -= 1\nif \(value % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" "" "commands part 2 in if_while_breakpoint_command_test"
gdb_test "continue" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "if_while_breakpoint_command_test #1"
gdb_test "info break" "while.*set.*if.*p/x.*else.*p/x.*end.*" "info break in if_while_breakpoint_command_test"
gdb_stop_suppressing_tests;
}
# Test that we can run the inferior from breakpoint commands.
proc infrun_breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping infrun_breakpoint_command_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #1"
delete_breakpoints
gdb_test "break factorial if value == 5" "Breakpoint.*at.*"
# infrun_breakpoint_command_test - This test was broken into two parts
# to get around a synchronization problem in expect.
# part1: issue the gdb command "commands"
# part2: send the list of commands
send_gdb "commands\n"
gdb_expect {
-re "End with" {
pass "commands in infrun_breakpoint_command_test #1"
}
default {
fail "(timeout or eof) commands in infrun_breakpoint_command_test"
}
}
gdb_test "step\nstep\nstep\nstep\nbt\nend" "" \
"commands in infrun_breakpoint_command_test #2"
gdb_test "continue" "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*
\[0-9\]*\[ \]*if \\(value > 1\\) \{.*
\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*
factorial \\(value=4\\) at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*
\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*
factorial \\(value=3\\) at .*
\[0-9\]*\[ \]*if \\(value > 1\\) \{.*
#0 factorial \\(value=3\\).*
#1 \[0-9a-fx\]* in factorial \\(value=4\\).*
#2 \[0-9a-fx\]* in factorial \\(value=5\\).*
#3 \[0-9a-fx\]* in factorial \\(value=6\\).*
#4 \[0-9a-fx\]* in main \\(.*\\).*" \
"continue in infrun_breakpoint_command_test";
gdb_stop_suppressing_tests;
}
proc breakpoint_command_test {} {
if [target_info exists noargs] {
verbose "Skipping breakpoint_command_test because of noargs."
return
}
if { ![runto factorial] } then { gdb_suppress_tests; }
# Don't depend upon argument passing, since most simulators don't currently
# support it. Bash value variable to be what we want.
gdb_test "p value=6" "" "set value to 6 in progvar_simple_if_test #2"
delete_breakpoints
gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2"
gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \
"Type commands.*\nEnd with.*" "commands in breakpoint_command_test"
gdb_test "continue" "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \
"continue in breakpoint_command_test"
gdb_test "print value" " = 5" "print value in breakpoint_command_test"
gdb_stop_suppressing_tests;
}
# Test a simple user defined command (with arguments)
proc user_defined_command_test {} {
global gdb_prompt
gdb_test "set \$foo = 4" "" "set foo in user_defined_command_test"
send_gdb "define mycommand\n"
gdb_expect {
-re "End with" {
pass "define mycommand in user_defined_command_test"
}
default {
fail "(timeout or eof) define mycommand in user_defined_command_test"
}
}
# This test should alternate between 0xdeadbeef and 0xfeedface two times.
gdb_test "while \$arg0 > 0\nset \$arg0 -= 1\nif \(\$arg0 % 2\) == 1\np/x 0xdeadbeef\nelse\np/x 0xfeedface\nend\nend\nend" "" "enter commands in user_defined_command_test"
gdb_test "mycommand \$foo" "\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface\[^\n\]*\n\\\$\[0-9\]* = 0xdeadbeef\[^\n\]*\n\\\$\[0-9\]* = 0xfeedface" "execute user defined command in user_defined_command_test"
gdb_test "show user mycommand" "while.*set.*if.*p/x.*else.*p/x.*end.*" "display user command in user_defined_command_test"
}
gdbvar_simple_if_test
gdbvar_simple_while_test
gdbvar_complex_if_while_test
progvar_simple_if_test
progvar_simple_while_test
progvar_complex_if_while_test
if_while_breakpoint_command_test
infrun_breakpoint_command_test
breakpoint_command_test
user_defined_command_test

View File

@@ -0,0 +1,31 @@
/* Often the behavior of any particular test depends upon what compiler was
used to compile the test. As each test is compiled, this file is
preprocessed by the same compiler used to compile that specific test
(different tests might be compiled by different compilers, particularly
if compiled at different times), and used to generate a *.ci (compiler
info) file for that test.
I.E., when callfuncs is compiled, a callfuncs.ci file will be generated,
which can then be sourced by callfuncs.exp to give callfuncs.exp access
to information about the compilation environment.
TODO: It might be a good idea to add expect code that tests each
definition made with 'set" to see if one already exists, and if so
warn about conflicts if it is being set to something else. */
/* This needs to be kept in sync with whatis.c and gdb.exp(get_compiler_info).
If this ends up being hairy, we could use a common header file. */
#if defined (__STDC__) || defined (_AIX)
set signed_keyword_not_used 0
#else
set signed_keyword_not_used 1
#endif
#if defined (__GNUC__)
set gcc_compiled __GNUC__
#else
set gcc_compiled 0
#endif
return 0

View File

@@ -0,0 +1,568 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite.
#
# tests for command completion
#
# Here are some useful test cases for completion.
# They should be tested with both M-? and TAB.
#
# "show output-" "radix"
# "show output" "-radix"
# "p" ambiguous (commands starting with p--path, print, printf, etc.)
# "p " ambiguous (all symbols)
# "info t foo" no completions
# "info t " no completions
# "info t" ambiguous ("info target", "info terminal", etc.)
# "info ajksdlfk" no completions
# "info ajksdlfk " no completions
# "info" " "
# "info " ambiguous (all info commands)
# "p \"a" no completions (string constant)
# "p 'a" ambiguous (all symbols starting with a)
# "p b-a" ambiguous (all symbols starting with a)
# "p b-" ambiguous (all symbols)
# "file Make" "file" (word break hard to screw up here)
# "file ../gdb.stabs/we" "ird" (needs to not break word at slash)
#
if $tracelevel then {
strace $tracelevel
}
#skip all these tests for now (FIXME)
continue
global usestubs
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "break"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then {
perror "tests suppressed"
}
set oldtimeout1 $timeout
set timeout [expr $timeout + 500]
send_gdb "hfgfh\t"
sleep 1
gdb_expect {
-re "^hfgfh\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Undefined command: \"hfgfh\"\\. Try \"help\"\\..*$gdb_prompt $"\
{ pass "complete 'hfgfh'"}
-re ".*$gdb_prompt $" { fail "complete 'hfgfh'"}
timeout {fail "(timeout) complete 'hfgfh'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'hfgfh'" }
timeout { fail "(timeout) complete 'hfgfh'" }
}
#exp_internal 0
send_gdb "show output\t"
sleep 1
gdb_expect {
-re "^show output-radix $"\
{ send_gdb "\n"
gdb_expect {
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
{ pass "complete 'show output'"}
-re ".*$gdb_prompt $" { fail "complete 'show output'"}
timeout {fail "(timeout) complete 'show output'"}
}
}
-re "^show output$"\
{ send_gdb "\n"
gdb_expect {
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
{ fail "complete 'show output'"}
-re ".*$gdb_prompt $" { fail "complete 'show output'"}
timeout { fail "(timeout) complete 'show output'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'show output'" }
timeout { fail "(timeout) complete 'show output'" }
}
send_gdb "show output-\t"
sleep 1
gdb_expect {
-re "^show output-radix $"\
{ send_gdb "\n"
gdb_expect {
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
{ pass "complete 'show output-'"}
-re ".*$gdb_prompt $" { fail "complete 'show output-'"}
timeout {fail "(timeout) complete 'show output-'"}
}
}
-re "^show output-$"\
{ send_gdb "\n"
gdb_expect {
-re "Default output radix for printing of values is 10\\..*$gdb_prompt $"\
{ fail "complete 'show output-'"}
-re ".*$gdb_prompt $" { fail "complete 'show output-'"}
timeout { fail "(timeout) complete 'show output-'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'show output-'" }
timeout { fail "(timeout) complete 'show output-'" }
}
send_gdb "p\t"
sleep 1
gdb_expect {
-re "^p\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "The history is empty\\..*$gdb_prompt $"\
{ pass "complete 'p'"}
-re ".*$gdb_prompt $" { fail "complete 'p'"}
timeout {fail "(timeout) complete 'p'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'p'" }
timeout { fail "(timeout) complete 'p'" }
}
send_gdb "p \t"
sleep 1
gdb_expect {
-re "^p \\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "The history is empty\\..*$gdb_prompt $"\
{ pass "complete 'p '"}
-re ".*$gdb_prompt $" { fail "complete 'p '"}
timeout {fail "(timeout) complete 'p '"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'p '" }
timeout { fail "(timeout) complete 'p '" }
}
send_gdb "info t foo\t"
sleep 1
gdb_expect {
-re "^info t foo\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Ambiguous info command \"t foo\": target, terminal, threads, tp, tracepoints, types\\..*$gdb_prompt $"\
{ pass "complete 'info t foo'"}
-re ".*$gdb_prompt $" { fail "complete 'info t foo'"}
timeout {fail "(timeout) complete 'info t foo'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info t foo'" }
timeout { fail "(timeout) complete 'info t foo'" }
}
send_gdb "info t\t"
sleep 1
gdb_expect {
-re "^info t\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Ambiguous info command \"t\": target, terminal, threads, tp, tracepoints, types\\..
*$gdb_prompt $"\
{ pass "complete 'info t'"}
-re ".*$gdb_prompt $" { fail "complete 'info t'"}
timeout {fail "(timeout) complete 'info t'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info t'" }
timeout { fail "(timeout) complete 'info t'" }
}
send_gdb "info t \t"
sleep 1
gdb_expect {
-re "^info t \\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Ambiguous info command \"t \": target, terminal, threads, tp, tracepoints, types\\..
*$gdb_prompt $"\
{ pass "complete 'info t '"}
-re ".*$gdb_prompt $" { fail "complete 'info t '"}
timeout {fail "(timeout) complete 'info t '"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info t '" }
timeout { fail "(timeout) complete 'info t '" }
}
send_gdb "info asdfgh\t"
sleep 1
gdb_expect {
-re "^info asdfgh\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Undefined info command: \"asdfgh\". Try \"help info\"\\..
*$gdb_prompt $"\
{ pass "complete 'info asdfgh'"}
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh'"}
timeout {fail "(timeout) complete 'info asdfgh'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh'" }
timeout { fail "(timeout) complete 'info asdfgh'" }
}
send_gdb "info asdfgh \t"
sleep 1
gdb_expect {
-re "^info asdfgh \\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Undefined info command: \"asdfgh \". Try \"help info\"\\..
*$gdb_prompt $"\
{ pass "complete 'info asdfgh '"}
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh '"}
timeout {fail "(timeout) complete 'info asdfgh '"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info asdfgh '" }
timeout { fail "(timeout) complete 'info asdfgh '" }
}
send_gdb "info\t"
sleep 1
gdb_expect {
-re "^info $"\
{ send_gdb "\n"
gdb_expect {
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
{ pass "complete 'info'"}
-re ".*$gdb_prompt $" { fail "complete 'info'"}
timeout {fail "(timeout) complete 'info'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info'" }
timeout { fail "(timeout) complete 'info'" }
}
send_gdb "info \t"
sleep 1
gdb_expect {
-re "^info \\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
{ pass "complete 'info '"}
-re ".*$gdb_prompt $" { fail "complete 'info '"}
timeout {fail "(timeout) complete 'info '"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info '" }
timeout { fail "(timeout) complete 'info '" }
}
send_gdb "info \t"
sleep 1
gdb_expect {
-re "^info \0x7$"\
{ send_gdb "\t"
gdb_expect {
-re "address.*types.*$gdb_prompt info $"\
{ send_gdb "\n"
gdb_expect {
-re "\"info\".*unambiguous\\..*$gdb_prompt $"\
{ pass "complete (2) 'info '"}
-re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
timeout {fail "(timeout) complete (2) 'info '"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'info '"}
timeout {fail "(timeout) complete (2) 'info '"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'info '" }
timeout { fail "(timeout) complete (2) 'info '" }
}
send_gdb "p \"a\t"
sleep 1
gdb_expect {
-re "^p \"a\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Unterminated string in expression\\..*$gdb_prompt $"\
{ pass "complete 'p a'"}
-re ".*$gdb_prompt $" { fail "complete 'p a'"}
timeout {fail "(timeout) complete 'p a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'p \"a'" }
timeout { fail "(timeout) complete 'p \"a'" }
}
send_gdb "p 'a\t"
sleep 1
gdb_expect {
-re "^p 'a\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "Invalid character constant\\..*$gdb_prompt $"\
{ pass "complete 'p \'a'"}
-re ".*$gdb_prompt $" { fail "complete 'p \'a'"}
timeout {fail "(timeout) complete 'p \'a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'p \'a'" }
timeout { fail "(timeout) complete 'p \'a'" }
}
send_gdb "p 'a\t"
sleep 1
gdb_expect {
-re "^p 'a\\\x07$"\
{ send_gdb "\t"
gdb_expect {
-re "a64l.*atol.*$gdb_prompt p .a$"\
{ send_gdb "\n"
gdb_expect {
-re "Invalid character constant\\..*$gdb_prompt $"\
{ pass "complete (2) 'p \'a'"}
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"}
timeout {fail "(timeout) complete (2) 'p \'a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"}
timeout {fail "(timeout) complete (2) 'p \'a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" }
timeout { fail "(timeout) complete (2) 'p \'a'" }
}
send_gdb "p b-a\t"
sleep 1
gdb_expect {
-re "^p b-a\\\x07$"\
{ send_gdb "\n"
gdb_expect {
-re "No symbol \"b\" in current context\\..*$gdb_prompt $"\
{ pass "complete 'p b-a'"}
-re ".*$gdb_prompt $" { fail "complete 'p b-a'"}
timeout {fail "(timeout) complete 'p b-a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'p b-a'" }
timeout { fail "(timeout) complete 'p b-a'" }
}
send_gdb "p b-a\t"
sleep 1
gdb_expect {
-re "^p b-a\\\x07$"\
{ send_gdb "\t"
gdb_expect {
-re "a64l.*atol.*$gdb_prompt p b-a$"\
{ send_gdb "\n"
gdb_expect {
-re "No symbol \"b\" in current context\\..*$gdb_prompt $"\
{ pass "complete (2) 'p b-a'"}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"}
timeout {fail "(timeout) complete (2) 'p b-a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"}
timeout {fail "(timeout) complete (2) 'p b-a'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" }
timeout { fail "(timeout) complete (2) 'p b-a'" }
}
send_gdb "p b-\t"
sleep 1
gdb_expect {
-re "^p b-\\\x07$"\
{ send_gdb "\t"
gdb_expect {
-re "There are $decimal possibilities\\. Do you really\r\nwish to see them all. \\(y or n\\)$"\
{ send_gdb "n"
gdb_expect {
-re "\\(gdb\\) p b-$"\
{ send_gdb "\n"
gdb_expect {
-re "No symbol \"b\" in current context\\..*$gdb_prompt $"\
{ pass "complete (2) 'p b-'"}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"}
timeout {fail "(timeout) complete (2) 'p b-'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"}
timeout {fail "(timeout) complete (2) 'p b-'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"}
timeout {fail "(timeout) complete (2) 'p b-'"}
}
}
-re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" }
timeout { fail "(timeout) complete (2) 'p b-'" }
}
send_gdb "file ${objdir}/Make\t"
sleep 1
gdb_expect {
-re "file ${objdir}/Makefile.*$"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"\
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
{ pass "complete 'file Make'"}
-re ".*$gdb_prompt $" { fail "complete 'file Make'"}
timeout {fail "(timeout) complete 'file Make'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'file Make'"}
timeout {fail "(timeout) complete 'file Make'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'file Make'" }
timeout { fail "(timeout) complete 'file Make'" }
}
send_gdb "file ${srcdir}/gdb.base/a1\t"
sleep 1
gdb_expect {
-re "^file ${srcdir}/gdb.base/.*'a1.*-selftest\\.exp' $"\
{ send_gdb "\n"
gdb_expect {
-re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $"
\
{ send_gdb "n\n"
gdb_expect {
-re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\
{ pass "complete 'file gdb.base/a1'"}
-re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'"}
timeout {fail "(timeout) complete 'file gdb.base/a1'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'"}
timeout {fail "(timeout) complete 'file gdb.base/a1'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'file gdb.base/a1'" }
timeout { fail "(timeout) complete 'file gdb.base/a1'" }
}
send_gdb "info func mark\t"
sleep 1
gdb_expect {
-re "^info func mark.*er$"\
{ send_gdb "\t\t"
sleep 3
gdb_expect {
-re "marker1 marker2 marker3 marker4.*$gdb_prompt info func marker$"\
{ send_gdb "\n"
gdb_expect {
-re "All functions matching regular expression \"marker\":\r\n\r\nFile.*break.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\);\r\n$gdb_prompt $"\
{ pass "complete 'info func mar'"}
-re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
timeout {fail "(timeout) complete 'info func mar'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info func mar'"}
timeout {fail "(timeout) complete 'info func mar'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'info func mar'" }
timeout { fail "(timeout) complete 'info func mar'" }
}
send_gdb "set follow-fork-mode \t\t"
sleep 1
gdb_expect {
-re "ask.*child.*parent.*$gdb_prompt set follow-fork-mode $"\
{ send_gdb "\n"
gdb_expect {
-re "Ambiguous item \"\"\\..*$gdb_prompt $"\
{ pass "complete 'set follow-fork-mode'"}
-re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'"}
timeout {fail "(timeout) complete 'set follow-fork-mode'"}
}
}
-re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'" }
timeout { fail "(timeout) complete 'set follow-fork-mode'" }
}
set timeout $oldtimeout1
return 0

View File

@@ -0,0 +1,122 @@
# Copyright (C) 1998 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 Elena Zannoni (ezannoni@cygnus.com)
# This file is part of the gdb testsuite
#
# test of evaluation of conditional expressions, with constants and
# variables. Using the print and the whatis command
# written with the only purpose in mind to cover the holes in the
# eval.c file
#
# source file "int-type.c"
#
if $tracelevel then {
strace $tracelevel
}
# 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 "int-type"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
send_gdb "print (2 ? 3 : 4)\n"
gdb_expect {
-re ".\[0-9\]* = 3.*$gdb_prompt $" {
pass "print value of cond expr (const true)"
}
-re ".*$gdb_prompt $" { fail "print value of cond expr (const true)" }
timeout { fail "(timeout) print value of cond expr (const true)" }
}
send_gdb "print (0 ? 3 : 4)\n"
gdb_expect {
-re ".\[0-9\]* = 4.*$gdb_prompt $" {
pass "print value of cond expr (const false)"
}
-re ".*$gdb_prompt $" { fail "print value of cond expr (const false)" }
timeout { fail "(timeout) print value of cond expr (const false)" }
}
gdb_test "set variable x=14" "" "set variable x=14"
gdb_test "set variable y=2" "" "set variable y=2"
gdb_test "set variable z=3" "" "set variable z=3"
send_gdb "print (x ? y : z)\n"
gdb_expect {
-re ".\[0-9\]* = 2.*$gdb_prompt $" {
pass "print value of cond expr (var true)"
}
-re ".*$gdb_prompt $" { fail "print value of cond expr (var true)" }
timeout { fail "(timeout) print value of cond expr (var true)" }
}
gdb_test "set variable x=0" "" "set variable x=0"
send_gdb "print (x ? y : z)\n"
gdb_expect {
-re ".\[0-9\]* = 3.*$gdb_prompt $" {
pass "print value of cond expr (var false)"
}
-re ".*$gdb_prompt $" { fail "print value of cond expr (var false)" }
timeout { fail "(timeout) print value of cond expr (var false)" }
}
send_gdb "whatis (0 ? 3 : 4)\n"
gdb_expect {
-re "type = int.*$gdb_prompt $" {
pass "print whatis of cond expr"
}
-re ".*$gdb_prompt $" { fail "print whatis of cond expr" }
timeout { fail "(timeout) print whatis of cond expr" }
}

View File

@@ -0,0 +1,81 @@
#ifdef vxworks
# include <stdio.h>
/* VxWorks does not supply atoi. */
static int
atoi (z)
char *z;
{
int i = 0;
while (*z >= '0' && *z <= '9')
i = i * 10 + (*z++ - '0');
return i;
}
/* I don't know of any way to pass an array to VxWorks. This function
can be called directly from gdb. */
vxmain (arg)
char *arg;
{
char *argv[2];
argv[0] = "";
argv[1] = arg;
main (2, argv, (char **) 0);
}
#else /* ! vxworks */
# include <stdio.h>
#endif /* ! vxworks */
/*
* The following functions do nothing useful. They are included simply
* as places to try setting breakpoints at. They are explicitly
* "one-line functions" to verify that this case works (some versions
* of gcc have or have had problems with this).
*/
int marker1 () { return (0); }
int marker2 (a) int a; { return (1); }
void marker3 (a, b) char *a, *b; {}
void marker4 (d) long d; {}
/*
* This simple classical example of recursion is useful for
* testing stack backtraces and such.
*/
int
main (argc, argv, envp)
int argc;
char *argv[], **envp;
{
#ifdef usestubs
set_debug_traps();
breakpoint();
#endif
if (argc == 123456) {
fprintf (stderr, "usage: factorial <number>\n");
return 1;
}
printf ("%d\n", factorial (atoi ("6")));
marker1 ();
marker2 (43);
marker3 ("stack", "trace");
marker4 (177601976L);
return 0;
}
int factorial (value)
int value;
{
if (value > 1) {
value *= factorial (value - 1);
}
return (value);
}

View File

@@ -0,0 +1,157 @@
# Copyright (C) 1997, 1998 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 test was written by Rich Title.
# Purpose is to test conditional breakpoints.
# Modeled after "break.exp".
if $tracelevel then {
strace $tracelevel
}
global usestubs
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "condbreak"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if [target_info exists gdb_stub] {
gdb_step_for_stub;
}
#
# test break at function
#
gdb_test "break main" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"breakpoint function"
#
# test conditional break at function
#
gdb_test "break marker1 if 1==1" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"break function if condition"
gdb_test "delete 2" \
"" \
"delete break"
#
# test conditional break at line number
#
gdb_test "break 64 if 1==1" \
"Breakpoint.*at.* file .*$srcfile, line 64\\." \
"break line if condition"
gdb_test "delete 3" \
"" \
"delete break"
#
# test conditional break at function
#
gdb_test "break marker1 if (1==1)" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"break function if (condition)"
#
# test conditional break at line number
#
gdb_test "break 64 if (1==1)" \
"Breakpoint.*at.* file .*$srcfile, line 64\\." \
"break line if (condition)"
gdb_test "break marker2 if (a==43)" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
"break function if (condition)"
#
# check to see what breakpoints are set
#
set main_line 60
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker1 at .*$srcfile:41.*
\[\t \]+stop only if 1 == 1.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.*
\[\t \]+stop only if 1 == 1.*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:42.*
\[\t \]+stop only if a == 43.*" \
"breakpoint info"
#
# run until the breakpoint at main is hit. For non-stubs-using targets.
#
gdb_test "run" \
"Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*" \
"run until function breakpoint"
#
# run until the breakpoint at a line number
#
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \
"run until breakpoint set at a line number"
#
# run until the breakpoint at marker1
#
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:41.*41\[\t \]+.*" \
"run until breakpoint at marker1"
#
# run until the breakpoint at marker2
#
gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:42.*42\[\t \]+.*" \
"run until breakpoint at marker2"

899
gdb/testsuite/gdb.base/configure vendored Normal file
View File

@@ -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=a1-selftest.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

View File

@@ -0,0 +1,15 @@
dnl Process this file file with autoconf to produce a configure script.
dnl This file is a shell script fragment that supplies the information
dnl necessary to tailor a template configure script into the configure
dnl script appropriate for this directory. For more information, check
dnl any existing configure script.
AC_PREREQ(2.5)
AC_INIT(a1-selftest.exp)
CC=${CC-cc}
AC_SUBST(CC)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../../..)
AC_CANONICAL_SYSTEM
AC_OUTPUT(Makefile)

View File

@@ -0,0 +1,183 @@
void marker1 (void)
{
}
/* misc. function params */
int
qux1 (const char cc, const char /*&*/ccr, const char *ccp, char *const cpc)
{
return 33;
}
int
qux2 (volatile unsigned char vuc, const volatile int cvi,
volatile short /*&*/vsr, volatile long *vlp, float *volatile fpv,
const volatile signed char *const volatile cvscpcv)
{
return 400;
}
int
main (void)
{
char lave = 'B';
unsigned char lavish = 10;
short lax = 20;
unsigned short lecherous = 30;
long lechery = 40;
unsigned long lectern = 50;
float leeway = 60;
double legacy = 70;
signed char lemonade = 35;
const char laconic = 'A';
const unsigned char laggard = 1;
const short lagoon = 2;
const unsigned short laity = 3;
const long lambent = 4;
const unsigned long laminated = 5;
const float lampoon = 6;
const double languid = 7;
/* pointers to constant variables */
const char *legend = &lave;
const unsigned char *legerdemain = &lavish;
const short *leniency = &lax;
const unsigned short *leonine = &lecherous;
const long *lesion = &lechery;
const unsigned long *lethal = &lectern;
const float *lethargic = &leeway;
const double *levity = &legacy;
/* constant pointers to constant variables */
const char *const lewd = &laconic;
const unsigned char *const lexicographer = &laggard;
const short *const lexicon = &lagoon;
const unsigned short *const liaison = &laity;
const long *const libation = &lambent;
const unsigned long *const libelous = &laminated;
const float *const libertine = &lampoon;
const double *const libidinous = &languid;
/* this is the same as const char * legend .... */
char const *languish = &laconic;
unsigned char const *languor = &laggard;
short const *lank = &lagoon;
unsigned short const *lapidary = &laity;
long const *larceny = &lambent;
unsigned long const *largess = &laminated;
float const *lascivious = &lampoon;
double const *lassitude = &languid;
/* constant pointers to variable */
char *const lamprey = &lave;
unsigned char *const lariat = &lavish;
short *const laudanum = &lax;
unsigned short *const lecithin = &lecherous;
long *const leviathan = &lechery;
unsigned long *const libretto = &lectern;
float *const lissome = &leeway;
double *const locust = &legacy;
/* volatile variables */
volatile char vox = 'X';
volatile unsigned char victuals = 13;
volatile short vixen = 200;
volatile unsigned short vitriol = 300;
volatile long vellum = 1000;
volatile unsigned long valve = 2000;
volatile float vacuity = 3.0;
volatile double vertigo = 10.3;
/* pointers to volatile variables */
volatile char * vampire = &vox;
volatile unsigned char * viper = &victuals;
volatile short * vigour = &vixen;
volatile unsigned short * vapour = &vitriol;
volatile long * ventricle = &vellum;
volatile unsigned long * vigintillion = &valve;
volatile float * vocation = &vacuity;
volatile double * veracity = &vertigo;
/* volatile pointers to volatile variables */
volatile char * volatile vapidity = &vox;
volatile unsigned char * volatile velocity = &victuals;
volatile short * volatile veneer = &vixen;
volatile unsigned short * volatile video = &vitriol;
volatile long * volatile vacuum = &vellum;
volatile unsigned long * volatile veniality = &valve;
volatile float * volatile vitality = &vacuity;
volatile double * volatile voracity = &vertigo;
/* const volatile vars */
const volatile char victor = 'Y';
const volatile unsigned char vicar = 11;
/* pointers to const volatiles */
const volatile char * victory = &victor;
const volatile unsigned char * vicarage = &vicar;
/* const pointers to volatile vars */
volatile char * const vein = &vox;
volatile unsigned char * const vogue = &victuals;
/* const pointers to const volatile vars */
const volatile char * const cavern = &victor;
const volatile unsigned char * const coverlet = &vicar;
/* volatile pointers to const vars */
const char * volatile caveat = &laconic;
const unsigned char * volatile covenant = &laggard;
/* volatile pointers to const volatile vars */
const volatile char * volatile vizier = &victor;
const volatile unsigned char * volatile vanadium = &vicar;
/* const volatile pointers */
char * const volatile vane = &lave;
unsigned char * const volatile veldt = &lavish;
/* const volatile pointers to const vars */
const char * const volatile cove = &laconic;
const unsigned char * const volatile cavity = &laggard;
/* const volatile pointers to volatile vars */
volatile char * const volatile vagus = &vox;
volatile unsigned char * const volatile vagrancy = &victuals;
/* const volatile pointers to const volatile */
const volatile char * const volatile vagary = &victor;
const volatile unsigned char * const volatile vendor = &vicar;
/* misc. references */
/*
const char & radiation = laconic;
volatile signed char & remuneration = lemonade;
*/
#ifdef usestubs
set_debug_traps ();
breakpoint ();
#endif
marker1 ();
return 0;
}

View File

@@ -0,0 +1,251 @@
# Copyright (C) 1997, 1998 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
# written by Elena Zannoni (elz@apollo.hp.com)
#
# This file is part of the gdb testsuite
#
# tests for const variables
# const pointers to vars
# pointers to const variables
# const pointers to const vars
# with mixed types
if $tracelevel then {
strace $tracelevel
}
#
# test running programs
#
set prms_id 0
set bug_id 0
set testfile "constvars"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
#
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
}
send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
send_gdb "cont\n"
gdb_expect {
-re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
send_gdb "up\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "up from marker1" }
}
}
-re "Break.* marker1__.* \\(\\) at .*:$decimal.*$gdb_prompt $" {
fail "continue to marker1 (demangling)"
send_gdb "up\n"
gdb_expect {
-re ".*$gdb_prompt $" {}
timeout { fail "up from marker1" }
}
}
-re "$gdb_prompt $" { fail "continue to marker1" }
timeout { fail "(timeout) continue to marker1" }
}
# test function parameters
if {$gcc_compiled} then { setup_xfail "*-*-*" }
send_gdb "ptype qux1\n"
gdb_expect {
-re "type = int \\(const char, const char &, const char *, char * const\\).*$gdb_prompt $" {
pass "ptype qux1"
}
-re ".*$gdb_prompt $" { fail "ptype qux1" }
timeout { fail "(timeout) ptype qux1" }
}
# test vars and pointers
proc do_constvar_tests {} {
global gcc_compiled
gdb_test "print lave" " = 66 'B'"
gdb_test "ptype lave" "type = char"
gdb_test "print lavish" " = 10 '\\\\n'"
gdb_test "ptype lavish" "type = unsigned char"
gdb_test "print lax" " = 20"
gdb_test "ptype lax" "type = short.*"
gdb_test "print lecherous" " = 30"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lecherous" "type = unsigned short.*"
gdb_test "print lechery" " = 40"
gdb_test "ptype lechery" "type = long.*"
gdb_test "print lectern" " = 50"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lectern" "type = unsigned long.*"
gdb_test "print leeway" " = 60"
gdb_test "ptype leeway" "type = float"
gdb_test "print legacy" " = 70"
gdb_test "ptype legacy" "type = double"
gdb_test "print laconic" " = 65 'A'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype laconic" "type = const char"
gdb_test "print laggard" " = 1 '.001'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype laggard" "type = const unsigned char"
gdb_test "print lagoon" " = 2"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lagoon" "type = const short"
gdb_test "print laity" " = 3"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype laity" "type = const unsigned short"
gdb_test "print lambent" " = 4"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lambent" "type = const long"
gdb_test "print laminated" " = 5"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype laminated" "type = const unsigned long"
gdb_test "print lampoon" " = 6"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lampoon" "type = const float"
gdb_test "print languid" " = 7"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype languid" "type = const double"
gdb_test "print *legend" " = 66 'B'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype legend" "type = const char *"
gdb_test "print *legerdemain" " = 10 '\\\\n'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype legerdemain" "type = const unsigned char *"
gdb_test "print *leniency" " = 20"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype leniency" "type = const short *"
gdb_test "print *leonine" " = 30"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype leonine" "type = const unsigned short *"
gdb_test "print *lesion" " = 40"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lesion" "type = const long *"
gdb_test "print *lethal" " = 50"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lethal" "type = const unsigned long *"
gdb_test "print *lethargic" " = 60"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lethargic" "type = const float *"
gdb_test "print *levity" " = 70"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype levity" "type = const double *"
gdb_test "print *lewd" " = 65 'A'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lewd" "type = const char * const"
gdb_test "print *lexicographer" " = 1 '.001'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lexicographer" "type = const unsigned char * const"
gdb_test "print *lexicon" " = 2"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lexicon" "type = const short * const"
gdb_test "print *liaison" " = 3"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype liaison" "type = const unsigned short * const"
gdb_test "print *libation" " = 4"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype libation" "type = const long * const"
gdb_test "print *libelous" " = 5"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype libelous" "type = const unsigned long * const"
gdb_test "print *libertine" " = 6"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype libertine" "type = const float * const"
gdb_test "print *libidinous" " = 7"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype libidinous" "type = const double * const"
gdb_test "print *languish" " = 65 'A'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype languish" "type = const char *"
gdb_test "print *languor" " = 1 '.001'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype languor" "type = const unsigned char *"
gdb_test "print *lank" " = 2"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lank" "type = const short *"
gdb_test "print *lapidary" " = 3"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lapidary" "type = const unsigned short *"
gdb_test "print *larceny" " = 4"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype larceny" "type = const long *"
gdb_test "print *largess" " = 5"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype largess" "type = const unsigned long *"
gdb_test "print *lascivious" " = 6"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lascivious" "type = const float *"
gdb_test "print *lassitude" " = 7"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lassitude" "type = const double *"
gdb_test "print *lamprey" " = 66 'B'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lamprey" "type = char * const"
gdb_test "print *lariat" " = 10 '\\\\n'"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lariat" "type = unsigned char * const"
gdb_test "print *laudanum" " = 20"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype laudanum" "type = short * const"
gdb_test "print *lecithin" " = 30"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lecithin" "type = unsigned short * const"
gdb_test "print *leviathan" " = 40"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype leviathan" "type = long * const"
gdb_test "print *libretto" " = 50"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype libretto" "type = unsigned long * const"
gdb_test "print *lissome" " = 60"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype lissome" "type = float * const"
gdb_test "print *locust" " = 70"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype locust" "type = double * const"
if {$gcc_compiled} then { setup_xfail "*-*-*" }
gdb_test "ptype radiation" "type = const char &"
}
do_constvar_tests

View File

@@ -0,0 +1,223 @@
# Copyright (C) 1992, 1993, 1994, 1995, 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 Fred Fish. (fnf@cygnus.com)
if $tracelevel then {
strace $tracelevel
}
set prms_id 0
set bug_id 0
# are we on a target board
if ![isnative] then {
return
}
set testfile "coremaker"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info ${binfile}] {
return -1;
}
# Create a core file named "corefile" rather than just "core", to
# avoid problems with sys admin types that like to regularly prune all
# files named "core" from the system.
#
# Arbitrarily try setting the core size limit to "unlimited" since
# this does not hurt on systems where the command does not work and
# allows us to generate a core on systems where it does.
#
# Some systems append "core" to the name of the program; others append
# the name of the program to "core".
set found 0
catch "system \"(cd ${objdir}/${subdir}; ulimit -c unlimited; ${binfile}; true) >/dev/null 2>&1\""
# remote_exec host "${binfile}"
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
if [remote_file build exists $i] {
remote_exec build "mv $i ${objdir}/${subdir}/corefile"
set found 1
}
}
if { $found == 0 } {
# The braindamaged HPUX shell quits after the ulimit -c above
# without executing ${binfile}. So we try again without the
# ulimit here if we didn't find a core file above.
# Oh, I should mention that any "braindamaged" non-Unix system has
# the same problem. I like the cd bit too, it's really neat'n stuff.
catch "system \"(cd ${objdir}/${subdir}; ${binfile}; true) >/dev/null 2>&1\""
foreach i "${objdir}/${subdir}/core ${objdir}/${subdir}/core.coremaker.c ${binfile}.core" {
if [remote_file build exists $i] {
remote_exec build "mv $i ${objdir}/${subdir}/corefile"
set found 1
}
}
if { $found == 0 } {
warning "can't generate a core file - core tests suppressed - check ulimit -c"
return 0
}
}
#
# Test that we can simply startup with a "-core=corefile" command line arg
# and recognize that the core file is a valid, usable core file.
# To do this, we must shutdown the currently running gdb and restart
# with the -core args. We can't use gdb_start because it looks for
# the first gdb prompt, and the message we are looking for occurs
# before the first prompt. Also, we can't include GDBFLAGS because
# if it is empty, this confuses gdb with an empty argument that it
# grumbles about (said grumbling currently being ignored in gdb_start).
# **FIXME**
#
# Another problem is that on some systems (solaris for example), there
# is apparently a limit on the length of a fully specified path to
# the coremaker executable, at about 80 chars. For this case, consider
# it a pass, but note that the program name is bad.
gdb_exit
if $verbose>1 then {
send_user "Spawning $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile\n"
}
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
verbose "Timeout is now $timeout seconds" 2
eval "spawn $GDB -nw $GDBFLAGS -core=$objdir/$subdir/corefile"
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: -core=corefile"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: -core=corefile (with bad program name)"
}
-re ".*registers from core file: File in wrong format.* $" {
fail "args: -core=corefile (could not read registers from core file)"
}
-re ".*$gdb_prompt $" { fail "args: -core=corefile" }
timeout { fail "(timeout) starting with -core" }
}
#
# Test that startup with both an executable file and -core argument.
# See previous comments above, they are still applicable.
#
close;
if $verbose>1 then {
send_user "Spawning $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile\n"
}
eval "spawn $GDB -nw $GDBFLAGS $binfile -core=$objdir/$subdir/corefile";
expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: execfile -core=corefile"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: execfile -core=corefile (with bad program name)"
}
-re ".*registers from core file: File in wrong format.* $" {
fail "args: execfile -core=corefile (could not read registers from core file)"
}
-re ".*$gdb_prompt $" { fail "args: execfile -core=corefile" }
timeout { fail "(timeout) starting with -core" }
}
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
close;
# Now restart normally.
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Test basic corefile recognition via core-file command.
send_gdb "core-file $objdir/$subdir/corefile\n"
gdb_expect {
-re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command (with bad program name)"
}
-re ".*registers from core file: File in wrong format.* $" {
fail "core-file command (could not read registers from core file)"
}
-re ".*$gdb_prompt $" { fail "core-file command" }
timeout { fail "(timeout) core-file command" }
}
# Test correct mapping of corefile sections by printing some variables.
gdb_test "print coremaker_data" "\\\$$decimal = 202"
gdb_test "print coremaker_bss" "\\\$$decimal = 10"
gdb_test "print coremaker_ro" "\\\$$decimal = 201"
if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" }
gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}"
# Somehow we better test the ability to read the registers out of the core
# file correctly. I don't think the other tests do this.
gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp"
# Test ability to read mmap'd data
gdb_test "x/8bd buf1" ".*:.*0.*1.*2.*3.*4.*5.*6.*7" "accessing original mmap data in core file"
setup_xfail "*-*-sunos*" "*-*-ultrix*" "*-*-aix*"
send_gdb "x/8bd buf2\n"
gdb_expect {
-re ".*:.*0.*1.*2.*3.*4.*5.*6.*7.*$gdb_prompt $" {
pass "accessing mmapped data in core file"
}
-re "0x\[f\]*:.*Cannot access memory at address 0x\[f\]*.*$gdb_prompt $" {
fail "accessing mmapped data (mapping failed at runtime)"
}
-re "0x.*:.*Cannot access memory at address 0x.*$gdb_prompt $" {
fail "accessing mmapped data (mapping address not found in core file)"
}
-re ".*$gdb_prompt $" {
fail "accessing mmapped data (incorrect data found in core file)"
}
timeout {
fail "accessing mmapped data (timeout)"
}
}
# test reinit_frame_cache
gdb_load ${binfile}
setup_xfail "*-*-*"
gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp"
gdb_test "core" "No core file now."

View File

@@ -0,0 +1,120 @@
/* Simple little program that just generates a core dump from inside some
nested function calls. */
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <signal.h>
#ifndef __STDC__
#define const /**/
#endif
#define MAPSIZE (8 * 1024)
/* Don't make these automatic vars or we will have to walk back up the
stack to access them. */
char *buf1;
char *buf2;
int coremaker_data = 1; /* In Data section */
int coremaker_bss; /* In BSS section */
const int coremaker_ro = 201; /* In Read-Only Data section */
/* Note that if the mapping fails for any reason, we set buf2
to -1 and the testsuite notices this and reports it as
a failure due to a mapping error. This way we don't have
to test for specific errors when running the core maker. */
void
mmapdata ()
{
int j, fd;
extern void *malloc ();
/* Allocate and initialize a buffer that will be used to write
the file that is later mapped in. */
buf1 = (char *) malloc (MAPSIZE);
for (j = 0; j < MAPSIZE; ++j)
{
buf1[j] = j;
}
/* Write the file to map in */
fd = open ("coremmap.data", O_CREAT | O_RDWR, 0666);
if (fd == -1)
{
perror ("coremmap.data open failed");
buf2 = (char *) -1;
return;
}
write (fd, buf1, MAPSIZE);
/* Now map the file into our address space as buf2 */
buf2 = (char *) mmap (0, MAPSIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (buf2 == (char *) -1)
{
perror ("mmap failed");
return;
}
/* Verify that the original data and the mapped data are identical.
If not, we'd rather fail now than when trying to access the mapped
data from the core file. */
for (j = 0; j < MAPSIZE; ++j)
{
if (buf1[j] != buf2[j])
{
fprintf (stderr, "mapped data is incorrect");
buf2 = (char *) -1;
return;
}
}
}
void
func2 ()
{
int coremaker_local[5];
int i;
#ifdef SA_FULLDUMP
/* Force a corefile that includes the data section for AIX. */
{
struct sigaction sa;
sigaction (SIGABRT, (struct sigaction *)0, &sa);
sa.sa_flags |= SA_FULLDUMP;
sigaction (SIGABRT, &sa, (struct sigaction *)0);
}
#endif
/* Make sure that coremaker_local doesn't get optimized away. */
for (i = 0; i < 5; i++)
coremaker_local[i] = i;
coremaker_bss = 0;
for (i = 0; i < 5; i++)
coremaker_bss += coremaker_local[i];
coremaker_data = coremaker_ro + 1;
abort ();
}
void
func1 ()
{
func2 ();
}
main ()
{
mmapdata ();
func1 ();
}

Some files were not shown because too many files have changed in this diff Show More