aboutsummaryrefslogtreecommitdiff
path: root/gdb/regcache.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
committerYao Qi <yao.qi@linaro.org>2018-02-21 11:20:03 +0000
commit796bb0264184e8d9343f041c2f11cb898c0d18ac (patch)
treebc3f8e9ef754550d16e4b29be380d3309cc45e10 /gdb/regcache.c
parent215c69dc9a7d8f868198b5523abcf41458fb6e4a (diff)
downloadgdb-796bb0264184e8d9343f041c2f11cb898c0d18ac.zip
gdb-796bb0264184e8d9343f041c2f11cb898c0d18ac.tar.gz
gdb-796bb0264184e8d9343f041c2f11cb898c0d18ac.tar.bz2
Remove regcache::m_readonly_p
Now, m_readonly_p is always false, so we can remove it, and regcache no longer includes pseudo registers. Some regcache methods are lift up to its parent class, like reg_buffer or detached_regcache. gdb: 2018-02-21 Yao Qi <yao.qi@linaro.org> * regcache.c (regcache::regcache): Update. (regcache::invalidate): Move it to detached_regcache::invalidate. (get_thread_arch_aspace_regcache): Update. (regcache::raw_update): Update. (regcache::cooked_read): Remove some code. (regcache::cooked_read_value): Likewise. (regcache::raw_write): Remove assert on m_readonly_p. (regcache::raw_supply_integer): Move it to detached_regcache::raw_supply_integer. (regcache::raw_supply_zeroed): Likewise. * regcache.h (detached_regcache) <raw_supply_integer>: New declaration. <raw_supply_zeroed, invalidate>: Likewise. (regcache) <raw_supply_integer, raw_supply_zeroed>: Removed. <invalidate>: Likewise. <m_readonly_p>: Removed.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r--gdb/regcache.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 8f81163..082b62e 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -200,13 +200,10 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo)
}
}
-regcache::regcache (gdbarch *gdbarch, const address_space *aspace_,
- bool readonly_p_)
-/* The register buffers. A read-only register cache can hold the
- full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a
- read/write register cache can only hold [0 .. gdbarch_num_regs). */
- : detached_regcache (gdbarch, readonly_p_),
- m_aspace (aspace_), m_readonly_p (readonly_p_)
+regcache::regcache (gdbarch *gdbarch, const address_space *aspace_)
+/* The register buffers. A read/write register cache can only hold
+ [0 .. gdbarch_num_regs). */
+ : detached_regcache (gdbarch, false), m_aspace (aspace_)
{
m_ptid = minus_one_ptid;
}
@@ -319,7 +316,6 @@ regcache::restore (readonly_detached_regcache *src)
int regnum;
gdb_assert (src != NULL);
- gdb_assert (!m_readonly_p);
gdb_assert (src->m_has_pseudo);
gdb_assert (gdbarch == src->arch ());
@@ -361,9 +357,8 @@ regcache_invalidate (struct regcache *regcache, int regnum)
}
void
-regcache::invalidate (int regnum)
+detached_regcache::invalidate (int regnum)
{
- gdb_assert (!m_readonly_p);
assert_regnum (regnum);
m_register_status[regnum] = REG_UNKNOWN;
}
@@ -394,7 +389,7 @@ get_thread_arch_aspace_regcache (ptid_t ptid, struct gdbarch *gdbarch,
if (ptid_equal (regcache->ptid (), ptid) && regcache->arch () == gdbarch)
return regcache;
- regcache *new_regcache = new regcache (gdbarch, aspace, false);
+ regcache *new_regcache = new regcache (gdbarch, aspace);
regcache::current_regcache.push_front (new_regcache);
new_regcache->set_ptid (ptid);
@@ -532,7 +527,7 @@ regcache::raw_update (int regnum)
only there is still only one target side register cache. Sigh!
On the bright side, at least there is a regcache object. */
- if (!m_readonly_p && get_register_status (regnum) == REG_UNKNOWN)
+ if (get_register_status (regnum) == REG_UNKNOWN)
{
target_fetch_registers (this, regnum);
@@ -805,7 +800,6 @@ regcache::raw_write (int regnum, const gdb_byte *buf)
gdb_assert (buf != NULL);
assert_regnum (regnum);
- gdb_assert (!m_readonly_p);
/* On the sparc, writing %g0 is a no-op, so we don't even want to
change the registers array if something writes to this register. */
@@ -1028,15 +1022,14 @@ detached_regcache::raw_supply (int regnum, const void *buf)
most significant bytes of the integer will be truncated. */
void
-regcache::raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len,
- bool is_signed)
+detached_regcache::raw_supply_integer (int regnum, const gdb_byte *addr,
+ int addr_len, bool is_signed)
{
enum bfd_endian byte_order = gdbarch_byte_order (m_descr->gdbarch);
gdb_byte *regbuf;
size_t regsize;
assert_regnum (regnum);
- gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
regsize = m_descr->sizeof_register[regnum];
@@ -1051,13 +1044,12 @@ regcache::raw_supply_integer (int regnum, const gdb_byte *addr, int addr_len,
unavailable). */
void
-regcache::raw_supply_zeroed (int regnum)
+detached_regcache::raw_supply_zeroed (int regnum)
{
void *regbuf;
size_t size;
assert_regnum (regnum);
- gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
size = m_descr->sizeof_register[regnum];
@@ -1871,7 +1863,7 @@ class readwrite_regcache : public regcache
{
public:
readwrite_regcache (struct gdbarch *gdbarch)
- : regcache (gdbarch, nullptr, false)
+ : regcache (gdbarch, nullptr)
{}
};