Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Dmitry Antipov <dantipov@nvidia.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB Development <gdb@sourceware.org>
Subject: Re: "The target is not responding to interrupt requests" after re-attach
Date: Thu, 19 Oct 2017 11:57:00 -0000	[thread overview]
Message-ID: <fd91217d-4d53-1a9d-c957-1dec38a6a737@nvidia.com> (raw)
In-Reply-To: <f4a517f3-41b2-efc7-e00c-c9f11d29d7f3@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

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




[-- Attachment #2: gdbserver_sigio_fix.patch --]
[-- Type: text/x-patch, Size: 976 bytes --]

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.

  reply	other threads:[~2017-10-19 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 14:04 Dmitry Antipov
2017-10-19 11:39 ` Pedro Alves
2017-10-19 11:57   ` Dmitry Antipov [this message]
2017-10-19 13:21     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fd91217d-4d53-1a9d-c957-1dec38a6a737@nvidia.com \
    --to=dantipov@nvidia.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox