aboutsummaryrefslogtreecommitdiff
path: root/gdb/event-top.c
diff options
context:
space:
mode:
authorAndrew Stubbs <andrew.stubbs@st.com>2005-11-25 18:33:12 +0000
committerAndrew Stubbs <andrew.stubbs@st.com>2005-11-25 18:33:12 +0000
commita7266fef19dfc55fd00c0fbe4db8b277424ea52d (patch)
tree3d457523f8d699136a4528aa8019e6b855bfbe2d /gdb/event-top.c
parentb5f558d4051798191faa80960ad0b12c1b51066f (diff)
downloadfsf-binutils-gdb-a7266fef19dfc55fd00c0fbe4db8b277424ea52d.zip
fsf-binutils-gdb-a7266fef19dfc55fd00c0fbe4db8b277424ea52d.tar.gz
fsf-binutils-gdb-a7266fef19dfc55fd00c0fbe4db8b277424ea52d.tar.bz2
2005-11-16 Andrew Stubbs <andrew.stubbs@st.com>
* event-top.h (async_init_signals): Add SIGTERM handler. (handle_sigterm): New function. * event-top.h (handle_sigterm): New prototype.
Diffstat (limited to 'gdb/event-top.c')
-rw-r--r--gdb/event-top.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/event-top.c b/gdb/event-top.c
index 438ef20..49b5666 100644
--- a/gdb/event-top.c
+++ b/gdb/event-top.c
@@ -892,6 +892,7 @@ async_init_signals (void)
signal (SIGINT, handle_sigint);
sigint_token =
create_async_signal_handler (async_request_quit, NULL);
+ signal (SIGTERM, handle_sigterm);
/* If SIGTRAP was set to SIG_IGN, then the SIG_IGN will get passed
to the inferior and breakpoints will be ignored. */
@@ -964,6 +965,15 @@ handle_sigint (int sig)
mark_async_signal_handler_wrapper (sigint_token);
}
+/* Quit GDB if SIGTERM is received.
+ GDB would quit anyway, but this way it will clean up properly. */
+void
+handle_sigterm (int sig)
+{
+ signal (sig, handle_sigterm);
+ quit_force ((char *) 0, stdin == instream);
+}
+
/* Do the quit. All the checks have been done by the caller. */
void
async_request_quit (gdb_client_data arg)