gdb: remove reference to current inferior in target_stack::unpush
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 7 May 2021 15:52:51 +0000 (11:52 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 7 May 2021 15:52:51 +0000 (11:52 -0400)
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

gdb/ChangeLog
gdb/target.c

index b93a1dda8dd3b4c0f25c983318e6ea74a0f8086a..e75eb04247b78c4c43d8130c030fdc0345b60717 100644 (file)
@@ -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
index 00f0acde7586ee15e89c3774b0e44596c328d286..78327a2a6c338423008d3562e8ab51d67b49d0af 100644 (file)
@@ -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,
This page took 0.034302 seconds and 4 git commands to generate.