This patch addresses the bug detailed in gnats pr 2495 and after the conversion to bugzilla: pr 9600 Due to the method that GDB uses to construct a frame for an inferior function call, the unwinder can terminate the inferior if it raises an exception and relies on an out-of-frame handler to normally handle that exception. For most systems GCC uses the exception handling strategy documented here: http://www.codesourcery.com/public/cxx-abi/ . If the function that raises the exception relies on an out-of-frame handler, the single dummy frame constructed by GDB for the inferior function call does not allow the unwinder to walk the stack looking for an appropriate handler. Briefly, if this happens the unwinder terminates the inferior via a call to the default exception handler on the (wrong) assumption that there is no user-created handler for the exception. This patch addresses that by gating access to std::terminate in an inferior function call. If it enters that function, it is popped back to the calling state and "rescues" the inferior. This patch also adds the functionality to turn this gating behaviour on or off. The default is on. This patch applies cleanly to CVS GDB head. Tested on x8664 with no regressions. Regards Phil gdb/ChangeLog 2009-04-23 Phil Muldoon * 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-04-23 Phil Muldoon * gdb.cp/gdb2495.cc: New file. * gdb.cp/gdb2495.exp: New file. gdb/doc/ChangeLog 2009-04-23 Phil Muldoon * doc/gdb.texinfo (Calling): Document set-unwind-on-terminating-exception usage.