- Archer update to the snapshot: 05c402a02716177c4ddd272a6e312cbd2908ed68
- Archer backport: 05c402a02716177c4ddd272a6e312cbd2908ed68 - Remove the [archer-pmuldoon-exception-rewind-master] branch. - Include this functionality as a FSF GDB accepted patchset.
This commit is contained in:
parent
bcdbb34cad
commit
f51c5abf98
471
gdb-6.8.50.20090302-upstream.patch
Normal file
471
gdb-6.8.50.20090302-upstream.patch
Normal file
@ -0,0 +1,471 @@
|
|||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00076.html
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* infcall.c (show_unwind_on_terminating_exception_p): New
|
||||||
|
function.
|
||||||
|
(call_function_by_hand): Create breakpoint and clean-up call for
|
||||||
|
std::terminate.breakpoint. Add unwind_on_terminating_exception_p
|
||||||
|
gate. Pop frame on breakpoint hit.
|
||||||
|
(_initialize_infcall): Add add_setshow_boolean_cmd for
|
||||||
|
unwind-on-terminating-exception.
|
||||||
|
|
||||||
|
gdb/doc/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* doc/gdb.texinfo (Calling): Document
|
||||||
|
set-unwind-on-terminating-exception usage.
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* gdb.cp/gdb2495.cc: New file.
|
||||||
|
* gdb.cp/gdb2495.exp: New file.
|
||||||
|
|
||||||
|
--- src/gdb/infcall.c 2009/05/28 00:53:51 1.114
|
||||||
|
+++ src/gdb/infcall.c 2009/06/15 12:11:36 1.115
|
||||||
|
@@ -98,6 +98,30 @@
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* This boolean tells what gdb should do if a std::terminate call is
|
||||||
|
+ made while in a function called from gdb (call dummy).
|
||||||
|
+ As the confines of a single dummy stack prohibit out-of-frame
|
||||||
|
+ handlers from handling a raised exception, and as out-of-frame
|
||||||
|
+ handlers are common in C++, this can lead to no handler being found
|
||||||
|
+ by the unwinder, and a std::terminate call. This is a false positive.
|
||||||
|
+ If set, gdb unwinds the stack and restores the context to what it
|
||||||
|
+ was before the call.
|
||||||
|
+
|
||||||
|
+ The default is to unwind the frame if a std::terminate call is
|
||||||
|
+ made. */
|
||||||
|
+
|
||||||
|
+static int unwind_on_terminating_exception_p = 1;
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty,
|
||||||
|
+ struct cmd_list_element *c,
|
||||||
|
+ const char *value)
|
||||||
|
+
|
||||||
|
+{
|
||||||
|
+ fprintf_filtered (file, _("\
|
||||||
|
+Unwind stack if a C++ exception is unhandled while in a call dummy is %s.\n"),
|
||||||
|
+ value);
|
||||||
|
+}
|
||||||
|
|
||||||
|
/* Perform the standard coercions that are specified
|
||||||
|
for arguments to be passed to C or Ada functions.
|
||||||
|
@@ -416,6 +440,8 @@
|
||||||
|
struct cleanup *args_cleanup;
|
||||||
|
struct frame_info *frame;
|
||||||
|
struct gdbarch *gdbarch;
|
||||||
|
+ struct breakpoint *terminate_bp = NULL;
|
||||||
|
+ struct minimal_symbol *tm;
|
||||||
|
ptid_t call_thread_ptid;
|
||||||
|
struct gdb_exception e;
|
||||||
|
const char *name;
|
||||||
|
@@ -716,6 +742,27 @@
|
||||||
|
bpt->disposition = disp_del;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Create a breakpoint in std::terminate.
|
||||||
|
+ 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 wrong, as an exception can be normally
|
||||||
|
+ and legally 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. Place a momentary breakpoint in the std::terminate function
|
||||||
|
+ and if triggered in the call, rewind. */
|
||||||
|
+ if (unwind_on_terminating_exception_p)
|
||||||
|
+ {
|
||||||
|
+ struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
|
||||||
|
+ NULL, NULL);
|
||||||
|
+ if (tm != NULL)
|
||||||
|
+ terminate_bp = set_momentary_breakpoint_at_pc
|
||||||
|
+ (SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Everything's ready, push all the info needed to restore the
|
||||||
|
caller (and identify the dummy-frame) onto the dummy-frame
|
||||||
|
stack. */
|
||||||
|
@@ -726,6 +773,10 @@
|
||||||
|
or discard it. */
|
||||||
|
discard_cleanups (inf_status_cleanup);
|
||||||
|
|
||||||
|
+ /* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
|
||||||
|
+ if (terminate_bp)
|
||||||
|
+ make_cleanup_delete_breakpoint (terminate_bp);
|
||||||
|
+
|
||||||
|
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
|
||||||
|
If you're looking to implement asynchronous dummy-frames, then
|
||||||
|
just below is the place to chop this function in two.. */
|
||||||
|
@@ -881,6 +932,38 @@
|
||||||
|
|
||||||
|
if (!stop_stack_dummy)
|
||||||
|
{
|
||||||
|
+
|
||||||
|
+ /* Check if unwind on terminating exception behaviour is on. */
|
||||||
|
+ if (unwind_on_terminating_exception_p)
|
||||||
|
+ {
|
||||||
|
+ /* Check that the breakpoint is our special std::terminate
|
||||||
|
+ breakpoint. If it is, we do not want to kill the inferior
|
||||||
|
+ in an inferior function call. Rewind, and warn the
|
||||||
|
+ user. */
|
||||||
|
+
|
||||||
|
+ if (terminate_bp != NULL
|
||||||
|
+ && (inferior_thread()->stop_bpstat->breakpoint_at->address
|
||||||
|
+ == terminate_bp->loc->address))
|
||||||
|
+ {
|
||||||
|
+ /* We must get back to the frame we were before the
|
||||||
|
+ dummy call. */
|
||||||
|
+ dummy_frame_pop (dummy_id);
|
||||||
|
+
|
||||||
|
+ /* We also need to restore inferior status to that before the
|
||||||
|
+ dummy call. */
|
||||||
|
+ restore_inferior_status (inf_status);
|
||||||
|
+
|
||||||
|
+ error (_("\
|
||||||
|
+The program being debugged entered a std::terminate call, most likely\n\
|
||||||
|
+caused by an unhandled C++ exception. GDB blocked this call in order\n\
|
||||||
|
+to prevent the program from being terminated, and has restored the\n\
|
||||||
|
+context to its original state before the call.\n\
|
||||||
|
+To change this behaviour use \"set unwind-on-terminating-exception off\".\n\
|
||||||
|
+Evaluation of the expression containing the function (%s)\n\
|
||||||
|
+will be abandoned."),
|
||||||
|
+ name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
/* We hit a breakpoint inside the FUNCTION.
|
||||||
|
Keep the dummy frame, the user may want to examine its state.
|
||||||
|
Discard inferior status, we're not at the same point
|
||||||
|
@@ -989,4 +1072,19 @@
|
||||||
|
NULL,
|
||||||
|
show_unwind_on_signal_p,
|
||||||
|
&setlist, &showlist);
|
||||||
|
+
|
||||||
|
+ add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class,
|
||||||
|
+ &unwind_on_terminating_exception_p, _("\
|
||||||
|
+Set unwinding of stack if std::terminate is called while in call dummy."), _("\
|
||||||
|
+Show unwinding of stack if std::terminate() is called while in a call dummy."), _("\
|
||||||
|
+The unwind on terminating exception flag lets the user determine\n\
|
||||||
|
+what gdb should do if a std::terminate() call is made from the\n\
|
||||||
|
+default exception handler. If set, gdb unwinds the stack and restores\n\
|
||||||
|
+the context to what it was before the call. If unset, gdb allows the\n\
|
||||||
|
+std::terminate call to proceed.\n\
|
||||||
|
+The default is to unwind the frame."),
|
||||||
|
+ NULL,
|
||||||
|
+ show_unwind_on_terminating_exception_p,
|
||||||
|
+ &setlist, &showlist);
|
||||||
|
+
|
||||||
|
}
|
||||||
|
--- src/gdb/doc/gdb.texinfo 2009/06/11 11:57:46 1.599
|
||||||
|
+++ src/gdb/doc/gdb.texinfo 2009/06/15 12:11:36 1.600
|
||||||
|
@@ -12895,6 +12895,16 @@
|
||||||
|
the function, or if you passed it incorrect arguments). What happens
|
||||||
|
in that case is controlled by the @code{set unwindonsignal} command.
|
||||||
|
|
||||||
|
+Similarly, with a C@t{++} program it is possible for the function you
|
||||||
|
+call via the @code{print} or @code{call} command to generate an
|
||||||
|
+exception that is not handled due to the constraints of the dummy
|
||||||
|
+frame. In this case, any exception that is raised in the frame, but has
|
||||||
|
+an out-of-frame exception handler will not be found. GDB builds a
|
||||||
|
+dummy-frame for the inferior function call, and the unwinder cannot
|
||||||
|
+seek for exception handlers outside of this dummy-frame. What happens
|
||||||
|
+in that case is controlled by the
|
||||||
|
+@code{set unwind-on-terminating-exception} command.
|
||||||
|
+
|
||||||
|
@table @code
|
||||||
|
@item set unwindonsignal
|
||||||
|
@kindex set unwindonsignal
|
||||||
|
@@ -12911,6 +12921,23 @@
|
||||||
|
@kindex show unwindonsignal
|
||||||
|
Show the current setting of stack unwinding in the functions called by
|
||||||
|
@value{GDBN}.
|
||||||
|
+
|
||||||
|
+@item set unwind-on-terminating-exception
|
||||||
|
+@kindex set unwind-on-terminating-exception
|
||||||
|
+@cindex unwind stack in called functions with unhandled exceptions
|
||||||
|
+@cindex call dummy stack unwinding on unhandled exception.
|
||||||
|
+Set unwinding of the stack if a C@t{++} exception is raised, but left
|
||||||
|
+unhandled while in a function that @value{GDBN} called in the program being
|
||||||
|
+debugged. If set to on (the default), @value{GDBN} unwinds the stack
|
||||||
|
+it created for the call and restores the context to what it was before
|
||||||
|
+the call. If set to off, @value{GDBN} the exception is delivered to
|
||||||
|
+the default C@t{++} exception handler and the inferior terminated.
|
||||||
|
+
|
||||||
|
+@item show unwind-on-terminating-exception
|
||||||
|
+@kindex show unwind-on-terminating-exception
|
||||||
|
+Show the current setting of stack unwinding in the functions called by
|
||||||
|
+@value{GDBN}.
|
||||||
|
+
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@cindex weak alias functions
|
||||||
|
--- src/gdb/testsuite/gdb.cp/gdb2495.cc
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/gdb2495.cc 2009-06-16 12:49:45.874202000 +0000
|
||||||
|
@@ -0,0 +1,89 @@
|
||||||
|
+/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+ Copyright 2009 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/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <iostream>
|
||||||
|
+#include <signal.h>
|
||||||
|
+
|
||||||
|
+using namespace std;
|
||||||
|
+
|
||||||
|
+class SimpleException
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+public:
|
||||||
|
+
|
||||||
|
+ void raise_signal (int dummy)
|
||||||
|
+ {
|
||||||
|
+ if (dummy > 0)
|
||||||
|
+ raise(SIGABRT);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int no_throw_function ()
|
||||||
|
+ {
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void throw_function ()
|
||||||
|
+ {
|
||||||
|
+ throw 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int throw_function_with_handler ()
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ throw 1;
|
||||||
|
+ }
|
||||||
|
+ catch (...)
|
||||||
|
+ {
|
||||||
|
+ cout << "Handled" << endl;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void call_throw_function_no_handler ()
|
||||||
|
+ {
|
||||||
|
+ throw_function ();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void call_throw_function_handler ()
|
||||||
|
+ {
|
||||||
|
+ throw_function_with_handler ();
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+SimpleException exceptions;
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main()
|
||||||
|
+{
|
||||||
|
+ /* Have to call these functions so GCC does not optimize them
|
||||||
|
+ away. */
|
||||||
|
+ exceptions.raise_signal (-1);
|
||||||
|
+ exceptions.no_throw_function ();
|
||||||
|
+ exceptions.throw_function_with_handler ();
|
||||||
|
+ exceptions.call_throw_function_handler ();
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ exceptions.throw_function ();
|
||||||
|
+ exceptions.call_throw_function_no_handler ();
|
||||||
|
+ }
|
||||||
|
+ catch (...)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--- src/gdb/testsuite/gdb.cp/gdb2495.exp
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/gdb2495.exp 2009-06-16 12:49:46.889492000 +0000
|
||||||
|
@@ -0,0 +1,157 @@
|
||||||
|
+# Copyright 2009 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.
|
||||||
|
+
|
||||||
|
+# This test is largely based of gdb.base/callfuncs.exp.
|
||||||
|
+
|
||||||
|
+if $tracelevel then {
|
||||||
|
+ strace $tracelevel
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if { [skip_cplus_tests] } { continue }
|
||||||
|
+
|
||||||
|
+set prms_id 2495
|
||||||
|
+set bug_id 0
|
||||||
|
+
|
||||||
|
+set testfile "gdb2495"
|
||||||
|
+set srcfile ${testfile}.cc
|
||||||
|
+set binfile $objdir/$subdir/$testfile
|
||||||
|
+
|
||||||
|
+# Create and source the file that provides information about the compiler
|
||||||
|
+# used to compile the test case.
|
||||||
|
+if [get_compiler_info ${binfile} "c++"] {
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
||||||
|
+ untested gdb2495.exp
|
||||||
|
+ 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
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+gdb_exit
|
||||||
|
+gdb_start
|
||||||
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
+gdb_load ${binfile}
|
||||||
|
+
|
||||||
|
+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" \
|
||||||
|
+ "gdb.cp/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\".*"
|
||||||
|
--- src/gdb/testsuite/gdb.cp/Makefile.in 2009/02/03 01:09:01 1.5
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/Makefile.in 2009/06/15 12:11:37 1.6
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
|
||||||
|
derivation inherit local member-ptr method misc \
|
||||||
|
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
|
||||||
|
- ref-types ref-params method2 pr9594
|
||||||
|
+ ref-types ref-params method2 pr9594 gdb2495
|
||||||
|
|
||||||
|
all info install-info dvi install uninstall installcheck check:
|
||||||
|
@echo "Nothing to be done for $@..."
|
502
gdb-archer.patch
502
gdb-archer.patch
@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
|
|||||||
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
http://sourceware.org/gdb/wiki/ArcherBranchManagement
|
||||||
|
|
||||||
GIT snapshot:
|
GIT snapshot:
|
||||||
commit 30c13da4efe18f43ee34aa4b29bc86e1a53de548
|
commit 05c402a02716177c4ddd272a6e312cbd2908ed68
|
||||||
|
|
||||||
branch `archer' - the merge of branches:
|
branch `archer' - the merge of branches:
|
||||||
archer-jankratochvil-merge-expr
|
archer-jankratochvil-merge-expr
|
||||||
@ -12596,7 +12596,7 @@ index 845b320..ad6e7d7 100644
|
|||||||
|
|
||||||
extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
|
extern struct cleanup *make_final_cleanup (make_cleanup_ftype *, void *);
|
||||||
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
|
||||||
index 10e7388..c4ab391 100644
|
index 10e7388..099f88a 100644
|
||||||
--- a/gdb/doc/gdb.texinfo
|
--- a/gdb/doc/gdb.texinfo
|
||||||
+++ b/gdb/doc/gdb.texinfo
|
+++ b/gdb/doc/gdb.texinfo
|
||||||
@@ -955,8 +955,10 @@ Connect to process ID @var{number}, as with the @code{attach} command.
|
@@ -955,8 +955,10 @@ Connect to process ID @var{number}, as with the @code{attach} command.
|
||||||
@ -12929,44 +12929,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@node Calling
|
@node Calling
|
||||||
@section Calling Program Functions
|
@section Calling Program Functions
|
||||||
|
|
||||||
@@ -12510,6 +12666,12 @@ It is possible for the function you call via the @code{print} or
|
@@ -17815,7 +17971,7 @@ command:
|
||||||
the function, or if you passed it incorrect arguments). What happens
|
|
||||||
in that case is controlled by the @code{set unwindonsignal} command.
|
|
||||||
|
|
||||||
+Similarly, with a C++ program it is possible for the function you
|
|
||||||
+call via the @code{print} or @code{call} command to generate an
|
|
||||||
+exception that is not handled due to the constraints of the dummy
|
|
||||||
+frame. What happens in that case is controlled by the
|
|
||||||
+@code{set unwind-on-terminating-exception} command.
|
|
||||||
+
|
|
||||||
@table @code
|
|
||||||
@item set unwindonsignal
|
|
||||||
@kindex set unwindonsignal
|
|
||||||
@@ -12526,6 +12688,23 @@ received.
|
|
||||||
@kindex show unwindonsignal
|
|
||||||
Show the current setting of stack unwinding in the functions called by
|
|
||||||
@value{GDBN}.
|
|
||||||
+
|
|
||||||
+@item set unwind-on-terminating-exception
|
|
||||||
+@kindex set unwind-on-terminating-exception
|
|
||||||
+@cindex unwind stack in called functions
|
|
||||||
+@cindex call dummy stack unwinding on unhandled exception.
|
|
||||||
+Set unwinding of the stack if a C++ exception is raised but unhandled
|
|
||||||
+while in a function that @value{GDBN} called in the program being
|
|
||||||
+debugged. If set to on (the default), @value{GDBN} unwinds the stack
|
|
||||||
+it created for the call and restores the context to what it was before
|
|
||||||
+the call. If set to off, @value{GDBN} the exception is delivered to
|
|
||||||
+the default C++ exception handler.
|
|
||||||
+
|
|
||||||
+@item show unwind-on-terminating-exception
|
|
||||||
+@kindex show unwind-on-terminating-exception
|
|
||||||
+Show the current setting of stack unwinding in the functions called by
|
|
||||||
+@value{GDBN}.
|
|
||||||
+
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@cindex weak alias functions
|
|
||||||
@@ -17815,7 +17994,7 @@ command:
|
|
||||||
@table @code
|
@table @code
|
||||||
@kindex source
|
@kindex source
|
||||||
@cindex execute commands from a file
|
@cindex execute commands from a file
|
||||||
@ -12975,7 +12938,7 @@ index 10e7388..c4ab391 100644
|
|||||||
Execute the command file @var{filename}.
|
Execute the command file @var{filename}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@@ -17832,6 +18011,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays
|
@@ -17832,6 +17988,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays
|
||||||
each command as it is executed. The option must be given before
|
each command as it is executed. The option must be given before
|
||||||
@var{filename}, and is interpreted as part of the filename anywhere else.
|
@var{filename}, and is interpreted as part of the filename anywhere else.
|
||||||
|
|
||||||
@ -12987,7 +12950,7 @@ index 10e7388..c4ab391 100644
|
|||||||
Commands that would ask for confirmation if used interactively proceed
|
Commands that would ask for confirmation if used interactively proceed
|
||||||
without asking when used in a command file. Many @value{GDBN} commands that
|
without asking when used in a command file. Many @value{GDBN} commands that
|
||||||
normally print messages to say what they are doing omit the messages
|
normally print messages to say what they are doing omit the messages
|
||||||
@@ -18093,8 +18277,6 @@ containing @code{end}. For example:
|
@@ -18093,8 +18254,6 @@ containing @code{end}. For example:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(@value{GDBP}) python
|
(@value{GDBP}) python
|
||||||
@ -12996,7 +12959,7 @@ index 10e7388..c4ab391 100644
|
|||||||
>print 23
|
>print 23
|
||||||
>end
|
>end
|
||||||
23
|
23
|
||||||
@@ -18107,6 +18289,14 @@ in a Python script. This can be controlled using @code{maint set
|
@@ -18107,6 +18266,14 @@ in a Python script. This can be controlled using @code{maint set
|
||||||
python print-stack}: if @code{on}, the default, then Python stack
|
python print-stack}: if @code{on}, the default, then Python stack
|
||||||
printing is enabled; if @code{off}, then Python stack printing is
|
printing is enabled; if @code{off}, then Python stack printing is
|
||||||
disabled.
|
disabled.
|
||||||
@ -13011,7 +12974,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
@node Python API
|
@node Python API
|
||||||
@@ -18114,6 +18304,14 @@ disabled.
|
@@ -18114,6 +18281,14 @@ disabled.
|
||||||
@cindex python api
|
@cindex python api
|
||||||
@cindex programming in python
|
@cindex programming in python
|
||||||
|
|
||||||
@ -13026,7 +12989,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@cindex python stdout
|
@cindex python stdout
|
||||||
@cindex python pagination
|
@cindex python pagination
|
||||||
At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
|
At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
|
||||||
@@ -18125,8 +18323,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
|
@@ -18125,8 +18300,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
|
||||||
@menu
|
@menu
|
||||||
* Basic Python:: Basic Python Functions.
|
* Basic Python:: Basic Python Functions.
|
||||||
* Exception Handling::
|
* Exception Handling::
|
||||||
@ -13045,7 +13008,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Basic Python
|
@node Basic Python
|
||||||
@@ -18152,10 +18359,30 @@ command as having originated from the user invoking it interactively.
|
@@ -18152,10 +18336,30 @@ command as having originated from the user invoking it interactively.
|
||||||
It must be a boolean value. If omitted, it defaults to @code{False}.
|
It must be a boolean value. If omitted, it defaults to @code{False}.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@ -13080,7 +13043,7 @@ index 10e7388..c4ab391 100644
|
|||||||
spaces if the parameter has a multi-part name. For example,
|
spaces if the parameter has a multi-part name. For example,
|
||||||
@samp{print object} is a valid parameter name.
|
@samp{print object} is a valid parameter name.
|
||||||
|
|
||||||
@@ -18179,6 +18406,28 @@ If no exception is raised, the return value is always an instance of
|
@@ -18179,6 +18383,28 @@ If no exception is raised, the return value is always an instance of
|
||||||
@code{gdb.Value} (@pxref{Values From Inferior}).
|
@code{gdb.Value} (@pxref{Values From Inferior}).
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@ -13109,7 +13072,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@findex gdb.write
|
@findex gdb.write
|
||||||
@defun write string
|
@defun write string
|
||||||
Print a string to @value{GDBN}'s paginated standard output stream.
|
Print a string to @value{GDBN}'s paginated standard output stream.
|
||||||
@@ -18193,6 +18442,66 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing
|
@@ -18193,6 +18419,66 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing
|
||||||
function.
|
function.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@ -13176,7 +13139,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@node Exception Handling
|
@node Exception Handling
|
||||||
@subsubsection Exception Handling
|
@subsubsection Exception Handling
|
||||||
@cindex python exceptions
|
@cindex python exceptions
|
||||||
@@ -18224,6 +18533,44 @@ message as its value, and the Python call stack backtrace at the
|
@@ -18224,6 +18510,44 @@ message as its value, and the Python call stack backtrace at the
|
||||||
Python statement closest to where the @value{GDBN} error occured as the
|
Python statement closest to where the @value{GDBN} error occured as the
|
||||||
traceback.
|
traceback.
|
||||||
|
|
||||||
@ -13221,7 +13184,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@node Values From Inferior
|
@node Values From Inferior
|
||||||
@subsubsection Values From Inferior
|
@subsubsection Values From Inferior
|
||||||
@cindex values from inferior, with Python
|
@cindex values from inferior, with Python
|
||||||
@@ -18258,8 +18605,36 @@ bar = some_val['foo']
|
@@ -18258,8 +18582,36 @@ bar = some_val['foo']
|
||||||
|
|
||||||
Again, @code{bar} will also be a @code{gdb.Value} object.
|
Again, @code{bar} will also be a @code{gdb.Value} object.
|
||||||
|
|
||||||
@ -13260,7 +13223,7 @@ index 10e7388..c4ab391 100644
|
|||||||
|
|
||||||
@defmethod Value dereference
|
@defmethod Value dereference
|
||||||
This method returns a new @code{gdb.Value} object whose contents is
|
This method returns a new @code{gdb.Value} object whose contents is
|
||||||
@@ -18282,7 +18657,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the
|
@@ -18282,7 +18634,7 @@ The result @code{bar} will be a @code{gdb.Value} object holding the
|
||||||
value pointed to by @code{foo}.
|
value pointed to by @code{foo}.
|
||||||
@end defmethod
|
@end defmethod
|
||||||
|
|
||||||
@ -13269,7 +13232,7 @@ index 10e7388..c4ab391 100644
|
|||||||
If this @code{gdb.Value} represents a string, then this method
|
If this @code{gdb.Value} represents a string, then this method
|
||||||
converts the contents to a Python string. Otherwise, this method will
|
converts the contents to a Python string. Otherwise, this method will
|
||||||
throw an exception.
|
throw an exception.
|
||||||
@@ -18308,6 +18683,465 @@ will be used, if the current language is able to supply one.
|
@@ -18308,6 +18660,465 @@ will be used, if the current language is able to supply one.
|
||||||
The optional @var{errors} argument is the same as the corresponding
|
The optional @var{errors} argument is the same as the corresponding
|
||||||
argument to Python's @code{string.decode} method.
|
argument to Python's @code{string.decode} method.
|
||||||
@end defmethod
|
@end defmethod
|
||||||
@ -13735,7 +13698,7 @@ index 10e7388..c4ab391 100644
|
|||||||
|
|
||||||
@node Commands In Python
|
@node Commands In Python
|
||||||
@subsubsection Commands In Python
|
@subsubsection Commands In Python
|
||||||
@@ -18320,7 +19154,7 @@ You can implement new @value{GDBN} CLI commands in Python. A CLI
|
@@ -18320,7 +19131,7 @@ You can implement new @value{GDBN} CLI commands in Python. A CLI
|
||||||
command is implemented using an instance of the @code{gdb.Command}
|
command is implemented using an instance of the @code{gdb.Command}
|
||||||
class, most commonly using a subclass.
|
class, most commonly using a subclass.
|
||||||
|
|
||||||
@ -13744,7 +13707,7 @@ index 10e7388..c4ab391 100644
|
|||||||
The object initializer for @code{Command} registers the new command
|
The object initializer for @code{Command} registers the new command
|
||||||
with @value{GDBN}. This initializer is normally invoked from the
|
with @value{GDBN}. This initializer is normally invoked from the
|
||||||
subclass' own @code{__init__} method.
|
subclass' own @code{__init__} method.
|
||||||
@@ -18332,11 +19166,11 @@ an exception is raised.
|
@@ -18332,11 +19143,11 @@ an exception is raised.
|
||||||
|
|
||||||
There is no support for multi-line commands.
|
There is no support for multi-line commands.
|
||||||
|
|
||||||
@ -13758,7 +13721,7 @@ index 10e7388..c4ab391 100644
|
|||||||
one of the @samp{COMPLETE_} constants defined below. This argument
|
one of the @samp{COMPLETE_} constants defined below. This argument
|
||||||
tells @value{GDBN} how to perform completion for this command. If not
|
tells @value{GDBN} how to perform completion for this command. If not
|
||||||
given, @value{GDBN} will attempt to complete using the object's
|
given, @value{GDBN} will attempt to complete using the object's
|
||||||
@@ -18563,6 +19397,374 @@ registration of the command with @value{GDBN}. Depending on how the
|
@@ -18563,6 +19374,374 @@ registration of the command with @value{GDBN}. Depending on how the
|
||||||
Python code is read into @value{GDBN}, you may need to import the
|
Python code is read into @value{GDBN}, you may need to import the
|
||||||
@code{gdb} module explicitly.
|
@code{gdb} module explicitly.
|
||||||
|
|
||||||
@ -14133,7 +14096,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@node Interpreters
|
@node Interpreters
|
||||||
@chapter Command Interpreters
|
@chapter Command Interpreters
|
||||||
@cindex command interpreters
|
@cindex command interpreters
|
||||||
@@ -22273,6 +23475,103 @@ Unfreezing a variable does not update it, only subsequent
|
@@ -22273,6 +23452,103 @@ Unfreezing a variable does not update it, only subsequent
|
||||||
(gdb)
|
(gdb)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@ -14237,7 +14200,7 @@ index 10e7388..c4ab391 100644
|
|||||||
|
|
||||||
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
@node GDB/MI Data Manipulation
|
@node GDB/MI Data Manipulation
|
||||||
@@ -23832,6 +25131,10 @@ as possible presense of the @code{frozen} field in the output
|
@@ -23832,6 +25108,10 @@ as possible presense of the @code{frozen} field in the output
|
||||||
of @code{-varobj-create}.
|
of @code{-varobj-create}.
|
||||||
@item pending-breakpoints
|
@item pending-breakpoints
|
||||||
Indicates presence of the @option{-f} option to the @code{-break-insert} command.
|
Indicates presence of the @option{-f} option to the @code{-break-insert} command.
|
||||||
@ -14248,7 +14211,7 @@ index 10e7388..c4ab391 100644
|
|||||||
@item thread-info
|
@item thread-info
|
||||||
Indicates presence of the @code{-thread-info} command.
|
Indicates presence of the @code{-thread-info} command.
|
||||||
|
|
||||||
@@ -25402,28 +26705,6 @@ data in a @file{gmon.out} file, be sure to move it to a safe location.
|
@@ -25402,28 +26682,6 @@ data in a @file{gmon.out} file, be sure to move it to a safe location.
|
||||||
Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be
|
Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be
|
||||||
compiled with the @samp{-pg} compiler option.
|
compiled with the @samp{-pg} compiler option.
|
||||||
|
|
||||||
@ -21824,39 +21787,10 @@ index f40b6b7..ff429c4 100644
|
|||||||
{
|
{
|
||||||
/* If this system does not support PT_STEP, a higher level
|
/* If this system does not support PT_STEP, a higher level
|
||||||
diff --git a/gdb/infcall.c b/gdb/infcall.c
|
diff --git a/gdb/infcall.c b/gdb/infcall.c
|
||||||
index d6da8b2..80168b3 100644
|
index d6da8b2..2f483f3 100644
|
||||||
--- a/gdb/infcall.c
|
--- a/gdb/infcall.c
|
||||||
+++ b/gdb/infcall.c
|
+++ b/gdb/infcall.c
|
||||||
@@ -98,6 +98,28 @@ Unwinding of stack if a signal is received while in a call dummy is %s.\n"),
|
@@ -217,7 +217,7 @@ find_function_addr (struct value *function, struct type **retval_type)
|
||||||
value);
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* This boolean tells what gdb should do if a std::terminate call is
|
|
||||||
+ made while in a function called from gdb (call dummy).
|
|
||||||
+ As the confines of a single dummy stack prohibit out-of-frame
|
|
||||||
+ handlers from handling a raised exception, and as out-of-frame
|
|
||||||
+ handlers are common in C++, this can lead to no handler being found
|
|
||||||
+ by the unwinder, and a std::terminate call. This is a false positive.
|
|
||||||
+ If set, gdb unwinds the stack and restores the context to what it
|
|
||||||
+ was before the call.
|
|
||||||
+
|
|
||||||
+ The default is to unwind the frame if a std::terminate call is made.. */
|
|
||||||
+
|
|
||||||
+static int unwind_on_terminating_exception_p = 1;
|
|
||||||
+static void
|
|
||||||
+show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty,
|
|
||||||
+ struct cmd_list_element *c,
|
|
||||||
+ const char *value)
|
|
||||||
+
|
|
||||||
+{
|
|
||||||
+ fprintf_filtered (file, _("\
|
|
||||||
+Unwind stack if a C++ exception is unhandled while in a call dummy is %s.\n"),
|
|
||||||
+ value);
|
|
||||||
+}
|
|
||||||
|
|
||||||
/* Perform the standard coercions that are specified
|
|
||||||
for arguments to be passed to C or Ada functions.
|
|
||||||
@@ -217,7 +239,7 @@ find_function_addr (struct value *function, struct type **retval_type)
|
|
||||||
/* Determine address to call. */
|
/* Determine address to call. */
|
||||||
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
|
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
|
||||||
{
|
{
|
||||||
@ -21865,121 +21799,6 @@ index d6da8b2..80168b3 100644
|
|||||||
value_type = TYPE_TARGET_TYPE (ftype);
|
value_type = TYPE_TARGET_TYPE (ftype);
|
||||||
}
|
}
|
||||||
else if (code == TYPE_CODE_PTR)
|
else if (code == TYPE_CODE_PTR)
|
||||||
@@ -419,6 +441,8 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
|
|
||||||
struct cleanup *args_cleanup;
|
|
||||||
struct frame_info *frame;
|
|
||||||
struct gdbarch *gdbarch;
|
|
||||||
+ struct breakpoint *terminate_bp = 0;
|
|
||||||
+ struct minimal_symbol *tm;
|
|
||||||
ptid_t call_thread_ptid;
|
|
||||||
struct gdb_exception e;
|
|
||||||
const char *name;
|
|
||||||
@@ -718,6 +742,29 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
|
|
||||||
bpt = set_momentary_breakpoint (sal, dummy_id, bp_call_dummy);
|
|
||||||
bpt->disposition = disp_del;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ /* Create a breakpoint in std::terminate.
|
|
||||||
+ 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 wrong, as an exception can be normally
|
|
||||||
+ and legally 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. Place a momentary breakpoint in the std::terminate function
|
|
||||||
+ and if triggered in the call, rewind */
|
|
||||||
+ if (unwind_on_terminating_exception_p)
|
|
||||||
+ {
|
|
||||||
+ tm = lookup_minimal_symbol ("std::terminate()", NULL, NULL);
|
|
||||||
+ if (tm != NULL)
|
|
||||||
+ {
|
|
||||||
+ terminate_bp = set_momentary_breakpoint_at_pc
|
|
||||||
+ (SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
|
|
||||||
+ make_cleanup_delete_breakpoint (terminate_bp);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
/* Everything's ready, push all the info needed to restore the
|
|
||||||
caller (and identify the dummy-frame) onto the dummy-frame
|
|
||||||
@@ -828,6 +875,16 @@ When the function is done executing, GDB will silently stop."),
|
|
||||||
name);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (! target_has_execution)
|
|
||||||
+ {
|
|
||||||
+ /* If we try to restore the inferior status (via the cleanup),
|
|
||||||
+ we'll crash as the inferior is no longer running. */
|
|
||||||
+ discard_cleanups (inf_status_cleanup);
|
|
||||||
+ discard_inferior_status (inf_status);
|
|
||||||
+ error (_("\
|
|
||||||
+The program being debugged exited while in a function called from GDB."));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
if (stopped_by_random_signal || !stop_stack_dummy)
|
|
||||||
{
|
|
||||||
const char *name = get_function_name (funaddr,
|
|
||||||
@@ -884,6 +941,38 @@ When the function is done executing, GDB will silently stop."),
|
|
||||||
|
|
||||||
if (!stop_stack_dummy)
|
|
||||||
{
|
|
||||||
+
|
|
||||||
+ /* Check if unwind on terminating exception behaviour is on */
|
|
||||||
+ if (unwind_on_terminating_exception_p)
|
|
||||||
+ {
|
|
||||||
+ /* Check that the breakpoint is our special std::terminate
|
|
||||||
+ breakpoint. If it is, we do not want to kill the inferior
|
|
||||||
+ in an inferior function call. Rewind, and warn the user */
|
|
||||||
+
|
|
||||||
+ if ((terminate_bp != NULL) &&
|
|
||||||
+ (inferior_thread()->stop_bpstat->breakpoint_at->address
|
|
||||||
+ == terminate_bp->loc->address))
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+
|
|
||||||
+ /* We must get back to the frame we were before the
|
|
||||||
+ dummy call. */
|
|
||||||
+ dummy_frame_pop (dummy_id);
|
|
||||||
+
|
|
||||||
+ /* We also need to restore inferior status to that before the
|
|
||||||
+ dummy call. */
|
|
||||||
+ restore_inferior_status (inf_status);
|
|
||||||
+
|
|
||||||
+ error (_("\
|
|
||||||
+The program being debugged entered a std::terminate call which would\n\
|
|
||||||
+have terminated the program being debugged. GDB has restored the\n\
|
|
||||||
+context to what it was before the call\n\
|
|
||||||
+To change this behaviour use \"set unwind-on-terminating-exception off\"\n\
|
|
||||||
+Evaluation of the expression containing the function (%s) will be abandoned."),
|
|
||||||
+ name);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
/* We hit a breakpoint inside the FUNCTION.
|
|
||||||
Keep the dummy frame, the user may want to examine its state.
|
|
||||||
Discard inferior status, we're not at the same point
|
|
||||||
@@ -992,4 +1081,19 @@ The default is to stop in the frame where the signal was received."),
|
|
||||||
NULL,
|
|
||||||
show_unwind_on_signal_p,
|
|
||||||
&setlist, &showlist);
|
|
||||||
+
|
|
||||||
+ add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class,
|
|
||||||
+ &unwind_on_terminating_exception_p, _("\
|
|
||||||
+Set unwinding of stack if a std::terminate() call originates from\n\
|
|
||||||
+the default C++ exception handler."), _("\
|
|
||||||
+Show unwinding of stack if a std::terminate() call originates from\n\
|
|
||||||
+the default C++ exception handler."), _("\
|
|
||||||
+The unwind on terminating exception flag lets the user determine\n\
|
|
||||||
+what gdb should do if a std::terminate() call is made from the\n\
|
|
||||||
+default exception handler.\n\
|
|
||||||
+The default is to unwind the frame."),
|
|
||||||
+ NULL,
|
|
||||||
+ show_unwind_on_terminating_exception_p,
|
|
||||||
+ &setlist, &showlist);
|
|
||||||
+
|
|
||||||
}
|
|
||||||
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
|
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
|
||||||
index 0a17dab..d48f4b1 100644
|
index 0a17dab..d48f4b1 100644
|
||||||
--- a/gdb/infcmd.c
|
--- a/gdb/infcmd.c
|
||||||
@ -37771,19 +37590,6 @@ index 0000000..5da7378
|
|||||||
+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
|
+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
|
||||||
+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
|
+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
|
||||||
+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
|
+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
|
||||||
diff --git a/gdb/testsuite/gdb.cp/Makefile.in b/gdb/testsuite/gdb.cp/Makefile.in
|
|
||||||
index 1787ad5..391bfc2 100644
|
|
||||||
--- a/gdb/testsuite/gdb.cp/Makefile.in
|
|
||||||
+++ b/gdb/testsuite/gdb.cp/Makefile.in
|
|
||||||
@@ -4,7 +4,7 @@ srcdir = @srcdir@
|
|
||||||
EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
|
|
||||||
derivation inherit local member-ptr method misc \
|
|
||||||
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
|
|
||||||
- ref-types ref-params method2 pr9594
|
|
||||||
+ ref-types ref-params method2 pr9594 gdb2495
|
|
||||||
|
|
||||||
all info install-info dvi install uninstall installcheck check:
|
|
||||||
@echo "Nothing to be done for $@..."
|
|
||||||
diff --git a/gdb/testsuite/gdb.cp/abstract-origin.cc b/gdb/testsuite/gdb.cp/abstract-origin.cc
|
diff --git a/gdb/testsuite/gdb.cp/abstract-origin.cc b/gdb/testsuite/gdb.cp/abstract-origin.cc
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..e2de3fb
|
index 0000000..e2de3fb
|
||||||
@ -38369,268 +38175,6 @@ index 77687a6..66d16cf 100644
|
|||||||
set f_uc "${ws}unsigned char m_unsigned_char;"
|
set f_uc "${ws}unsigned char m_unsigned_char;"
|
||||||
set f_f "${ws}float m_float;"
|
set f_f "${ws}float m_float;"
|
||||||
set f_d "${ws}double m_double;"
|
set f_d "${ws}double m_double;"
|
||||||
diff --git a/gdb/testsuite/gdb.cp/gdb2495.cc b/gdb/testsuite/gdb.cp/gdb2495.cc
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4df265f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.cp/gdb2495.cc
|
|
||||||
@@ -0,0 +1,90 @@
|
|
||||||
+/* This testcase is part of GDB, the GNU debugger.
|
|
||||||
+
|
|
||||||
+ Copyright 2008 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/>.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include <iostream>
|
|
||||||
+#include <signal.h>
|
|
||||||
+
|
|
||||||
+using namespace std;
|
|
||||||
+
|
|
||||||
+class SimpleException
|
|
||||||
+{
|
|
||||||
+
|
|
||||||
+public:
|
|
||||||
+
|
|
||||||
+ void raise_signal (int dummy)
|
|
||||||
+ {
|
|
||||||
+ if (dummy > 0)
|
|
||||||
+ raise(SIGABRT);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int no_throw_function ()
|
|
||||||
+ {
|
|
||||||
+ return 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ void throw_function ()
|
|
||||||
+ {
|
|
||||||
+ throw 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int throw_function_with_handler ()
|
|
||||||
+ {
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ throw 1;
|
|
||||||
+ }
|
|
||||||
+ catch (...)
|
|
||||||
+ {
|
|
||||||
+ cout << "Handled" << endl;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return 2;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ void call_throw_function_no_handler ()
|
|
||||||
+ {
|
|
||||||
+ throw_function ();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ void call_throw_function_handler ()
|
|
||||||
+ {
|
|
||||||
+ throw_function_with_handler ();
|
|
||||||
+ }
|
|
||||||
+};
|
|
||||||
+SimpleException exceptions;
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main()
|
|
||||||
+{
|
|
||||||
+ // Have to call all these functions
|
|
||||||
+ // so not optimized away.
|
|
||||||
+ exceptions.raise_signal (-1);
|
|
||||||
+ exceptions.no_throw_function ();
|
|
||||||
+ exceptions.throw_function_with_handler ();
|
|
||||||
+ exceptions.call_throw_function_handler ();
|
|
||||||
+ try
|
|
||||||
+ {
|
|
||||||
+ exceptions.throw_function ();
|
|
||||||
+ exceptions.call_throw_function_no_handler ();
|
|
||||||
+ }
|
|
||||||
+ catch (...)
|
|
||||||
+ {
|
|
||||||
+ }
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..62c09c2
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.cp/gdb2495.exp
|
|
||||||
@@ -0,0 +1,160 @@
|
|
||||||
+# Copyright 2008 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.
|
|
||||||
+
|
|
||||||
+# This test is largley based off gdb.base/callfuncs.exp.
|
|
||||||
+
|
|
||||||
+if $tracelevel then {
|
|
||||||
+ strace $tracelevel
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+if { [skip_cplus_tests] } { continue }
|
|
||||||
+
|
|
||||||
+set prms_id 2495
|
|
||||||
+set bug_id 0
|
|
||||||
+
|
|
||||||
+set testfile "gdb2495"
|
|
||||||
+set srcfile ${testfile}.cc
|
|
||||||
+set binfile $objdir/$subdir/$testfile
|
|
||||||
+
|
|
||||||
+# Create and source the file that provides information about the compiler
|
|
||||||
+# used to compile the test case.
|
|
||||||
+if [get_compiler_info ${binfile} "c++"] {
|
|
||||||
+ return -1
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
|
||||||
+ untested gdb2495.exp
|
|
||||||
+ 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
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+gdb_exit
|
|
||||||
+gdb_start
|
|
||||||
+gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
+gdb_load ${binfile}
|
|
||||||
+
|
|
||||||
+if ![runto_main] then {
|
|
||||||
+ perror "couldn't run to main"
|
|
||||||
+ continue
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# See http://sources.redhat.com/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" \
|
|
||||||
+ "gdb.cp/gdb2495\.cc.*"
|
|
||||||
+
|
|
||||||
+# Turn off this new behaviour ...
|
|
||||||
+send_gdb "set unwind-on-terminating-exception off\n"
|
|
||||||
+gdb_expect {
|
|
||||||
+ -re "$gdb_prompt $" {pass "set unwind-on-terminating-exception"}
|
|
||||||
+ timeout {fail "(timeout) set unwind-on-terminating-exception"}
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# 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 stopped while in a function called .*" \
|
|
||||||
+ "Call a function that raises an exception with unwinding off.."
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+# Restart back at main
|
|
||||||
+if ![runto_main] then {
|
|
||||||
+ perror "couldn't run to main"
|
|
||||||
+ continue
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+# Check to see if our new behaviour alters the unwind signal
|
|
||||||
+# behaviour. It should not. Test both on and off states.
|
|
||||||
+
|
|
||||||
+# Turn on unwind on signal behaviour ...
|
|
||||||
+send_gdb "set unwindonsignal on\n"
|
|
||||||
+gdb_expect {
|
|
||||||
+ -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
|
|
||||||
+send_gdb "set unwindonsignal off\n"
|
|
||||||
+gdb_expect {
|
|
||||||
+ -re "$gdb_prompt $" {pass "set unwindonsignal off"}
|
|
||||||
+ timeout {fail "(timeout) set unwindonsignal off"}
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+# Check that it is 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\".*"
|
|
||||||
diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc
|
diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc
|
||||||
index 1dff70a..648b2af 100644
|
index 1dff70a..648b2af 100644
|
||||||
--- a/gdb/testsuite/gdb.cp/member-ptr.cc
|
--- a/gdb/testsuite/gdb.cp/member-ptr.cc
|
||||||
|
14
gdb.spec
14
gdb.spec
@ -15,7 +15,7 @@ Version: 6.8.50.20090302
|
|||||||
|
|
||||||
# The release always contains a leading reserved number, start it at 1.
|
# The release always contains a leading reserved number, start it at 1.
|
||||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||||
Release: 32%{?_with_upstream:.upstream}%{?dist}
|
Release: 33%{?_with_upstream:.upstream}%{?dist}
|
||||||
|
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
@ -229,8 +229,8 @@ Patch229: gdb-6.3-bz140532-ppc-unwinding-test.patch
|
|||||||
# Testcase for exec() from threaded program (BZ 202689).
|
# Testcase for exec() from threaded program (BZ 202689).
|
||||||
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch
|
||||||
|
|
||||||
# Backported post gdb-6.8 release fixups.
|
# Backported post gdb-6.8.50.20090302 snapshot fixups.
|
||||||
###Patch232: gdb-6.8-upstream.patch
|
Patch232: gdb-6.8.50.20090302-upstream.patch
|
||||||
|
|
||||||
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
# Testcase for PPC Power6/DFP instructions disassembly (BZ 230000).
|
||||||
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
|
Patch234: gdb-6.6-bz230000-power6-disassembly-test.patch
|
||||||
@ -476,7 +476,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||||||
|
|
||||||
%if 0%{!?_with_upstream:1}
|
%if 0%{!?_with_upstream:1}
|
||||||
|
|
||||||
###patch232 -p1
|
%patch232 -p1
|
||||||
%patch349 -p1
|
%patch349 -p1
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
@ -891,6 +891,12 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jun 16 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-33
|
||||||
|
- Archer update to the snapshot: 05c402a02716177c4ddd272a6e312cbd2908ed68
|
||||||
|
- Archer backport: 05c402a02716177c4ddd272a6e312cbd2908ed68
|
||||||
|
- Remove the [archer-pmuldoon-exception-rewind-master] branch.
|
||||||
|
- Include this functionality as a FSF GDB accepted patchset.
|
||||||
|
|
||||||
* Mon Jun 15 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-32
|
* Mon Jun 15 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-32
|
||||||
- Fix crash on pending breakpoints with PIE (position-indep.-exec.) (BZ 505943).
|
- Fix crash on pending breakpoints with PIE (position-indep.-exec.) (BZ 505943).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user