diff options
author | Yao Qi <yao.qi@linaro.org> | 2018-02-21 11:20:03 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2018-02-21 11:20:03 +0000 |
commit | daf6667d1f94c7e74df4076daf021cd28a2797b6 (patch) | |
tree | c3cdc9beab7cb79439034a2c1b209e5e99e1826f /gdb/linux-fork.c | |
parent | fc5b87361580d915e28ae5f3cc4794b75b671b5a (diff) | |
download | binutils-daf6667d1f94c7e74df4076daf021cd28a2797b6.zip binutils-daf6667d1f94c7e74df4076daf021cd28a2797b6.tar.gz binutils-daf6667d1f94c7e74df4076daf021cd28a2797b6.tar.bz2 |
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.
Diffstat (limited to 'gdb/linux-fork.c')
-rw-r--r-- | gdb/linux-fork.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index df7ea4e..9ffab1f 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -45,8 +45,9 @@ struct fork_info ptid_t ptid; ptid_t parent_ptid; int num; /* Convenient handle (GDB fork id). */ - struct regcache *savedregs; /* Convenient for info fork, saves + readonly_detached_regcache *savedregs; /* Convenient for info fork, saves having to actually switch contexts. */ + CORE_ADDR pc; int clobber_regs; /* True if we should restore saved regs. */ off_t *filepos; /* Set of open file descriptors' offsets. */ int maxfd; @@ -294,7 +295,8 @@ fork_save_infrun_state (struct fork_info *fp, int clobber_regs) if (fp->savedregs) delete fp->savedregs; - fp->savedregs = regcache_dup (get_current_regcache ()); + fp->savedregs = new readonly_detached_regcache (*get_current_regcache ()); + fp->pc = regcache_read_pc (get_current_regcache ()); fp->clobber_regs = clobber_regs; if (clobber_regs) @@ -590,15 +592,11 @@ info_checkpoints_command (const char *arg, int from_tty) printed = fp; if (ptid_equal (fp->ptid, inferior_ptid)) - { - printf_filtered ("* "); - pc = regcache_read_pc (get_current_regcache ()); - } + printf_filtered ("* "); else - { - printf_filtered (" "); - pc = regcache_read_pc (fp->savedregs); - } + printf_filtered (" "); + + pc = fp->pc; printf_filtered ("%d %s", fp->num, target_pid_to_str (fp->ptid)); if (fp->num == 0) printf_filtered (_(" (main process)")); |