aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/common/common-regcache.h2
-rw-r--r--gdb/regcache.c15
-rw-r--r--gdb/regcache.h2
4 files changed, 23 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1ff0e16..c475cd9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/common/common-regcache.h b/gdb/common/common-regcache.h
index 696ba00..9709ba4 100644
--- a/gdb/common/common-regcache.h
+++ b/gdb/common/common-regcache.h
@@ -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). */
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))
{
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 3edddf4..1001eed 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -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;