#define REGCACHE_H
#include "common-regcache.h"
+#include <forward_list>
struct regcache;
struct regset;
: regcache (gdbarch, aspace_, true)
{}
+ struct readonly_t {};
+ static constexpr readonly_t readonly {};
+
+ /* Create a readonly regcache from a non-readonly regcache. */
+ regcache (readonly_t, const regcache &src);
+
+ regcache (const regcache &) = delete;
+ void operator= (const regcache &) = delete;
+
+ /* class regcache is only extended in unit test, so only mark it
+ virtual when selftest is enabled. */
+#if GDB_SELF_TEST
+ virtual
+#endif
~regcache ()
{
xfree (m_registers);
void cooked_write (int regnum, const gdb_byte *buf);
enum register_status raw_read (int regnum, gdb_byte *buf);
+
+ /* class regcache is only extended in unit test, so only mark it
+ virtual when selftest is enabled. */
+#if GDB_SELF_TEST
+ virtual
+#endif
void raw_write (int regnum, const gdb_byte *buf);
enum register_status raw_read_signed (int regnum, LONGEST *val);
void raw_collect (int regnum, void *buf) const;
+ void raw_collect_integer (int regnum, gdb_byte *addr, int addr_len,
+ bool is_signed) const;
+
void raw_supply (int regnum, const void *buf);
+ void raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len,
+ bool is_signed);
+
+ void raw_supply_zeroed (int regnum);
+
enum register_status get_register_status (int regnum) const;
void raw_set_cached_value (int regnum, const gdb_byte *buf);
debug. */
void debug_print_register (const char *func, int regno);
-private:
+ static void regcache_thread_ptid_changed (ptid_t old_ptid, ptid_t new_ptid);
+protected:
regcache (gdbarch *gdbarch, address_space *aspace_, bool readonly_p_);
+ static std::forward_list<regcache *> current_regcache;
+
+private:
gdb_byte *register_buffer (int regnum) const;
void restore (struct regcache *src);
get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
struct address_space *aspace);
+ friend void
+ registers_changed_ptid (ptid_t ptid);
+
friend void
regcache_cpy (struct regcache *dst, struct regcache *src);
};