aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 33c41cc..f605845 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -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)