extern int register_size (struct gdbarch *gdbarch, int regnum);
-typedef enum register_status (regcache_cooked_read_ftype) (void *src,
- int regnum,
- gdb_byte *buf);
+typedef gdb::function_view<register_status (int regnum, gdb_byte *buf)>
+ register_read_ftype;
/* A (register_number, register_value) pair. */
virtual ~reg_buffer () = default;
+ /* See common/common-regcache.h. */
+ bool raw_compare (int regnum, const void *buf, int offset) const override;
+
protected:
/* Assert on the range of REGNUM. */
void assert_regnum (int regnum) const;
/* Save a register cache. The set of registers saved into the
regcache determined by the save_reggroup. COOKED_READ returns
zero iff the register's value can't be returned. */
- void save (regcache_cooked_read_ftype *cooked_read, void *src);
+ void save (register_read_ftype cooked_read);
struct regcache_descr *m_descr;
struct value *cooked_read_value (int regnum);
protected:
- enum register_status read_part (int regnum, int offset, int len, void *in,
- bool is_raw);
+
+ /* Perform a partial register transfer using a read, modify, write
+ operation. Will fail if register is currently invalid. */
+ enum register_status read_part (int regnum, int offset, int len,
+ gdb_byte *out, bool is_raw);
};
/* Buffer of registers, can be read and written. */
int regnum, const void *in_buf,
void *out_buf, size_t size) const;
+ /* Perform a partial register transfer using a read, modify, write
+ operation. */
enum register_status write_part (int regnum, int offset, int len,
- const void *out, bool is_raw);
-
+ const gdb_byte *in, bool is_raw);
/* The address space of this register cache (for registers where it
makes sense, like PC or SP). */
class readonly_detached_regcache : public readable_regcache
{
public:
- readonly_detached_regcache (const regcache &src);
+ readonly_detached_regcache (regcache &src);
/* Create a readonly regcache by getting contents from COOKED_READ. */
- readonly_detached_regcache (gdbarch *gdbarch,
- regcache_cooked_read_ftype *cooked_read,
- void *src)
+ readonly_detached_regcache (gdbarch *gdbarch, register_read_ftype cooked_read)
: readable_regcache (gdbarch, true)
{
- save (cooked_read, src);
+ save (cooked_read);
}
DISABLE_COPY_AND_ASSIGN (readonly_detached_regcache);