From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/3] Fix C++ exceptions across readline result in std::terminate() -> SIGABRT
Date: Thu, 21 Apr 2016 23:50:00 -0000 [thread overview]
Message-ID: <1461282640-30425-1-git-send-email-palves@redhat.com> (raw)
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
next 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 Pedro Alves [this message]
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 ` [PATCH 1/3] Rename rl_callback_read_char_wrapper -> gdb_rl_callback_read_char Pedro Alves
2016-04-21 23:50 ` [PATCH 3/3] Switch gdb's TRY/CATCH to C++ try/catch Pedro Alves
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-1-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