diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-06-20 12:49:03 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-06-20 12:49:03 -0400 |
commit | 302abd6e9facdfec3473e19ff65a5479f850ad62 (patch) | |
tree | b646934ec16de81d5b50fb474b3253e822b8bf63 /gdb/regcache.h | |
parent | f00674fe074f6ea778503a50132c3214a9c6aec8 (diff) | |
download | gdb-302abd6e9facdfec3473e19ff65a5479f850ad62.zip gdb-302abd6e9facdfec3473e19ff65a5479f850ad62.tar.gz gdb-302abd6e9facdfec3473e19ff65a5479f850ad62.tar.bz2 |
Rename regcache_cooked_read_ftype and make a function_view
regcache_cooked_read_ftype can be converted to a function_view, which
allows us to use lambda functions and therefore avoid having to pass an
opaque pointer parameter.
Adjusting the fallouts showed that the "const regcache &" passed to the
readonly_detached_regcache constructor is cast to non-const in
do_cooked_read. I changed the constructor parameter to be non-const.
Finally, I renamed the typedef from regcache_cooked_read_ftype to
register_read_ftype, since there is nothing that forces us to use it
only for regcaches nor cooked registers.
gdb/ChangeLog:
* regcache.h (regcache_cooked_read_ftype): Rename to...
(register_read_ftype): ...this, change type to function_view.
(class reg_buffer) <save>: Remove src parameter.
(readonly_detached_regcache) <readonly_detached_regcache>: Make
parameter non-const in first overload. Remove src parameter in
second overload.
* regcache.c (do_cooked_read): Remove.
(readonly_detached_regcache::readonly_detached_regcache): Make
parameter non-const, adjust call to other constructor.
(reg_buffer::save): Remove src parameter.
* frame.c (do_frame_register_read): Remove.
(frame_save_as_regcache): Use lambda function.
* ppc-linux-tdep.c (ppu2spu_unwind_register): Change type of src
parameter to ppu2spu_data *.
(ppu2spu_sniffer): Use lambda function.
Diffstat (limited to 'gdb/regcache.h')
-rw-r--r-- | gdb/regcache.h | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/regcache.h b/gdb/regcache.h index 41465fb..74ac858 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -125,9 +125,8 @@ extern struct type *register_type (struct gdbarch *gdbarch, int regnum); 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. */ @@ -202,7 +201,7 @@ protected: /* 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; @@ -379,16 +378,14 @@ private: 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); |