diff options
author | Pedro Alves <palves@redhat.com> | 2017-11-16 14:58:51 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2017-11-16 14:58:51 +0000 |
commit | e849ea896bcdc3da8caff02eb6dc91dc85dd8a7e (patch) | |
tree | c5eeabea2f3acb6c229627e80a9bb6b9d40f026d /gdb/gdbserver | |
parent | 80a0437873045cc08753fcac4af154e2931a99fd (diff) | |
download | gdb-e849ea896bcdc3da8caff02eb6dc91dc85dd8a7e.zip gdb-e849ea896bcdc3da8caff02eb6dc91dc85dd8a7e.tar.gz gdb-e849ea896bcdc3da8caff02eb6dc91dc85dd8a7e.tar.bz2 |
GDBserver: Fix ignored Ctrl-C after reconnection
This fixes the issue reported by Dmitry Antipov <dantipov@nvidia.com>
here:
https://sourceware.org/ml/gdb/2017-10/msg00048.html
The problem is that GDBserver stops listening to Ctrl-C/interrupt
requests if you disconnect and reconnect back.
Dmitry wrote:
~~~
Currently gdbserver installs SIGIO handler just once, in
initialize_async_io() called from captured_main(), and this handler is
removed when remote_desc is closed in remote_close(). Next, when a
new instance of remote_desc is fetched from accept() and has '\003'
arrived, input_interrupt() is never called because it is not
registered as SIGIO handler.
~~~
The fix here is not remove the SIGIO handler in the first place, thus
going back to the original before-first-connection state.
(I haven't gone back to try it, but I think this was a regression
caused by commit 8b2073398477 ("[GDBserver] Block and unblock SIGIO"),
which was what made remote_close remove the signal handler.)
New test included.
gdb/gdbserver/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* remote-utils.c (remote_close): Block SIGIO signals instead of
uninstalling the SIGIO handler.
gdb/testsuite/ChangeLog:
2017-11-16 Pedro Alves <palves@redhat.com>
* gdb.server/reconnect-ctrl-c.c: New file.
* gdb.server/reconnect-ctrl-c.exp: New file.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r-- | gdb/gdbserver/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdbserver/remote-utils.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 7e72b7c..d091b43 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2017-11-16 Pedro Alves <palves@redhat.com> + + * remote-utils.c (remote_close): Block SIGIO signals instead of + uninstalling the SIGIO handler. + 2017-11-16 Alan Hayward <alan.hayward@arm.com> * tdesc.c (tdesc_get_features_xml): Allow null osabi. diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 54f27f4..2e4888a 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -378,10 +378,7 @@ remote_close (void) { delete_file_handler (remote_desc); -#ifndef USE_WIN32API - /* Remove SIGIO handler. */ - signal (SIGIO, SIG_IGN); -#endif + disable_async_io (); #ifdef USE_WIN32API closesocket (remote_desc); |