+2017-11-02 Yao Qi <yao.qi@linaro.org>
+
+ * regcache.c (regcache::assert_regnum): New method.
+ (regcache::invalidate): Call assert_regnum.
+ (regcache::raw_update): Likewise.
+ (regcache::raw_write): Likewise.
+ (regcache::raw_read_part): Likewise.
+ (regcache::raw_write_part): Likewise.
+ (regcache::raw_supply): Likewise.
+ (regcache::raw_supply_integer): Likewise.
+ (regcache::raw_supply_zeroed): Likewise.
+ (regcache::raw_collect): Likewise.
+ (regcache::raw_collect_integer): Likewise.
+ * regcache.h (regcache::assert_regnum): Declare.
+
2017-11-02 Yao Qi <yao.qi@linaro.org>
* regcache.c (regcache::dump): Remove code.
void
regcache::invalidate (int regnum)
{
- gdb_assert (regnum >= 0);
gdb_assert (!m_readonly_p);
- gdb_assert (regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
m_register_status[regnum] = REG_UNKNOWN;
}
+void
+regcache::assert_regnum (int regnum) const
+{
+ gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+}
+
/* Global structure containing the current regcache. */
/* NOTE: this is a write-through cache. There is no "dirty" bit for
void
regcache::raw_update (int regnum)
{
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
/* Make certain that the register cache is up-to-date with respect
to the current thread. This switching shouldn't be necessary
gdb_byte *buf;
enum register_status status;
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
status = raw_read (regnum, buf);
if (status == REG_VALID)
{
gdb_byte *buf;
- gdb_assert (regnum >=0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
store_integer (buf, m_descr->sizeof_register[regnum],
gdbarch_byte_order (m_descr->gdbarch), val);
{
gdb_assert (buf != NULL);
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
gdb_assert (!m_readonly_p);
/* On the sparc, writing %g0 is a no-op, so we don't even want to
enum register_status
regcache::raw_read_part (int regnum, int offset, int len, gdb_byte *buf)
{
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
return xfer_part (regnum, offset, len, buf, NULL, true);
}
regcache::raw_write_part (int regnum, int offset, int len,
const gdb_byte *buf)
{
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
xfer_part (regnum, offset, len, NULL, buf, true);
}
void *regbuf;
size_t size;
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
gdb_byte *regbuf;
size_t regsize;
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
void *regbuf;
size_t size;
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
gdb_assert (!m_readonly_p);
regbuf = register_buffer (regnum);
size_t size;
gdb_assert (buf != NULL);
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
regbuf = register_buffer (regnum);
size = m_descr->sizeof_register[regnum];
const gdb_byte *regbuf;
size_t regsize;
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
+ assert_regnum (regnum);
regbuf = register_buffer (regnum);
regsize = m_descr->sizeof_register[regnum];