From daf6667d1f94c7e74df4076daf021cd28a2797b6 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 21 Feb 2018 11:20:03 +0000 Subject: Class readonly_detached_regcache This patch adds a new class (type) for readonly regcache, which is created via regcache::save. readonly_detached_regcache inherits readable_regcache. gdb: 2018-02-21 Yao Qi * dummy-frame.c (dummy_frame_cache) : Use readonly_detached_regcache. (dummy_frame_prev_register): Use regcache->cooked_read. * frame.c (frame_save_as_regcache): Change return type. (frame_pop): Update. * frame.h (frame_save_as_regcache): Update declaration. * inferior.h (get_infcall_suspend_state_regcache): Update declaration. * infrun.c (infcall_suspend_state) : use readonly_detached_regcache. (save_infcall_suspend_state): Don't use regcache_dup. (get_infcall_suspend_state_regcache): Change return type. * linux-fork.c (struct fork_info) : Change to readonly_detached_regcache. : New field. (fork_save_infrun_state): Don't use regcache_dup. (info_checkpoints_command): Adjust. * mi/mi-main.c (register_changed_p): Update declaration. (mi_cmd_data_list_changed_registers): Use readonly_detached_regcache. (register_changed_p): Change parameter type to readonly_detached_regcache. * ppc-linux-tdep.c (ppu2spu_cache) : Use readonly_detached_regcache. (ppu2spu_sniffer): Construct a new readonly_detached_regcache. * regcache.c (readonly_detached_regcache::readonly_detached_regcache): New. (regcache::save): Move it to reg_buffer. (regcache::restore): Change parameter type. (regcache_dup): Remove. * regcache.h (reg_buffer) : New method. (readonly_detached_regcache): New class. * spu-tdep.c (spu2ppu_cache) : Use readonly_detached_regcache. (spu2ppu_sniffer): Construct a new readonly_detached_regcache. --- gdb/mi/mi-main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gdb/mi') diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 51d33c9..1716a7f 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -96,8 +96,8 @@ static void mi_execute_cli_command (const char *cmd, int args_p, const char *args); static void mi_execute_async_cli_command (const char *cli_command, char **argv, int argc); -static bool register_changed_p (int regnum, regcache *, - regcache *); +static bool register_changed_p (int regnum, readonly_detached_regcache *, + readonly_detached_regcache *); static void output_register (struct frame_info *, int regnum, int format, int skip_unavailable); @@ -931,9 +931,9 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc) void mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) { - static std::unique_ptr this_regs; + static std::unique_ptr this_regs; struct ui_out *uiout = current_uiout; - std::unique_ptr prev_regs; + std::unique_ptr prev_regs; struct gdbarch *gdbarch; int regnum, numregs; int i; @@ -995,8 +995,8 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) } static bool -register_changed_p (int regnum, struct regcache *prev_regs, - struct regcache *this_regs) +register_changed_p (int regnum, readonly_detached_regcache *prev_regs, + readonly_detached_regcache *this_regs) { struct gdbarch *gdbarch = this_regs->arch (); struct value *prev_value, *this_value; -- cgit v1.1