public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 3/3] Switch gdb's TRY/CATCH to C++ try/catch
Date: Thu, 21 Apr 2016 23:50:00 -0000	[thread overview]
Message-ID: <1461282640-30425-4-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1461282640-30425-1-git-send-email-palves@redhat.com>

The exceptions-across-readline issue was fixed by the previous commit.
Let's try this again.

gdb/ChangeLog:
2016-04-21  Pedro Alves  <palves@redhat.com>

	* common/common-exceptions.h (GDB_XCPT_TRY): Remove mention of
	the foreign frames issue.
	[__cplusplus] (GDB_XCPT): Define as GDB_XCPT_TRY.
---
 gdb/common/common-exceptions.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index 4a9f675..ed1cf5e 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 handle exceptions crossing foreign frames
-   (gdb -> readline callback -> gdb -> error).  */
+/* 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 sjlj-based exceptions state machine.  Though
    declared here by necessity, these functions should be considered
-- 
2.5.5

      parent reply	other threads:[~2016-04-21 23:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 23:50 [PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT Pedro Alves
2016-04-21 23:50 ` [PATCH 1/3] Rename rl_callback_read_char_wrapper -> gdb_rl_callback_read_char Pedro Alves
2016-04-21 23:50 ` [PATCH 2/3] Propagate GDB/C++ exceptions across readline using sj/lj-based TRY/CATCH Pedro Alves
2016-04-22  8:19   ` Yao Qi
2016-04-22  9:05     ` Pedro Alves
2016-04-22 15:25       ` Pedro Alves
2016-04-21 23:50 ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461282640-30425-4-git-send-email-palves@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).