From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41748 invoked by alias); 19 Oct 2017 11:57:56 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 41734 invoked by uid 89); 19 Oct 2017 11:57:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=arrived X-HELO: hqemgate14.nvidia.com Received: from hqemgate14.nvidia.com (HELO hqemgate14.nvidia.com) (216.228.121.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Oct 2017 11:57:54 +0000 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com id ; Thu, 19 Oct 2017 04:57:08 -0700 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Thu, 19 Oct 2017 04:57:26 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Thu, 19 Oct 2017 04:57:26 -0700 Received: from UKMAIL102.nvidia.com (10.26.138.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 19 Oct 2017 11:57:11 +0000 Received: from localhost.localdomain (10.21.45.12) by UKMAIL102.nvidia.com (10.26.138.15) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 19 Oct 2017 11:57:08 +0000 Subject: Re: "The target is not responding to interrupt requests" after re-attach To: Pedro Alves References: <6c9c532c-8094-9df5-1a8c-556ea92a9b5a@nvidia.com> From: Dmitry Antipov CC: GDB Development Message-ID: Date: Thu, 19 Oct 2017 11:57:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------6176D6F5168432C5427D073B" X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL102.nvidia.com (10.26.138.15) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00056.txt.bz2 --------------6176D6F5168432C5427D073B Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-length: 635 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 --------------6176D6F5168432C5427D073B Content-Type: text/x-patch; name="gdbserver_sigio_fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdbserver_sigio_fix.patch" Content-length: 976 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. --------------6176D6F5168432C5427D073B--