From ef79d9a3c6ed1e3ccd466bae76956019a7c5d376 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Fri, 28 Apr 2017 22:48:42 +0100 Subject: Class-fy regcache This patch moves regcache declaration to regcache.h, and converts regcache apis to member functions, for example, regcache_invalidate is changed to regcache::invalidate. This patch also add "m_" prefix to these private fields. gdb: 2017-04-28 Yao Qi * regcache.c (struct regcache): Move to regcache.h (regcache::arch): New method. (regcache_get_ptid): Update. (get_regcache_arch): Call arch method. (get_regcache_aspace): Call method aspace. (register_buffer): Change it to method. (regcache_save): Change it to regcache::save. (regcache_restore): Likewise. (regcache_cpy_no_passthrough): Remove the declaration. (regcache_cpy): Call methods restore and cpy_no_passthrough. (regcache_cpy_no_passthrough): Change it to method cpy_no_passthrough. (regcache_register_status): Change it to method get_register_status. (regcache_invalidate): Change it to method invalidate. (regcache_thread_ptid_changed): Use methods ptid and set_ptid. (regcache_raw_update): Change it to method raw_update. (regcache_raw_read): Likewise. (regcache_raw_read_signed): Likewise. (regcache_raw_read_unsigned): Likewise. (regcache_raw_write_signed): Likewise. (regcache_raw_write_unsigned): Likewise. (regcache_cooked_read): Likewise. (regcache_cooked_read_value): Likewise. (regcache_cooked_read_signed): Likewise. (regcache_cooked_read_unsigned): Likewise. (regcache_cooked_write_signed): Likewise. (regcache_cooked_write_unsigned): Likewise. (regcache_raw_set_cached_value): Likewise. (regcache_raw_write): Likewise. (regcache_cooked_write): Likewise. (regcache_xfer_part): Likewise. (regcache_raw_read_part): Likewise. (regcache_raw_write_part): Likewise. (regcache_cooked_read_part): Likewise. (regcache_cooked_write_part): Likewise. (regcache_raw_supply): Likewise. (regcache_raw_collect): Likewise. (regcache_transfer_regset): Likewise. (regcache_supply_regset): Likewise. (regcache_collect_regset): Likewise. (regcache_debug_print_register): Likewise. (enum regcache_dump_what): Move it to regcache.h. (regcache_dump): Change it to method dump. * regcache.h (enum regcache_dump_what): New. (class regcache): New. * target.c (target_fetch_registers): Call method debug_print_register. (target_store_registers): Likewise. --- gdb/target.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gdb/target.c') diff --git a/gdb/target.c b/gdb/target.c index 10a5315..e526bcc 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3552,7 +3552,7 @@ target_fetch_registers (struct regcache *regcache, int regno) { current_target.to_fetch_registers (¤t_target, regcache, regno); if (targetdebug) - regcache_debug_print_register ("target_fetch_registers", regcache, regno); + regcache->debug_print_register ("target_fetch_registers", regno); } void @@ -3564,8 +3564,7 @@ target_store_registers (struct regcache *regcache, int regno) current_target.to_store_registers (¤t_target, regcache, regno); if (targetdebug) { - regcache_debug_print_register ("target_store_registers", regcache, - regno); + regcache->debug_print_register ("target_store_registers", regno); } } -- cgit v1.1