diff options
author | Yao Qi <yao.qi@linaro.org> | 2017-11-02 15:15:42 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2017-11-02 15:15:42 +0000 |
commit | f26ae15b471aaddee81d9d6c03af1cb0f2081735 (patch) | |
tree | a4c1114f2089ec6e0ea63653eb26978e2d3c6fc5 | |
parent | 6c6e9412e930c96f48b8ee78a389437328f5283c (diff) | |
download | gdb-f26ae15b471aaddee81d9d6c03af1cb0f2081735.zip gdb-f26ae15b471aaddee81d9d6c03af1cb0f2081735.tar.gz gdb-f26ae15b471aaddee81d9d6c03af1cb0f2081735.tar.bz2 |
Construct readonly regcache without address space
The address space is useless to readonly regcache, so this patch removes
the parameter to construct readonly regcache.
address_space was added in regcache by 6c95b8d, but for read-write
regcache. regcache::aspace is used for various breakpoint/watchpoint
checking, and these regcache are not read-only regcache.
gdb:
2017-11-02 Yao Qi <yao.qi@linaro.org>
* frame.c (do_frame_register_read): Remove aspace.
* jit.c (jit_frame_sniffer): Likwise.
* ppc-linux-tdep.c (ppu2spu_sniffer): Likewise.
* regcache.c (regcache::regcache): Pass nullptr.
(regcache_print): Caller updated.
* regcache.h (regcache::regcache): Remove one constructor
parameter aspace.
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/frame.c | 3 | ||||
-rw-r--r-- | gdb/jit.c | 4 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 5 | ||||
-rw-r--r-- | gdb/regcache.c | 4 | ||||
-rw-r--r-- | gdb/regcache.h | 4 |
6 files changed, 18 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7cec806..085b615 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,15 @@ 2017-11-02 Yao Qi <yao.qi@linaro.org> + * frame.c (do_frame_register_read): Remove aspace. + * jit.c (jit_frame_sniffer): Likwise. + * ppc-linux-tdep.c (ppu2spu_sniffer): Likewise. + * regcache.c (regcache::regcache): Pass nullptr. + (regcache_print): Caller updated. + * regcache.h (regcache::regcache): Remove one constructor + parameter aspace. + +2017-11-02 Yao Qi <yao.qi@linaro.org> + * regcache.h (regcache) <m_readonly_p>: Change it to const bool. 2017-11-02 Yao Qi <yao.qi@linaro.org> diff --git a/gdb/frame.c b/gdb/frame.c index e40685f..e643823 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1020,9 +1020,8 @@ do_frame_register_read (void *src, int regnum, gdb_byte *buf) std::unique_ptr<struct regcache> frame_save_as_regcache (struct frame_info *this_frame) { - const address_space *aspace = get_frame_address_space (this_frame); std::unique_ptr<struct regcache> regcache - (new struct regcache (get_frame_arch (this_frame), aspace)); + (new struct regcache (get_frame_arch (this_frame))); regcache_save (regcache.get (), do_frame_register_read, this_frame); return regcache; @@ -1199,13 +1199,11 @@ jit_frame_sniffer (const struct frame_unwind *self, gdb_assert (!*cache); - const address_space *aspace = get_frame_address_space (this_frame); - gdbarch = get_frame_arch (this_frame); *cache = XCNEW (struct jit_unwind_private); priv_data = (struct jit_unwind_private *) *cache; - priv_data->regcache = new regcache (gdbarch, aspace); + priv_data->regcache = new regcache (gdbarch); priv_data->this_frame = this_frame; callbacks.priv_data = priv_data; diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index d01cff8..847908a 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1361,10 +1361,9 @@ ppu2spu_sniffer (const struct frame_unwind *self, { struct ppu2spu_cache *cache = FRAME_OBSTACK_CALLOC (1, struct ppu2spu_cache); - - const address_space *aspace = get_frame_address_space (this_frame); std::unique_ptr<struct regcache> regcache - (new struct regcache (data.gdbarch, aspace)); + (new struct regcache (data.gdbarch)); + regcache_save (regcache.get (), ppu2spu_unwind_register, &data); cache->frame_id = frame_id_build (base, func); diff --git a/gdb/regcache.c b/gdb/regcache.c index ef05168..571aba1 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -211,7 +211,7 @@ do_cooked_read (void *src, int regnum, gdb_byte *buf) } regcache::regcache (readonly_t, const regcache &src) - : regcache (src.arch (), src.aspace (), true) + : regcache (src.arch (), nullptr, true) { gdb_assert (!src.m_readonly_p); save (do_cooked_read, (void *) &src); @@ -1574,7 +1574,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) /* For the benefit of "maint print registers" & co when debugging an executable, allow dumping a regcache even when there is no thread selected / no registers. */ - regcache dummy_regs (target_gdbarch (), nullptr); + regcache dummy_regs (target_gdbarch ()); dummy_regs.dump (out, what_to_dump); } } diff --git a/gdb/regcache.h b/gdb/regcache.h index 05d96b3..c5ef41b 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -232,8 +232,8 @@ typedef struct cached_reg class regcache { public: - regcache (gdbarch *gdbarch, const address_space *aspace_) - : regcache (gdbarch, aspace_, true) + regcache (gdbarch *gdbarch) + : regcache (gdbarch, nullptr, true) {} struct readonly_t {}; |