diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2021-05-07 11:52:51 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-05-07 11:52:51 -0400 |
commit | bedc473418aa3b595a985e4adbbeb7864c5891e3 (patch) | |
tree | a3ad29e58b57886124170cfef73e9149bdc274e7 /gdb | |
parent | 27f0a4314aa5f81329e52dfbb4d06756415a4c53 (diff) | |
download | gdb-bedc473418aa3b595a985e4adbbeb7864c5891e3.zip gdb-bedc473418aa3b595a985e4adbbeb7864c5891e3.tar.gz gdb-bedc473418aa3b595a985e4adbbeb7864c5891e3.tar.bz2 |
gdb: remove reference to current inferior in target_stack::unpush
target_stack::unpush needs to get the target beneath the target being
unpushed to update the m_top field (which keeps the stratum of the
top-most target). It currently does so using target_ops::beneath, which
uses the target stack of the current inferior. The target stack of the
current inferior is the same as the `this` in the unpush method.
Avoid this detour and remove this reference to the current inferior by
calling target_ops::find_beneath and passing `this` to find the target
beneath `t` in the target stack that is `this`.
gdb/ChangeLog:
* target.c (target_stack::unpush): Call target_ops::find_beneath
to get the target beneath `t`.
Change-Id: If9d9661567c5c16f655d270bd2ec9f1b3aa6dadc
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/target.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b93a1dd..e75eb04 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2021-05-07 Simon Marchi <simon.marchi@efficios.com> + * target.c (target_stack::unpush): Call target_ops::find_beneath + to get the target beneath `t`. + +2021-05-07 Simon Marchi <simon.marchi@efficios.com> + * target.c (target_close): Check in all inferiors that the target is not pushed. diff --git a/gdb/target.c b/gdb/target.c index 00f0acd..78327a2 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1214,7 +1214,7 @@ target_stack::unpush (target_ops *t) m_stack[stratum] = NULL; if (m_top == stratum) - m_top = t->beneath ()->stratum (); + m_top = this->find_beneath (t)->stratum (); /* Finally close the target, if there are no inferiors referencing this target still. Note we do this after unchaining, |