[PUSHED 6/8] gdbserver: rename regcache's registers_valid to registers_fetched
Tankut Baris Aktemur
tankut.baris.aktemur@intel.com
Tue Dec 17 08:18:28 GMT 2024
The registers_valid field of the regcache struct is used for tracking
whether we have attempted to fetch all the registers from the target.
Its name does not reflect this well, I think. It falsely gives the
impression that all the registers are valid. This may conflict an
individual register status, which could be REG_UNAVAILABLE. To better
reflect the purpose, rename the field to "registers_fetched".
Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
gdbserver/regcache.cc | 12 ++++++------
gdbserver/regcache.h | 13 +++++++------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/gdbserver/regcache.cc b/gdbserver/regcache.cc
index 93bf5988a33..dad0907291b 100644
--- a/gdbserver/regcache.cc
+++ b/gdbserver/regcache.cc
@@ -46,7 +46,7 @@ get_thread_regcache (thread_info *thread, bool fetch)
thread->set_regcache (regcache);
}
- if (fetch && !regcache->registers_valid)
+ if (fetch && !regcache->registers_fetched)
{
scoped_restore_current_thread restore_thread;
@@ -55,7 +55,7 @@ get_thread_regcache (thread_info *thread, bool fetch)
memset (regcache->register_status, REG_UNAVAILABLE,
regcache->tdesc->reg_defs.size ());
fetch_inferior_registers (regcache, -1);
- regcache->registers_valid = true;
+ regcache->registers_fetched = true;
}
return regcache;
@@ -77,7 +77,7 @@ regcache_invalidate_thread (thread_info *thread)
if (regcache == NULL)
return;
- if (regcache->registers_valid)
+ if (regcache->registers_fetched)
{
scoped_restore_current_thread restore_thread;
@@ -85,7 +85,7 @@ regcache_invalidate_thread (thread_info *thread)
store_inferior_registers (regcache, -1);
}
- regcache->registers_valid = false;
+ regcache->registers_fetched = false;
}
/* See regcache.h. */
@@ -146,7 +146,7 @@ init_register_cache (struct regcache *regcache,
#endif
}
- regcache->registers_valid = false;
+ regcache->registers_fetched = false;
return regcache;
}
@@ -190,7 +190,7 @@ regcache::copy_from (regcache *src)
memcpy (this->register_status, src->register_status,
src->tdesc->reg_defs.size ());
#endif
- this->registers_valid = src->registers_valid;
+ this->registers_fetched = src->registers_fetched;
}
/* Return a reference to the description of register N. */
diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index c2e8e141d13..12345a3439c 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -33,12 +33,13 @@ struct regcache : public reg_buffer_common
/* The regcache's target description. */
const struct target_desc *tdesc = 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
- "valid" here is unrelated to whether the registers are available
- in a traceframe. For that, check REGISTER_STATUS below. */
- bool registers_valid = false;
+ /* Whether the REGISTERS buffer's contents are fetched. If false,
+ we haven't fetched the registers from the target yet. Note that
+ this register cache is _not_ pass-through, unlike GDB's. Also,
+ note that "fetched" here is unrelated to whether the registers
+ are available in a traceframe. For that, check REGISTER_STATUS
+ below. */
+ bool registers_fetched = false;
bool registers_owned = false;
unsigned char *registers = nullptr;
#ifndef IN_PROCESS_AGENT
--
2.34.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list