This is the mail archive of the
archer-commits@sourceware.org
mailing list for the Archer project.
[SCM] archer-pmuldoon-exception-rewind-master: Implement changes/comment from Joel Brobecker patch review.
- From: pmuldoon at sourceware dot org
- To: archer-commits at sourceware dot org
- Date: 28 May 2009 15:30:51 -0000
- Subject: [SCM] archer-pmuldoon-exception-rewind-master: Implement changes/comment from Joel Brobecker patch review.
The branch, archer-pmuldoon-exception-rewind-master has been updated
via 0a7b4726deefbbd95b9f78a84c5e3775f7e14597 (commit)
from 0727e58f40ab1a976f52ec409b68f8ff6b77989c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit 0a7b4726deefbbd95b9f78a84c5e3775f7e14597
Author: Phil Muldoon <pmuldoon@redhat.com>
Date: Thu May 28 16:28:43 2009 +0100
Implement changes/comment from Joel Brobecker patch review.
http://sourceware.org/ml/gdb-patches/2009-05/msg00243.html
-----------------------------------------------------------------------
Summary of changes:
gdb/infcall.c | 34 ++++++++++++++--------------------
gdb/testsuite/gdb.cp/gdb2495.cc | 2 +-
gdb/testsuite/gdb.cp/gdb2495.exp | 24 +++++++++++-------------
3 files changed, 26 insertions(+), 34 deletions(-)
First 500 lines of diff:
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 486ba22..8714883 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -111,6 +111,7 @@ Unwinding of stack if a signal is received while in a call dummy is %s.\n"),
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,
@@ -439,7 +440,7 @@ 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 breakpoint *terminate_bp = NULL;
struct minimal_symbol *tm;
ptid_t call_thread_ptid;
struct gdb_exception e;
@@ -755,7 +756,8 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
and if triggered in the call, rewind. */
if (unwind_on_terminating_exception_p)
{
- tm = lookup_minimal_symbol ("std::terminate()", NULL, NULL);
+ struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
+ NULL, NULL);
if (tm != NULL)
{
terminate_bp = set_momentary_breakpoint_at_pc
@@ -873,16 +875,6 @@ 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,
@@ -948,9 +940,9 @@ When the function is done executing, GDB will silently stop."),
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))
+ 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
@@ -962,11 +954,13 @@ When the function is done executing, GDB will silently stop."),
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."),
+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);
}
}
diff --git a/gdb/testsuite/gdb.cp/gdb2495.cc b/gdb/testsuite/gdb.cp/gdb2495.cc
index 01244bf..4f9b537 100644
--- a/gdb/testsuite/gdb.cp/gdb2495.cc
+++ b/gdb/testsuite/gdb.cp/gdb2495.cc
@@ -32,7 +32,7 @@ public:
raise(SIGABRT);
}
- int no_throw_function ()
+ int no_throw_function ()
{
return 1;
}
diff --git a/gdb/testsuite/gdb.cp/gdb2495.exp b/gdb/testsuite/gdb.cp/gdb2495.exp
index 5480fa8..937c28d 100644
--- a/gdb/testsuite/gdb.cp/gdb2495.exp
+++ b/gdb/testsuite/gdb.cp/gdb2495.exp
@@ -27,7 +27,7 @@
# unwinding that sequence and also tests the flag behaviour gating this
# functionality.
-# This test is largley based off gdb.base/callfuncs.exp.
+# This test is largely based of gdb.base/callfuncs.exp.
if $tracelevel then {
strace $tracelevel
@@ -71,7 +71,7 @@ if ![runto_main] then {
continue
}
-# See http://sources.redhat.com/gdb/bugs/2495
+# See http://sourceware.org/gdb/bugs/2495
# Test normal baseline behaviour. Call a function that
# does not raise an exception.
@@ -83,7 +83,7 @@ gdb_test "p exceptions.throw_function_with_handler()" " = 2"
# 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 .*" \
+ "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.
@@ -98,10 +98,10 @@ 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"}
+gdb_test_multiple "set unwind-on-terminating-exception off" \
+ "Tune 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.
@@ -126,10 +126,9 @@ if ![runto_main] then {
# behaviour; it should not. Test both on and off states.
# Turn on unwind on signal behaviour.
-send_gdb "set unwindonsignal on\n"
-gdb_expect {
+gdb_test_multiple "set unwindonsignal on" "Turn unwindonsignal on" {
-re "$gdb_prompt $" {pass "set unwindonsignal on"}
- timeout {fail "(timeout) set unwindonsignal on"}
+ timeout {fail "(timeout) set unwindonsignal on"}
}
# Check that it is turned on.
@@ -143,10 +142,9 @@ gdb_test "p exceptions.raise_signal(1)" \
"To change this behavior use \"set unwindonsignal off\".*"
# And reverse - turn off again.
-send_gdb "set unwindonsignal off\n"
-gdb_expect {
+gdb_test_multiple "set unwindonsignal off" "Turn unwindonsignal off" {
-re "$gdb_prompt $" {pass "set unwindonsignal off"}
- timeout {fail "(timeout) set unwindonsignal off"}
+ timeout {fail "(timeout) set unwindonsignal off"}
}
# Check that it is actually turned off.
hooks/post-receive
--
Repository for Project Archer.