This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed] [C++] Switch TRY/CATCH to real C++ try/catch by default again
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 12 Apr 2016 18:32:28 +0100
- Subject: [pushed] [C++] Switch TRY/CATCH to real C++ try/catch by default again
- Authentication-results: sourceware.org; auth=none
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 <palves@redhat.com>
* 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 <palves@redhat.com>
+ * common/common-exceptions.h (GDB_XCPT_TRY): Update comment.
+ [__cplusplus] (GDB_XCPT): Define as GDB_XCPT_TRY.
+
+2016-04-12 Pedro Alves <palves@redhat.com>
+
* common/common-exceptions.c (struct catcher) <buf>: 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
--
2.5.5