From patchwork Tue Apr 12 17:32:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 11713 Received: (qmail 114534 invoked by alias); 12 Apr 2016 17:32:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 114161 invoked by uid 89); 12 Apr 2016 17:32:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=necessity, scenes X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 12 Apr 2016 17:32:30 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 866206406A for ; Tue, 12 Apr 2016 17:32:29 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3CHWS4S026995 for ; Tue, 12 Apr 2016 13:32:28 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [pushed] [C++] Switch TRY/CATCH to real C++ try/catch by default again Date: Tue, 12 Apr 2016 18:32:28 +0100 Message-Id: <1460482348-26656-1-git-send-email-palves@redhat.com> Now that we don't ever throw GDB exceptions from signal handlers [1], we can switch back to having TRY/CATCH implemented in terms of C++ try/catch instead of sigjmp/longjmp. [1] - https://sourceware.org/ml/gdb-patches/2016-03/msg00351.html Tested on x86_64 Fedora 23, native and gdbserver. gdb/ChangeLog: 2016-04-12 Pedro Alves * common/common-exceptions.h (GDB_XCPT_TRY): Update comment. [__cplusplus] (GDB_XCPT): Define as GDB_XCPT_TRY. --- gdb/ChangeLog | 5 +++++ gdb/common/common-exceptions.h | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b750266..63e7caa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-04-12 Pedro Alves + * common/common-exceptions.h (GDB_XCPT_TRY): Update comment. + [__cplusplus] (GDB_XCPT): Define as GDB_XCPT_TRY. + +2016-04-12 Pedro Alves + * common/common-exceptions.c (struct catcher) : Now a 'jmp_buf' instead of SIGJMP_BUF. (exceptions_state_mc_init): Change return type to 'jmp_buf'. diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h index e21713c..6a41741 100644 --- a/gdb/common/common-exceptions.h +++ b/gdb/common/common-exceptions.h @@ -122,9 +122,7 @@ struct gdb_exception the only mode supported when GDB is built as a C program. */ #define GDB_XCPT_SJMP 1 -/* Make GDB exceptions use try/catch behind the scenes. Can't be made - the default until we stop throwing exceptions from signal - handlers. */ +/* Make GDB exceptions use try/catch behind the scenes. */ #define GDB_XCPT_TRY 2 /* Specify this mode to build with TRY/CATCH mapped directly to raw @@ -133,8 +131,11 @@ struct gdb_exception spurious code between the TRY and the CATCH block. */ #define GDB_XCPT_RAW_TRY 3 -/* Always use setjmp/longmp, even in C++ mode. */ -#define GDB_XCPT GDB_XCPT_SJMP +#ifdef __cplusplus +# define GDB_XCPT GDB_XCPT_TRY +#else +# define GDB_XCPT GDB_XCPT_SJMP +#endif /* Functions to drive the exceptions state machine. Though declared here by necessity, these functions should be considered internal to