[PATCH 20/26] gdbserver: make some regcache fields private

Tankut Baris Aktemur via Gdb-patches
2023-02-28T11:32:30Z

Some fields of the regcache struct are used for internal state
tracking. Prevent direct access to them from outside by making them
private.
---
gdbserver/regcache.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/gdbserver/regcache.h b/gdbserver/regcache.h
index ad71a9acaec..be412bc3765 100644
--- a/gdbserver/regcache.h
+++ b/gdbserver/regcache.h
@@ -36,6 +36,8 @@ struct regcache : public reg_buffer_common
/* Back-link to the thread to which this regcache belongs. */
thread_info *thread = nullptr;

+private:
+
/* 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,
@@ -49,6 +51,8 @@ struct regcache : public reg_buffer_common
/* See gdbsupport/common-regcache.h. */
enum register_status *register_status = nullptr;

+public:
+
/* Constructors. */
regcache () = default;
regcache (const target_desc *tdesc);
@@ -59,6 +63,8 @@ struct regcache : public reg_buffer_common
virtual ~regcache ();
#endif

+public:
+
/* Init the regcache data. */
void initialize (const target_desc *tdesc, unsigned char *regbuf);

--
2.25.1

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva