diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2021-05-07 11:51:19 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-07 11:51:39 -0400 |
commit | 27f0a4314aa5f81329e52dfbb4d06756415a4c53 (patch) | |
tree | 6e534b942ac229c1f16fd94e5c010352464000bf /gdb/target.c | |
parent | 1d1669e40f89a34ae2804ee040df2bf77ed29df8 (diff) | |
download | gdb-27f0a4314aa5f81329e52dfbb4d06756415a4c53.zip gdb-27f0a4314aa5f81329e52dfbb4d06756415a4c53.tar.gz gdb-27f0a4314aa5f81329e52dfbb4d06756415a4c53.tar.bz2 |
gdb: make target_close check that the target isn't pushed in all inferiors
The target_close function currently checks that the target to be closed
isn't pushed in the current inferior:
gdb_assert (!current_inferior ()->target_is_pushed (targ));
Normally, a target is closed when its refcount has dropped to 0, due to
not being used in any inferior anymore. I think it would make sense to
change that assert to not only check in the current inferior, but to
check in all inferiors. It would be quite bad (and a bug) to close a
target while it's still pushed in one of the non-current inferiors.
gdb/ChangeLog:
* target.c (target_close): Check in all inferiors that the
target is not pushed.
Change-Id: I6e37fc3f3476a0593da1e476604642b2de90f1d5
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/target.c b/gdb/target.c index 1f07414..00f0acd 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3734,7 +3734,8 @@ debug_target::info () const void target_close (struct target_ops *targ) { - gdb_assert (!current_inferior ()->target_is_pushed (targ)); + for (inferior *inf : all_inferiors ()) + gdb_assert (!inf->target_is_pushed (targ)); fileio_handles_invalidate_target (targ); |