diff options
author | Fred Fish <fnf@specifix.com> | 1995-11-25 19:55:29 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1995-11-25 19:55:29 +0000 |
commit | 782445c7aa2722092434b23adfb27e27acfd9e06 (patch) | |
tree | 055b2886c76b645574a00b03c3aee2fe95373e00 /gdb/testsuite/gdb.base/return.exp | |
parent | 9b041f69fc5372c05d5d8a067d8263c12c2a3abb (diff) | |
download | fsf-binutils-gdb-782445c7aa2722092434b23adfb27e27acfd9e06.zip fsf-binutils-gdb-782445c7aa2722092434b23adfb27e27acfd9e06.tar.gz fsf-binutils-gdb-782445c7aa2722092434b23adfb27e27acfd9e06.tar.bz2 |
From Rob Savoye (rob@poseidon.cygnus.com)
* Makefile.in, configure.in, gdb.base/{Makefile.in, configure.in},
gdb.c++/{Makefile.in, configure.in}, gdb.chill/{Makefile.in, configure.in},
gdb.disasm/{Makefile.in, configure.in}, gdb.stabs/{Makefile.in, configure.in},
gdb.threads/{Makefile.in, configure.in}: Major reworking for autoconfig.
* aclocal.m4, configure, gdb.base/configure, gdb.c++/configure,
gdb.disasm/configure, gdb.stabs/configure, gdb.stabs/default.mt : New files.
* config/unix-gdb.exp: Make GDB global.
* gdb.base/{a1-selftest.exp, a2-run.exp,bitfields.exp, break.exp, callfuncs.exp,
commands.exp, corefile.exp, crossload.exp, exprs.exp, funcargs.exp, interrupt.exp,
langs.exp, list.exp, mips_pro.exp, nodebug.exp, opaque.exp, printcmds.exp,
ptype.exp, recurse.exp, regs.exp, return.exp, scope.exp, setvar.exp, sigall.exp,
signals.exp, term.exp, twice.exp, watchpoint.exp, whatis.exp},
gdb.c++/{classes.exp, callfuncs.exp, inherit.exp, misc.exp, templates.exp,
virtfunc.exp}, gdb.chill/{callch.exp, chillvars.exp, misc.exp, pr-4975.exp,
pr-5016.exp, pr-5020.exp, pr-5022.exp, pr-5646.exp, pr-5984.exp, pr-6292.exp,
pr-6632.exp, pr-8134.exp, pr-8136.exp, result.exp, string.exp, tuples.exp},
gdb.disasm/{hppa.exp, sh3.exp}, gdb.stabs/weird.exp: Change continues
to returns as necessary, arrange for test to compile own testcase executable.
* lib/gdb.exp: Changes for testsuite to compile own test cases.
From Fred Fish (fnf@cygnus.com)
* gdb.c++/classes.exp (test_pointers_to_class_members): Add
clear_xfail at end of test which might not call either pass or fail.
* gdb.base/a1-selftest.exp: Add i*86-*-linuxaout xfail for
"backtrace through signal handler".
Diffstat (limited to 'gdb/testsuite/gdb.base/return.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/return.exp | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/return.exp b/gdb/testsuite/gdb.base/return.exp new file mode 100644 index 0000000..620e5b6 --- /dev/null +++ b/gdb/testsuite/gdb.base/return.exp @@ -0,0 +1,124 @@ +# Copyright (C) 1992 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 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 Jeff Law. (law@cs.utah.edu) + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "return" +set srcfile ${srcdir}/$subdir/${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [compile "${srcfile} -g -o ${binfile}"] != "" } { + perror "Couldn't compile ${srcfile}" + return -1 +} + +proc return_tests { } { + global prompt + + + if { ! [ runto func1 ] } then { return 0 } + send "return\n" + expect { + -re "Make .* return now.*y or n. $" { + send "y\n" + exp_continue + } + -re "func1 ..;.*$prompt $" { + send "step\n" + exp_continue + } + -re ".*in main after func1.*$prompt $" { pass "simple return" } + -re "$prompt $" { fail "simple return" } + timeout { fail "(timeout) simple return" } + } + + # Set breakpoints in other interesting functions. + send "break func2\n" ; expect -re ".*$prompt $" + send "break func3\n" ; expect -re ".*$prompt $" + + gdb_test "continue" "return -5;" + send "return 5\n" + expect { + -re "Make .* return now.*y or n. $" { + send "y\n" + exp_continue + } + -re ".*tmp2 = func2.*$prompt $" { } + -re "$prompt $" { fail "did not return (integer test)" } + timeout { fail "(timeout) did not return (integer test)" } + } + gdb_test "next" "tmp3 = func3.*" "next over call to func2" + + gdb_test "p tmp2" ".* = 5" "correct value returned (integer test)" + + gdb_test "continue" "return -5.0;" + send "return 5.0\n" + expect { + -re "Make .* return now.*y or n. $" { + send "y\n" + exp_continue + } + -re ".*tmp3 = func3.*$prompt $" { } + -re "$prompt $" { fail "did not return (double test)" } + timeout { fail "(timeout) did not return (double test)" } + } + + gdb_test "next" "printf.*" "next over call to func3" + + # This test is going to fail on all i*86 systems using an i*87. + # When returning a floating point value from a function, all known + # compilers do this via a `fldl' instruction, which pushes the floating + # value on the i387 stack. This causes two problems: + # a) Most i*86 targets do not store (or cannot store, see comment in + # in i386v-nat.c:i386_register_u_addr) the floating point registers + # to the target. + # b) gdb would have to figure out if the `fldl' instruction (or variants + # of it) has already been executed. If not, it would have to simulate + # a push instruction, as it is not enough to write the register, + # the floating point `stack pointer' has to be updated too. + # Do not expect this to get fixed anytime soon. + + # This test also fails for sparc Solaris 2.3 & 2.4, but passes under 2.5 + # At the time the `next' is issued, the floating point unit for the + # process is not yet initialized, and the storing of the floating + # point value to the floating point return register is ignored. + # Xfail it for current versions that are known to fail. Presumably + # if some future version does initialize the floating point unit at + # process start, making this test pass, it will be for a version that + # is not xfailed. + + setup_xfail "i*86-*-*" "sparc-*-solaris2.3*" "sparc-*-solaris2.4*" + gdb_test "p tmp3" ".* = 5" "correct value returned double test (known problem with i*86 and sparc solaris" +} + + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +return_tests |