remote: Move discard_pending_stop_replies call
authorPedro Alves <palves@redhat.com>
Tue, 22 May 2018 17:22:09 +0000 (18:22 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 22 May 2018 17:33:44 +0000 (18:33 +0100)
This helps because discard_pending_stop_replies will later become a
method of remote_target.  Otherwise, when we have multiple instances
of remote_target, we'd have to make discard_pending_stop_replies find
the inferior's target_ops, and upcast it to remote_target (if indeed a
remote) to find the pending stop replies queue to clear.

gdb/ChangeLog:
2018-05-22  Pedro Alves  <palves@redhat.com>

* remote.c (remote_target::mourn_inferior): Move
discard_pending_stop_replies call here from ...
(_initialize_remote): ... here.

gdb/ChangeLog
gdb/remote.c

index 205dd4d388b7b921cd60c43e6a44749bc62fe36c..55afb54ec6b7efde5d12cc013ed6566673da49f3 100644 (file)
@@ -1,3 +1,9 @@
+2018-05-22  Pedro Alves  <palves@redhat.com>
+
+       * remote.c (remote_target::mourn_inferior): Move
+       discard_pending_stop_replies call here from ...
+       (_initialize_remote): ... here.
+
 2018-05-22  Pedro Alves  <palves@redhat.com>
 
        * remote.c (compare_section_command): Remove set_general_process
index fbf23b8a4378b8e5c3eac3f0239574fffceed70f..59880a93a87a5f23a9cfb2713fcbb404744e6b45 100644 (file)
@@ -9671,6 +9671,10 @@ remote_target::mourn_inferior ()
 {
   struct remote_state *rs = get_remote_state ();
 
+  /* We're no longer interested in notification events of an inferior
+     that exited or was killed/detached.  */
+  discard_pending_stop_replies (current_inferior ());
+
   /* In 'target remote' mode with one inferior, we close the connection.  */
   if (!rs->extended && number_of_live_inferiors () <= 1)
     {
@@ -14073,9 +14077,6 @@ _initialize_remote (void)
 
   /* Hook into new objfile notification.  */
   gdb::observers::new_objfile.attach (remote_new_objfile);
-  /* We're no longer interested in notification events of an inferior
-     when it exits.  */
-  gdb::observers::inferior_exit.attach (discard_pending_stop_replies);
 
 #if 0
   init_remote_threadtests ();
This page took 0.032405 seconds and 4 git commands to generate.