aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe@sourceware.org>2012-02-03 22:52:32 +0000
committerPhilippe Waroquiers <philippe@sourceware.org>2012-02-03 22:52:32 +0000
commit5b37825d8476bc21cd2d78279481c0efc6b430c8 (patch)
treeba29548d6d3f57b8e754b9fdfa4f6ccb8dcf377e
parent2c175ebc7499ac7cfae6679f7b1ecbf43e822772 (diff)
downloadgdb-5b37825d8476bc21cd2d78279481c0efc6b430c8.zip
gdb-5b37825d8476bc21cd2d78279481c0efc6b430c8.tar.gz
gdb-5b37825d8476bc21cd2d78279481c0efc6b430c8.tar.bz2
The remote stub can implement monitor commands which are not
known by gdb. Such monitor commands can take a long time to execute. An example of this is the "leak_search" monitor command implemented in the Valgrind gdbserver. Currently, gdb will timeout on such a monitor command. The remote stub however will continue to execute the command and send the output later. Gdb and the remote stub can then be desynchronised : gdb sends a packet, and the reply read from the stub is a previous packet. The change committed uses getpkt_sane to detect a timeout. In this case, it continues the loop. A QUIT; is inserted in the loop to allow the user to stop handling the current command. possibly still creating a desynchronisation between gdb and the stub but that will be upon user request.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/remote.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ddef913..9fb261a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * remote.c (remote_rcmd): Use getpkt_sane to detect timeout
+ and continue the loop. Add QUIT statement.
+
2012-02-03 Tom Tromey <tromey@redhat.com>
PR gdb/13596:
diff --git a/gdb/remote.c b/gdb/remote.c
index 1c37b69..3187ac0 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8590,8 +8590,17 @@ remote_rcmd (char *command,
char *buf;
/* XXX - see also remote_get_noisy_reply(). */
+ QUIT; /* Allow user to bail out with ^C. */
rs->buf[0] = '\0';
- getpkt (&rs->buf, &rs->buf_size, 0);
+ if (getpkt_sane (&rs->buf, &rs->buf_size, 0) == -1)
+ {
+ /* Timeout. Continue to (try to) read responses.
+ This is better than stopping with an error, assuming the stub
+ is still executing the (long) monitor command.
+ If needed, the user can interrupt gdb using C-c, obtaining
+ an effect similar to stop on timeout. */
+ continue;
+ }
buf = rs->buf;
if (buf[0] == '\0')
error (_("Target does not support this command."));