From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75438 invoked by alias); 23 Aug 2017 09:37:52 -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 75404 invoked by uid 89); 23 Aug 2017 09:37:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=tcp, listen X-HELO: hqemgate15.nvidia.com Received: from hqemgate15.nvidia.com (HELO hqemgate15.nvidia.com) (216.228.121.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Aug 2017 09:37:49 +0000 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Wed, 23 Aug 2017 02:37:23 -0700 Received: from HQMAIL107.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Wed, 23 Aug 2017 02:37:24 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Wed, 23 Aug 2017 02:37:24 -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; Wed, 23 Aug 2017 09:37:20 +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.1263.5; Wed, 23 Aug 2017 09:37:16 +0000 Subject: Re: Host GDB disconnect while waiting for tracee status change To: Yao Qi CC: , Ryan Bissell , "Mikhail Filimonov" References: <5febbe3e-926f-78bb-db88-901b44e2e258@nvidia.com> <867exusnn8.fsf@gmail.com> From: Dmitry Antipov Message-ID: <98251d5d-646b-296c-acf6-43ec4accd4e0@nvidia.com> Date: Wed, 23 Aug 2017 09:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <867exusnn8.fsf@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To UKMAIL102.nvidia.com (10.26.138.15) X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00061.txt.bz2 On 08/23/2017 11:18 AM, Yao Qi wrote: > I didn't try GDBserver under the case you described, but I find > something related int GDB manual, > > https://sourceware.org/gdb/onlinedocs/gdb/Server.html > "Therefore, when the connection drops unexpectedly, and GDB cannot ask > gdbserver to kill its debugged processes, gdbserver stays running even > in the target remote mode." It's definitely stays running, but seems doesn't listen for remote connection attempts anymore. For example: $ cat /tmp/t-simple.c int main (int argc, char *argv[]) { while (1) (void) argc; return 0; } $ gdbserver --debug --attach tcp:9999 $(pidof t-simple) $ gdb -q (gdb) target extended-remote :9999 Remote debugging using :9999 [...skipped...] 0x00000000004004f2 in main (argc=1, argv=0x7ffec6b6b208) at /tmp/t-simple.c:1 1 int main (int argc, char *argv[]) { while (1) (void) argc; return 0; } (gdb) c Continuing. Segmentation fault (core dumped) ;; Due to killall -11 gdb from another TTY Immediately after killing gdb, gdbserver reports: ... client connection closed my_waitpid (-1, 0x40000001) my_waitpid (-1, 0x40000001): status(ffffffff), 0 LWFE: waitpid(-1, ...) returned 0, ERRNO-OK leader_pid=21352, leader_lp!=NULL=1, num_lwps=1, zombie=0 sigsuspend'ing ... Next, a new instance of gdb is unable to reconnect: $ gdb -q (gdb) target extended-remote :9999 Remote debugging using :9999 Ignoring packet error, continuing... warning: unrecognized item "timeout" in "qSupported" response Ignoring packet error, continuing... Remote replied unexpectedly to 'vMustReplyEmpty': timeout And it seems that there is no similar issue in a non-stop mode. For example: $ gdb -q (gdb) set non-stop 1 (gdb) target extended-remote :9999 Remote debugging using :9999 [...skipped...] Program stopped. 0x00000000004004f2 in main (argc=1, argv=0x7ffc72333088) at /tmp/t-simple.c:1 1 int main (int argc, char *argv[]) { while (1) (void) argc; return 0; } (gdb) c Continuing. Segmentation fault (core dumped) ;; Due to killall -11 gdb from another TTY Immediately after killing gdb, gdbserver reports: ... handling possible serial event Remote side has terminated connection. GDBserver will reopen the connection. Listening on port 9999 ... This way, a new instance of gdb can reconnect: $ gdb -q (gdb) set non-stop 1 (gdb) target extended-remote :9999 Remote debugging using :9999 [...skipped...] (gdb) interrupt Program stopped. 0x00000000004004f2 in main (argc=1, argv=0x7ffc72333088) at /tmp/t-simple.c:1 1 int main (int argc, char *argv[]) { while (1) (void) argc; return 0; } (gdb) Dmitry