Add "info connections" command, "info inferiors" connection number/string
[deliverable/binutils-gdb.git] / gdb / target.c
index 33c41cc4b69ad5cc3e5d75e4da5bd6768342e8ee..f6058451d654351781106283138dc42e6860a54e 100644 (file)
@@ -49,6 +49,7 @@
 #include "gdbsupport/byte-vector.h"
 #include "terminal.h"
 #include <unordered_map>
+#include "target-connection.h"
 
 static void generic_tls_error (void) ATTRIBUTE_NORETURN;
 
@@ -561,7 +562,11 @@ decref_target (target_ops *t)
 {
   t->decref ();
   if (t->refcount () == 0)
-    target_close (t);
+    {
+      if (t->stratum () == process_stratum)
+       connection_list_remove (as_process_stratum_target (t));
+      target_close (t);
+    }
 }
 
 /* See target.h.  */
@@ -573,6 +578,9 @@ target_stack::push (target_ops *t)
 
   strata stratum = t->stratum ();
 
+  if (stratum == process_stratum)
+    connection_list_add (as_process_stratum_target (t));
+
   /* If there's already a target at this stratum, remove it.  */
 
   if (m_stack[stratum] != NULL)
This page took 0.023111 seconds and 4 git commands to generate.