diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-06-09 22:08:06 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-06-09 22:08:06 -0400 |
commit | aac0d564cea04b1c5f386e8cea924ca59057e8b4 (patch) | |
tree | 04405413fbf3a558b6c965ada5a7771dd2acc9cd /gdb/regcache.c | |
parent | 09897e3330d41699b6146f9b8767734f92587dcc (diff) | |
download | gdb-aac0d564cea04b1c5f386e8cea924ca59057e8b4.zip gdb-aac0d564cea04b1c5f386e8cea924ca59057e8b4.tar.gz gdb-aac0d564cea04b1c5f386e8cea924ca59057e8b4.tar.bz2 |
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.
Diffstat (limited to 'gdb/regcache.c')
-rw-r--r-- | gdb/regcache.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/regcache.c b/gdb/regcache.c index 225b3a0..626d424 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -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)) { |