diff options
author | Tom Tromey <tom@tromey.com> | 2019-03-04 15:12:04 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-11-26 14:02:57 -0700 |
commit | 3b3978bca2a204a772563c8e121e4a02be72e802 (patch) | |
tree | 70076c2fc0433920de0b7a71ae12b34311a5fdfa /gdb/python/py-cmd.c | |
parent | 9411c49ecc09df989ecddb05e1756e0a9da0d1c8 (diff) | |
download | binutils-3b3978bca2a204a772563c8e121e4a02be72e802.zip binutils-3b3978bca2a204a772563c8e121e4a02be72e802.tar.gz binutils-3b3978bca2a204a772563c8e121e4a02be72e802.tar.bz2 |
Introduce thread-safe way to handle SIGSEGV
The gdb demangler installs a SIGSEGV handler in order to protect gdb
from demangler bugs. However, this is not thread-safe, as signal
handlers are global to the process.
This patch changes gdb to always install a global SIGSEGV handler, and
then lets threads indicate their interest in handling the signal by
setting a thread-local variable.
This patch then arranges for the demangler code to use this; being
sure to arrange for calls to warning and the like to be done on the
main thread.
One thing I wondered while writing this patch is if there are any
systems that do not have "sigaction". If gdb could assume this, it
would simplify this code.
gdb/ChangeLog
2019-11-26 Tom Tromey <tom@tromey.com>
* event-top.h (thread_local_segv_handler): Declare.
* event-top.c (thread_local_segv_handler): New global.
(install_handle_sigsegv, handle_sigsegv): New functions.
(async_init_signals): Install SIGSEGV handler.
* cp-support.c (gdb_demangle_jmp_buf): Change type. Now
thread-local.
(report_failed_demangle): New function.
(gdb_demangle): Make core_dump_allowed atomic. Remove signal
handler-setting code, instead use segv_handler. Run warning code
on main thread.
Change-Id: Ic832bbb033b64744e4b44f14b41db7e4168ce427
Diffstat (limited to 'gdb/python/py-cmd.c')
0 files changed, 0 insertions, 0 deletions