From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31961 invoked by alias); 11 Jun 2009 17:14:51 -0000 Received: (qmail 31627 invoked by uid 22791); 11 Jun 2009 17:14:50 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,KAM_STOCKGEN X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 11 Jun 2009 17:14:42 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E2D472BAADD; Thu, 11 Jun 2009 13:14:39 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 6-kY+FB+AX8d; Thu, 11 Jun 2009 13:14:39 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id ADDFE2BAADB; Thu, 11 Jun 2009 13:14:39 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 8F168F596C; Thu, 11 Jun 2009 13:14:37 -0400 (EDT) Date: Thu, 11 Jun 2009 17:14:00 -0000 From: Joel Brobecker To: Phil Muldoon Cc: gdb-patches ml , Eli Zaretskii 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. Message-ID: <20090611171437.GJ25703@adacore.com> References: <4A2E3FB4.6020202@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A2E3FB4.6020202@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00308.txt.bz2 > 2009-06-09 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-06-09 Phil Muldoon > > * 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