aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-01-08 19:16:54 +0000
committerPedro Alves <palves@redhat.com>2014-01-08 20:34:26 +0000
commit9939e1314f970c6ba568956148a518ac710a280a (patch)
treec0a1192c5f661b7dceac5a52d643f39f93187eba /gdb/gdbserver
parentb7ea362b023feba8d75d5831948bc0d8496b4069 (diff)
downloadgdb-9939e1314f970c6ba568956148a518ac710a280a.zip
gdb-9939e1314f970c6ba568956148a518ac710a280a.tar.gz
gdb-9939e1314f970c6ba568956148a518ac710a280a.tar.bz2
GDBserver: Discard previous queued events when GDB disconnects.
... not when a new GDB connection sends the status packet ('?'). Mainly just a cleanup/simplification, as GDB always sends '?' first. Tested on x86_64 Fedora 17. 2014-01-08 Pedro Alves <palves@redhat.com> * server.c (handle_status): Don't discard previous queued stop replies or thread's pending status here. (main) <disconnection>: Do it here instead.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/server.c9
2 files changed, 12 insertions, 3 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index bf874a1..adba6f6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
2014-01-08 Pedro Alves <palves@redhat.com>
+ * server.c (handle_status): Don't discard previous queued stop
+ replies or thread's pending status here.
+ (main) <disconnection>: Do it here instead.
+
+2014-01-08 Pedro Alves <palves@redhat.com>
+
* gdbthread.h (struct thread_info) <status_pending_p>: New field.
* server.c (visit_actioned_threads, handle_pending_status): New
function.
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 5e80075..c9d9eec 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -2635,9 +2635,6 @@ handle_status (char *own_buf)
/* GDB is connected, don't forward events to the target anymore. */
for_each_inferior (&all_processes, gdb_reattached_process);
- discard_queued_stop_replies (-1);
- for_each_inferior (&all_threads, clear_pending_status_callback);
-
/* In non-stop mode, we must send a stop reply for each stopped
thread. In all-stop mode, just send one for the first stopped
thread we find. */
@@ -3140,6 +3137,12 @@ main (int argc, char *argv[])
"Remote side has terminated connection. "
"GDBserver will reopen the connection.\n");
+ /* Get rid of any pending statuses. An eventual reconnection
+ (by the same GDB instance or another) will refresh all its
+ state from scratch. */
+ discard_queued_stop_replies (-1);
+ for_each_inferior (&all_threads, clear_pending_status_callback);
+
if (tracing)
{
if (disconnected_tracing)