This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] try 2 - Do not allow unwinder to terminate inferior in an inferior function call if a C++ exception handler cannot be found.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>
- Cc: gdb-patches ml <gdb-patches at sourceware dot org>, Eli Zaretskii <eliz at gnu dot org>
- Date: Thu, 11 Jun 2009 13:14:37 -0400
- Subject: Re: [patch] try 2 - Do not allow unwinder to terminate inferior in an inferior function call if a C++ exception handler cannot be found.
- References: <4A2E3FB4.6020202@redhat.com>
> 2009-06-09 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/testsuite/ChangeLog
>
> 2009-06-09 Phil Muldoon <pmuldoon@redhat.com>
>
> * gdb.cp/gdb2495.cc: New file.
> * gdb.cp/gdb2495.exp: New file.
These two parts look OK to me. Just a couple of formatting nits to be
fixed before you commit.
> + handler, unless it is in-frame). The default handler calls
> + std::terminate. This will kill the inferior. Assert that
^ Missing space
> + 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);
> + }
I think that the general style in GDB is to omit the curly braces
when the body of an if/while is only one statement.
> + 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
Let's remove the empty line before the comment...
> +# 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.
Two spaces after a period throught the paragraph...
Thanks!
--
Joel