Change type of reg_buffer::m_register_status to register_status
The type of reg_buffer::m_register_status is an array of signed char, probably to ensure that each element takes up only one byte. Instead, since we use C++11, we can force the underlying type of register_status to be signed char and use the enum type. gdb/ChangeLog: * common/common-regcache.h (enum register_status): Add underlying type "signed char". * regcache.h (reg_buffer) <m_register_status>: Change type to register_status *. * regcache.c (reg_buffer::reg_buffer): Alocate arrays of register_status instead of signed char. (reg_buffer::save): Use REG_UNKNOWN instead of 0. (reg_buffer::get_register_status): Remove cast. (readable_regcache::raw_read): Remove cast. (readable_regcache::cooked_read): Remove cast.
This commit is contained in:
parent
09897e3330
commit
aac0d564ce
@ -1,3 +1,16 @@
|
||||
2018-06-09 Simon Marchi <simon.marchi@ericsson.com>
|
||||
|
||||
* common/common-regcache.h (enum register_status): Add
|
||||
underlying type "signed char".
|
||||
* regcache.h (reg_buffer) <m_register_status>: Change type to
|
||||
register_status *.
|
||||
* regcache.c (reg_buffer::reg_buffer): Alocate arrays of
|
||||
register_status instead of signed char.
|
||||
(reg_buffer::save): Use REG_UNKNOWN instead of 0.
|
||||
(reg_buffer::get_register_status): Remove cast.
|
||||
(readable_regcache::raw_read): Remove cast.
|
||||
(readable_regcache::cooked_read): Remove cast.
|
||||
|
||||
2018-06-09 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* source.c (reverse_search_command, forward_search_command): Use
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
/* This header is a stopgap until we have an independent regcache. */
|
||||
|
||||
enum register_status
|
||||
enum register_status : signed char
|
||||
{
|
||||
/* The register value is not in the cache, and we don't know yet
|
||||
whether it's available in the target (or traceframe). */
|
||||
|
@ -186,13 +186,14 @@ reg_buffer::reg_buffer (gdbarch *gdbarch, bool has_pseudo)
|
||||
if (has_pseudo)
|
||||
{
|
||||
m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_cooked_registers);
|
||||
m_register_status = XCNEWVEC (signed char,
|
||||
m_descr->nr_cooked_registers);
|
||||
m_register_status
|
||||
= XCNEWVEC (register_status, m_descr->nr_cooked_registers);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_registers = XCNEWVEC (gdb_byte, m_descr->sizeof_raw_registers);
|
||||
m_register_status = XCNEWVEC (signed char, gdbarch_num_regs (gdbarch));
|
||||
m_register_status
|
||||
= XCNEWVEC (register_status, gdbarch_num_regs (gdbarch));
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,7 +274,7 @@ reg_buffer::save (regcache_cooked_read_ftype *cooked_read,
|
||||
gdb_assert (m_has_pseudo);
|
||||
/* Clear the dest. */
|
||||
memset (m_registers, 0, m_descr->sizeof_cooked_registers);
|
||||
memset (m_register_status, 0, m_descr->nr_cooked_registers);
|
||||
memset (m_register_status, REG_UNKNOWN, m_descr->nr_cooked_registers);
|
||||
/* Copy over any registers (identified by their membership in the
|
||||
save_reggroup) and mark them as valid. The full [0 .. gdbarch_num_regs +
|
||||
gdbarch_num_pseudo_regs) range is checked since some architectures need
|
||||
@ -325,7 +326,7 @@ reg_buffer::get_register_status (int regnum) const
|
||||
{
|
||||
assert_regnum (regnum);
|
||||
|
||||
return (enum register_status) m_register_status[regnum];
|
||||
return m_register_status[regnum];
|
||||
}
|
||||
|
||||
void
|
||||
@ -515,7 +516,7 @@ readable_regcache::raw_read (int regnum, gdb_byte *buf)
|
||||
memcpy (buf, register_buffer (regnum),
|
||||
m_descr->sizeof_register[regnum]);
|
||||
|
||||
return (enum register_status) m_register_status[regnum];
|
||||
return m_register_status[regnum];
|
||||
}
|
||||
|
||||
enum register_status
|
||||
@ -609,7 +610,7 @@ readable_regcache::cooked_read (int regnum, gdb_byte *buf)
|
||||
else
|
||||
memset (buf, 0, m_descr->sizeof_register[regnum]);
|
||||
|
||||
return (enum register_status) m_register_status[regnum];
|
||||
return m_register_status[regnum];
|
||||
}
|
||||
else if (gdbarch_pseudo_register_read_value_p (m_descr->gdbarch))
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ protected:
|
||||
/* The register buffers. */
|
||||
gdb_byte *m_registers;
|
||||
/* Register cache status. */
|
||||
signed char *m_register_status;
|
||||
register_status *m_register_status;
|
||||
|
||||
friend class regcache;
|
||||
friend class detached_regcache;
|
||||
|
Loading…
x
Reference in New Issue
Block a user