old-cross-binutils/gdb/testsuite/gdb.cp/gdb2495.exp
Tom Tromey f5f3a911ec * gdb.cp/abstract-origin.exp: Use standard_testfile.
* gdb.cp/ambiguous.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/annota2.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/annota3.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/anon-ns.exp: Use standard_testfile.
	* gdb.cp/anon-struct.exp: Use standard_testfile.
	* gdb.cp/anon-union.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/arg-reference.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/bool.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/breakpoint.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/bs15503.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/call-c.exp: Use standard_testfile, clean_restart,
	standard_output_file.
	* gdb.cp/casts.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/class2.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/classes.exp: Use standard_testfile, prepare_for_testing.
	(test_static_members): Update.
	* gdb.cp/cmpd-minsyms.exp: Use standard_testfile.
	* gdb.cp/converts.exp: Use standard_testfile.
	* gdb.cp/cp-relocate.exp: Use standard_testfile.
	* gdb.cp/cpcompletion.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/cpexprs.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/cplabel.exp: Use standard_testfile.
	* gdb.cp/cplusfuncs.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/ctti.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/derivation.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/destrprint.exp: Use standard_testfile.
	* gdb.cp/dispcxx.exp: Use standard_testfile.
	* gdb.cp/exception.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/expand-psymtabs-cxx.exp: Use standard_testfile.
	* gdb.cp/extern-c.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/formatted-ref.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/fpointer.exp: Use standard_testfile.
	* gdb.cp/gdb1355.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/gdb2384.exp: Use standard_testfile, clean_restart,
	standard_output_file.
	* gdb.cp/gdb2495.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/hang.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/infcall-dlopen.exp: Use standard_testfile,
	standard_output_file.
	* gdb.cp/inherit.exp: Use standard_testfile, prepare_for_testing.
	(do_tests): Update.
	* gdb.cp/koenig.exp: Use standard_testfile.
	* gdb.cp/local.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/m-data.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/m-static.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/mb-ctor.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/mb-inline.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/mb-templates.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/member-ptr.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/meth-typedefs.exp: Use standard_testfile.
	* gdb.cp/method.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/method2.exp: Use standard_testfile.
	* gdb.cp/minsym-fallback.exp: Use standard_testfile,
	standard_output_file.
	* gdb.cp/misc.exp: Use standard_testfile, prepare_for_testing.
	(do_tests): Update.
	* gdb.cp/namespace-enum.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/namespace-nested-import.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/namespace.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/nextoverthrow.exp: Use standard_testfile.
	* gdb.cp/no-dmgl-verbose.exp: Use standard_testfile.
	* gdb.cp/nsdecl.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/nsimport.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/nsnested.exp: Use standard_testfile.
	* gdb.cp/nsnoimports.exp: Use standard_testfile.
	* gdb.cp/nsrecurs.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/nsstress.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/nsusing.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/operator.exp: Use standard_testfile.
	* gdb.cp/oranking.exp: Use standard_testfile.
	* gdb.cp/overload-const.exp: Use standard_testfile.
	* gdb.cp/overload.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/ovldbreak.exp: Use standard_testfile.
	* gdb.cp/ovsrch.exp: Use standard_testfile.
	* gdb.cp/paren-type.exp: Use standard_testfile.
	* gdb.cp/pass-by-ref.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/pr-1023.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/pr-1210.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/pr-574.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/pr10687.exp: Use standard_testfile, clean_restart.
	* gdb.cp/pr10728.exp: Use standard_testfile,
	standard_output_file.
	* gdb.cp/pr12028.exp: Use standard_testfile.
	* gdb.cp/pr9067.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/pr9167.exp: Use standard_testfile.
	* gdb.cp/pr9631.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/printmethod.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/psmang.exp: Use standard_testfile, clean_restart.
	* gdb.cp/psymtab-parameter.exp: Use standard_testfile.
	* gdb.cp/ptype-cv-cp.exp: Use standard_testfile.
	* gdb.cp/re-set-overloaded.exp: Use standard_testfile,
	standard_output_file.
	* gdb.cp/readnow-language.exp: Use standard_testfile.
	* gdb.cp/ref-params.exp: Use standard_testfile, build_executable.
	(gdb_start_again): Use clean_restart.
	* gdb.cp/ref-types.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/rtti.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/shadow.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/smartp.exp: Use standard_testfile.
	* gdb.cp/static-method.exp: Use standard_testfile.
	* gdb.cp/static-print-quit.exp: Use standard_testfile.
	* gdb.cp/temargs.exp: Use standard_testfile.
	* gdb.cp/templates.exp: Use standard_testfile,
	prepare_for_testing.
	(do_tests): Update.
	* gdb.cp/try_catch.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/typedef-operator.exp: Use standard_testfile.
	* gdb.cp/userdef.exp: Use standard_testfile, prepare_for_testing.
	* gdb.cp/virtbase.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.cp/virtfunc.exp: Use standard_testfile,
	prepare_for_testing.
	(do_tests): Update.
	* gdb.cp/virtfunc2.exp: Use standard_testfile,
	prepare_for_testing.
