Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Dmitry Antipov <dantipov@nvidia.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: <gdb@sourceware.org>, Ryan Bissell <rbissell@nvidia.com>,
	"Mikhail Filimonov" <mfilimonov@nvidia.com>
Subject: Re: Host GDB disconnect while waiting for tracee status change
Date: Wed, 23 Aug 2017 09:37:00 -0000	[thread overview]
Message-ID: <98251d5d-646b-296c-acf6-43ec4accd4e0@nvidia.com> (raw)
In-Reply-To: <867exusnn8.fsf@gmail.com>

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


  reply	other threads:[~2017-08-23  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 13:23 Dmitry Antipov
2017-08-23  8:18 ` Yao Qi
2017-08-23  9:37   ` Dmitry Antipov [this message]
2017-08-23 13:10     ` Pedro Alves
2017-08-23 13:56       ` Dmitry Antipov
2017-08-23 15:01         ` 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=98251d5d-646b-296c-acf6-43ec4accd4e0@nvidia.com \
    --to=dantipov@nvidia.com \
    --cc=gdb@sourceware.org \
    --cc=mfilimonov@nvidia.com \
    --cc=qiyaoltc@gmail.com \
    --cc=rbissell@nvidia.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