btrace: Replace struct btrace_function::segment.
[deliverable/binutils-gdb.git] / gdb / regcache.h
index e03a39fbcef7650b87706cc9bc009d9a319b6544..4cf27a0b673f9e398f8fe33138d022c6e76a5e6f 100644 (file)
@@ -21,6 +21,7 @@
 #define REGCACHE_H
 
 #include "common-regcache.h"
+#include <forward_list>
 
 struct regcache;
 struct regset;
@@ -240,6 +241,20 @@ public:
     : 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);
@@ -259,6 +274,12 @@ public:
   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);
@@ -283,8 +304,16 @@ public:
 
   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);
@@ -325,9 +354,13 @@ public:
    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);
@@ -371,6 +404,9 @@ private:
   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);
 };
This page took 0.027106 seconds and 4 git commands to generate.