This is the mail archive of the
mailing list for the GDB project.
[PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 22 Apr 2016 00:50:37 +0100
- Subject: [PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT
- Authentication-results: sourceware.org; auth=none
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:
terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR'
- 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
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(-)