Add a back-link in regcache to the thread that owns the regcache.
This will help us in future patches to refer to the right thread
object without having to rely on the global current_thread pointer.
---
gdbserver/regcache.cc | 1 +
gdbserver/regcache.h | 3 +++
2 files changed, 4 insertions(+)
@@ -45,6 +45,7 @@ get_thread_regcache (struct thread_info *thread, bool fetch)
regcache = new struct regcache (proc->tdesc);
set_thread_regcache_data (thread, regcache);
+ regcache->thread = thread;
}
if (fetch && regcache->registers_valid == 0)
@@ -33,6 +33,9 @@ struct regcache : public reg_buffer_common
/* The regcache's target description. */
const struct target_desc *tdesc = nullptr;
+ /* Back-link to the thread to which this regcache belongs. */
+ thread_info *thread = nullptr;
+
/* Whether the REGISTERS buffer's contents are valid. If false, we
haven't fetched the registers from the target yet. Not that this
register cache is _not_ pass-through, unlike GDB's. Note that