Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Philippe Waroquiers" <philippe.waroquiers@skynet.be>
To: <gdb@sourceware.org>
Subject: gdbserver/gdb cannot resync remote protocol after a timeout
Date: Tue, 21 Jun 2011 20:59:00 -0000	[thread overview]
Message-ID: <367727AC632C495DB8E64FEE16ADAD75@soleil> (raw)


If ever the remote timeout expires between gdb and gdbserver, then after that,
gdb cannot properly resynchronise anymore the queries and the replies.
(problem initially encountered with a Valgrind gdbserver "monitor mc.leak_check"
monitor command, which can take some time for large heap to check).

I have reproduced this by inserting a line
   poll(NULL, 0, 10000);
at the beginning of the function monitor_show_help() of the gdbserver of gdb.

Then "monitor help" reproduces the same de-synchronisation.
See below the packets trace. After the timeout, any query packet gets
an error (or get back the reply of a previous packet).

I know that the timeout can be configured, but if when this timeout expires,
gdb can't resync, what is the reason to have a timeout ?
Or maybe the "desync" only happens in noack mode ? Then in noack mode,
the timeout value should better be always ignored.

In case there was a timeout, shouldn't gdb first "drop all packets it can"
before launching another command ?
This would resync after a timeout.

Alternatively, the "qRcmd" could be made "less time sensitive", either by
looping on getpkt_sane till the user types Control-c
or by temporarily increase the timeout (like "vFlashWrite:",).

Philippe


(gdb) tar rem :1234
Remote debugging using :1234
warning: Can not parse XML target description; XML support was disabled at compile time
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
0xb7730850 in ?? () from /lib/ld-linux.so.2
Created trace state variable $trace_timestamp for target's variable 1.
(gdb) set debug remote 1
(gdb) monitor help
Sending packet: $qRcmd,68656c70#fc...Timed out.
Timed out.
Timed out.
Ignoring packet error, continuing...
Reply contains invalid hex digit 116
(gdb) info auxv
Sending packet: $qXfer:auxv:read::0,1000#6b...Packet received: 
O54686520666f6c6c6f77696e67206d6f6e69746f7220636f6d6d616e64732061726520737570706f727465643a0a
Unknown remote qXfer reply: O54686520666f6c6c6f77696e67206d6f6e69746f7220636f6d6d616e64732061726520737570706f727465643a0a
(gdb) info auxv
Sending packet: $qXfer:auxv:read::0,1000#6b...Packet received: O2020736574206465627567203c307c313e0a
Unknown remote qXfer reply: O2020736574206465627567203c307c313e0a
(gdb)


                 reply	other threads:[~2011-06-21 20:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=367727AC632C495DB8E64FEE16ADAD75@soleil \
    --to=philippe.waroquiers@skynet.be \
    --cc=gdb@sourceware.org \
    /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