public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: remove reference to current inferior in target_stack::unpush
@ 2021-05-07 15:53 Simon Marchi
0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2021-05-07 15:53 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bedc473418aa3b595a985e4adbbeb7864c5891e3
commit bedc473418aa3b595a985e4adbbeb7864c5891e3
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Fri May 7 11:52:51 2021 -0400
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
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/target.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b93a1dda8dd..e75eb04247b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/gdb/target.c b/gdb/target.c
index 00f0acde758..78327a2a6c3 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,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-07 15:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 15:53 [binutils-gdb] gdb: remove reference to current inferior in target_stack::unpush Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).