aboutsummaryrefslogtreecommitdiff
path: root/gdb/common
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2018-06-11 10:09:16 +0100
committerAlan Hayward <alan.hayward@arm.com>2018-06-11 10:09:16 +0100
commit9c861883169cb9eec4581ab6db3a1b711e79ee10 (patch)
tree24530802092757d9aaf0e0f93e0e7cae3507aa8d /gdb/common
parent953edf2b6cfe765ca7176c414e9f63aa62bdb09c (diff)
downloadbinutils-9c861883169cb9eec4581ab6db3a1b711e79ee10.zip
binutils-9c861883169cb9eec4581ab6db3a1b711e79ee10.tar.gz
binutils-9c861883169cb9eec4581ab6db3a1b711e79ee10.tar.bz2
Add reg_buffer_common
A purely virtual class containing functions from gdb/regcache.h Both the gdb regcache structures and gdbserver regcache inherit directly from reg_buffer_common. This will allow for common functions which require the use of a regcache. gdb/ * common/common-regcache.h (reg_buffer_common): New structure. * regcache.c (reg_buffer::invalidate): Move from detached_regcache. (reg_buffer::raw_supply): Likewise. (reg_buffer::raw_supply_integer): Likewise. (reg_buffer::raw_supply_zeroed): Likewise. (reg_buffer::raw_collect): Likewise. (reg_buffer::raw_collect_integer): Likewise. * regcache.h (reg_buffer::invalidate): Move from detached_regcache. (reg_buffer::raw_supply): Likewise. (reg_buffer::raw_supply_integer): Likewise. (reg_buffer::raw_supply_zeroed): Likewise. (reg_buffer::raw_collect): Likewise. (reg_buffer::raw_collect_integer): Likewise. gdbserver/ * regcache.c (new_register_cache): Use new. (free_register_cache): Use delete. (register_data): Use const. (supply_register): Move body inside regcache. (regcache::raw_supply): New override function. (collect_register): Move body inside regcache. (regcache::raw_collect): New override function. (regcache::get_register_status): New override function. * regcache.h (struct regcache): Inherit from reg_buffer_common.
Diffstat (limited to 'gdb/common')
-rw-r--r--gdb/common/common-regcache.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/common/common-regcache.h b/gdb/common/common-regcache.h
index 9709ba4..4e6bdde 100644
--- a/gdb/common/common-regcache.h
+++ b/gdb/common/common-regcache.h
@@ -62,4 +62,19 @@ extern enum register_status regcache_raw_read_unsigned
ULONGEST regcache_raw_get_unsigned (struct regcache *regcache, int regnum);
+struct reg_buffer_common
+{
+ virtual ~reg_buffer_common () = default;
+
+ /* Get the availability status of the value of register REGNUM in this
+ buffer. */
+ virtual register_status get_register_status (int regnum) const = 0;
+
+ /* Supply register REGNUM, whose contents are stored in BUF, to REGCACHE. */
+ virtual void raw_supply (int regnum, const void *buf) = 0;
+
+ /* Collect register REGNUM from REGCACHE and store its contents in BUF. */
+ virtual void raw_collect (int regnum, void *buf) const = 0;
+};
+
#endif /* COMMON_REGCACHE_H */