This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "The target is not responding to interrupt requests" after re-attach
On 10/19/2017 02:39 PM, Pedro Alves wrote:
No good reason. Sounds like you found a bug.
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.
Probably the fix is to (re)install SIGIO handler each time when a new
async-served descriptor gets hooked into an event loop, for example,
in enable_async_notification ().
Dmitry
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 66e065225b..f686debeaa 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -92,6 +92,7 @@ static int readchar_callback = NOT_SCHEDULED;
static int readchar (void);
static void reset_readchar (void);
static void reschedule (void);
+static void input_interrupt (int);
/* A cache entry for a successfully looked-up symbol. */
struct sym_cache
@@ -149,6 +150,10 @@ enable_async_notification (int fd)
fcntl (fd, F_SETOWN, getpid ());
#endif
#endif
+ /* Install SIGIO handler. */
+#ifndef USE_WIN32API
+ signal (SIGIO, input_interrupt);
+#endif
}
static int
@@ -859,11 +864,6 @@ initialize_async_io (void)
/* Make sure that async I/O starts blocked. */
async_io_enabled = 1;
disable_async_io ();
-
- /* Install the signal handler. */
-#ifndef USE_WIN32API
- signal (SIGIO, input_interrupt);
-#endif
}
/* Internal buffer used by readchar.