aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-06-18 14:26:30 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-08-11 12:35:14 +0100
commitd03277b79793adec2508d51f8d789cd3761d9b9d (patch)
tree8f8974ee4e43c775da054ebdb09321eaaef2fd8d /gdb/event-top.c
parent6aa4f97c2b8a3fe3775d90c7485f4ace610fb103 (diff)
downloadfsf-binutils-gdb-d03277b79793adec2508d51f8d789cd3761d9b9d.zip
fsf-binutils-gdb-d03277b79793adec2508d51f8d789cd3761d9b9d.tar.gz
fsf-binutils-gdb-d03277b79793adec2508d51f8d789cd3761d9b9d.tar.bz2
gdb: register SIGBUS, SIGFPE, and SIGABRT handlers
Register handlers for SIGBUS, SIGFPE, and SIGABRT. All of these signals are setup as fatal signals that will cause GDB to terminate. However, by passing these signals through the handle_fatal_signal function, a user can arrange to see a backtrace when GDB terminates (see maint set backtrace-on-fatal-signal). In normal use of GDB there should be no user visible changes after this commit. Only if GDB terminates with one of the above signals will GDB change slightly, potentially printing a backtrace before aborting. I've added new tests for SIGFPE, SIGBUS, and SIGABRT.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 210440a..9233a36 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -1025,7 +1025,10 @@ static struct serial_event *quit_serial_event;
with the reception of the signal.
For SIGSEGV the handle_sig* function does all the work for handling this
- signal. */
+ signal.
+
+ For SIGFPE, SIGBUS, and SIGABRT, these signals will all cause GDB to
+ terminate immediately. */
void
gdb_init_signals (void)
{
@@ -1061,6 +1064,18 @@ gdb_init_signals (void)
create_async_signal_handler (async_sigtstp_handler, NULL, "sigtstp");
#endif
+#ifdef SIGFPE
+ signal (SIGFPE, handle_fatal_signal);
+#endif
+
+#ifdef SIGBUS
+ signal (SIGBUS, handle_fatal_signal);
+#endif
+
+#ifdef SIGABRT
+ signal (SIGABRT, handle_fatal_signal);
+#endif
+
install_handle_sigsegv ();
}