diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a6e993eae45..a03ca355f83 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2015-07-27 Patrick Palka + + * event-top.c (handle_sigterm): Don't inspect + target_can_async_p. Always set the quit flag and always mark + the async signal handler. + 2015-07-27 Yao Qi * Makefile.in (REMOTE_EXAMPLES): Remove it. diff --git a/gdb/event-top.c b/gdb/event-top.c index e9cc2d7d3e1..1762e3bd8e1 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -876,15 +876,10 @@ handle_sigterm (int sig) { signal (sig, handle_sigterm); - /* Call quit_force in a signal safe way. - quit_force itself is not signal safe. */ - if (target_can_async_p ()) - mark_async_signal_handler (async_sigterm_token); - else - { - sync_quit_force_run = 1; - set_quit_flag (); - } + sync_quit_force_run = 1; + set_quit_flag (); + + mark_async_signal_handler (async_sigterm_token); } /* Do the quit. All the checks have been done by the caller. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1faf1ab62c7..818ea30d3b7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-07-27 Patrick Palka + + * gdb.base/gdb-sigterm-2.exp: New test. + 2015-07-25 Doug Evans Revert: diff --git a/gdb/testsuite/gdb.base/gdb-sigterm-2.exp b/gdb/testsuite/gdb.base/gdb-sigterm-2.exp new file mode 100644 index 00000000000..e2121a4e153 --- /dev/null +++ b/gdb/testsuite/gdb.base/gdb-sigterm-2.exp @@ -0,0 +1,32 @@ +# This testcase is part of GDB, the GNU debugger. +# +# Copyright 2015 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check that GDB promptly quits after receiving a SIGTERM while no proper +# target is active. + +gdb_start + +set gdb_pid [exp_pid -i [board_info host fileid]] +remote_exec host "kill -TERM $gdb_pid" + +set test "expect eof" +gdb_test_multiple "" $test { + -timeout 5 + eof { + pass $test + } +}