2012-07-10 15:18:18 +00:00

154 lines
5.3 KiB
Text

# Copyright 2009-2012 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 3 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, see <http://www.gnu.org/licenses/>.
# In gdb inferior function calls, if a C++ exception is raised in the
# dummy-frame, and the exception handler is (normally, and expected to
# be) out-of-frame, the default C++ handler will (wrongly) be called
# in an inferior function call.
# This is incorrect as an exception can normally and legally be handled
# out-of-frame. The confines of the dummy frame prevent the unwinder
# from finding the correct handler (or any handler, unless it is
# in-frame). The default handler calls std::terminate. This will kill
# the inferior. Assert that terminate should never be called in an
# inferior function call. These tests test the functionality around
# unwinding that sequence and also tests the flag behaviour gating this
# functionality.
#
# PR c++/9600.
# This test is largely based of gdb.base/callfuncs.exp.
if { [skip_cplus_tests] } { continue }
if [target_info exists gdb,nosignals] {
verbose "Skipping gdb2495.exp because of nosignals."
continue
}
# On SPU this test fails because the executable exceeds local storage size.
if { [istarget "spu*-*-*"] } {
return 0
}
standard_testfile .cc
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info "c++"] {
return -1
}
# Some targets can't do function calls, 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
}
if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
return -1
}
if ![runto_main] then {
perror "couldn't run to main"
continue
}
# See http://sourceware.org/gdb/bugs/2495
# Test normal baseline behaviour. Call a function that
# does not raise an exception.
gdb_test "p exceptions.no_throw_function()" " = 1"
# And one that does but handles it in-frame.
gdb_test "p exceptions.throw_function_with_handler()" " = 2"
# Both should return normally.
# Test basic unwind. Call a function that raises an exception but
# does not handle it. It should be rewound.
gdb_test "p exceptions.throw_function()" \
"The program being debugged entered a std::terminate call, .*" \
"Call a function that raises an exception without a handler."
# Make sure that after rewinding we are back at the call parent.
gdb_test "bt" \
"#0 main.*" \
"bt after returning from a popped frame"
# Make sure the only breakpoint is the one set via the runto_main
# call and that the std::terminate breakpoint has evaporated and
# cleaned-up.
gdb_test "info breakpoints" \
"gdb2495\.cc.*"
# Turn off this new behaviour.
gdb_test_multiple "set unwind-on-terminating-exception off" \
"Turn unwind-on-terminating-exception off" {
-re "$gdb_prompt $" {pass "set unwinn-on-terminating-exception off"}
timeout {fail "(timeout) set unwind-on-terminating-exception off"}
}
# Check that it is turned off.
gdb_test "show unwind-on-terminating-exception" \
"exception is unhandled while in a call dummy is off.*" \
"Turn off unwind on terminating exception flag"
# Check that the old behaviour is restored.
gdb_test "p exceptions.throw_function()" \
"The program being debugged was signaled while in a function called .*" \
"Call a function that raises an exception with unwinding off.."
# Restart the inferior back at main.
if ![runto_main] then {
perror "couldn't run to main"
continue
}
# Check to see if the new behaviour alters the unwind signal
# behaviour; it should not. Test both on and off states.
# Turn on unwind on signal behaviour.
gdb_test_multiple "set unwindonsignal on" "Turn unwindonsignal on" {
-re "$gdb_prompt $" {pass "set unwindonsignal on"}
timeout {fail "(timeout) set unwindonsignal on"}
}
# Check that it is turned on.
gdb_test "show unwindonsignal" \
"signal is received while in a call dummy is on.*" \
"Turn on unwind on signal"
# Check to see if new behaviour interferes with
# normal signal handling in inferior function calls.
gdb_test "p exceptions.raise_signal(1)" \
"To change this behavior use \"set unwindonsignal off\".*"
# And reverse - turn off again.
gdb_test_multiple "set unwindonsignal off" "Turn unwindonsignal off" {
-re "$gdb_prompt $" {pass "set unwindonsignal off"}
timeout {fail "(timeout) set unwindonsignal off"}
}
# Check that it is actually turned off.
gdb_test "show unwindonsignal" \
"signal is received while in a call dummy is off.*" \
"Turn off unwind on signal"
# Check to see if new behaviour interferes with
# normal signal handling in inferior function calls.
gdb_test "p exceptions.raise_signal(1)" \
"To change this behavior use \"set unwindonsignal on\".*"