This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pushed] Switch gdb's TRY/CATCH to sjlj again


We don't currently handle the case of gdb's readline callback throwing
gdb C++ exceptions across a readline that wasn't built with
-fexceptions.  The end result is:

 (gdb) whatever-command-that-causes-an-error
 terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
 Aborted
 $

Until that is fixed, revert back to sjlj-based exceptions again.

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

	* common/common-exceptions.h (GDB_XCPT_TRY): Add comment.
	(GDB_XCPT): Always define as GDB_XCPT_SJMP.
---
 gdb/ChangeLog                  |  5 +++++
 gdb/common/common-exceptions.h | 11 +++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6e09030..b6282e6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2016-04-21  Pedro Alves  <palves@redhat.com>
 
+	* common/common-exceptions.h (GDB_XCPT_TRY): Add comment.
+	(GDB_XCPT): Always define as GDB_XCPT_SJMP.
+
+2016-04-21  Pedro Alves  <palves@redhat.com>
+
 	* aix-thread.c (pdc_read_data, pdc_write_data): Add cast.
 	(aix_thread_resume): Use PTRACE_TYPE_ARG5.
 	* rs6000-nat.c (rs6000_ptrace64): Use PTRACE_TYPE_ARG5.
diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h
index 6a41741..1ef3db3 100644
--- a/gdb/common/common-exceptions.h
+++ b/gdb/common/common-exceptions.h
@@ -122,7 +122,9 @@ 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.  */
+/* 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).  */
 #define GDB_XCPT_TRY 2
 
 /* Specify this mode to build with TRY/CATCH mapped directly to raw
@@ -131,11 +133,8 @@ struct gdb_exception
    spurious code between the TRY and the CATCH block.  */
 #define GDB_XCPT_RAW_TRY 3
 
-#ifdef __cplusplus
-# define GDB_XCPT GDB_XCPT_TRY
-#else
-# define GDB_XCPT GDB_XCPT_SJMP
-#endif
+/* Always use setjmp/longmp, even in C++ mode.  */
+#define GDB_XCPT GDB_XCPT_SJMP
 
 /* Functions to drive the exceptions state machine.  Though declared
    here by necessity, these functions should be considered internal to
-- 
2.5.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]