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]

[PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT


We saw that if we map GDB'S TRY/CATCH macros to C++ try/catch, GDB
breaks on systems where readline isn't built with exceptions support.

Yao tripped on this on ARM/Fedora 19, and I saw the same thing on AIX.

The problem is that readline calls into GDB through the callback
interface, and if GDB's callback throws a C++ exception/error, the
system unwinder won't manage to unwind past the readline frame, and
ends up calling std::terminate(), which aborts the process:

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

This series:

 - stops GDB from throwing C++ exceptions across readline.

 - then flips back TRY/CATCH to C++ try/catch (which is necessary for
   automatically calling local variable destructors when
   throw_exception is called).

Tested on x86_64 Fedora, and confirmed that it fixes the issue on AIX.

Pedro Alves (3):
  Rename rl_callback_read_char_wrapper -> gdb_rl_callback_read_char
  Propagate GDB/C++ exceptions across readline using sj/lj-based
    TRY/CATCH
  Switch gdb's TRY/CATCH to C++ try/catch

 gdb/common/common-exceptions.h |  69 ++++++++++++++-----------
 gdb/common/common-exceptions.c |  38 +++++++++++---
 gdb/event-top.c                | 112 +++++++++++++++++++++++++++++++++++------
 3 files changed, 169 insertions(+), 50 deletions(-)

-- 
2.5.5


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