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 <yao.qi@linaro.org> * dummy-frame.c (dummy_frame_cache) <prev_regcache>: 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) <registers>: 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) <savedregs>: Change to readonly_detached_regcache. <pc>: 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) <regcache>: 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) <save>: New method. (readonly_detached_regcache): New class. * spu-tdep.c (spu2ppu_cache) <regcache>: Use readonly_detached_regcache. (spu2ppu_sniffer): Construct a new readonly_detached_regcache.
This commit is contained in:
parent
fc5b873615
commit
daf6667d1f
12 changed files with 118 additions and 64 deletions
10
gdb/frame.c
10
gdb/frame.c
|
@ -1017,13 +1017,13 @@ do_frame_register_read (void *src, int regnum, gdb_byte *buf)
|
|||
return REG_VALID;
|
||||
}
|
||||
|
||||
std::unique_ptr<struct regcache>
|
||||
std::unique_ptr<readonly_detached_regcache>
|
||||
frame_save_as_regcache (struct frame_info *this_frame)
|
||||
{
|
||||
std::unique_ptr<struct regcache> regcache
|
||||
(new struct regcache (get_frame_arch (this_frame)));
|
||||
std::unique_ptr<readonly_detached_regcache> regcache
|
||||
(new readonly_detached_regcache (get_frame_arch (this_frame),
|
||||
do_frame_register_read, this_frame));
|
||||
|
||||
regcache->save (do_frame_register_read, this_frame);
|
||||
return regcache;
|
||||
}
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ frame_pop (struct frame_info *this_frame)
|
|||
Save them in a scratch buffer so that there isn't a race between
|
||||
trying to extract the old values from the current regcache while
|
||||
at the same time writing new values into that same cache. */
|
||||
std::unique_ptr<struct regcache> scratch
|
||||
std::unique_ptr<readonly_detached_regcache> scratch
|
||||
= frame_save_as_regcache (prev_frame);
|
||||
|
||||
/* FIXME: cagney/2003-03-16: It should be possible to tell the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue