+2017-02-26 Alan Hayward <alan.hayward@arm.com>
+
+ * regcache.c (regcache_raw_update): New function.
+ (regcache_raw_read): Move code to regcache_raw_update.
+ * regcache.h (regcache_raw_update): New declaration.
+ * remote.c (remote_prepare_to_store): Call regcache_raw_update.
+
2017-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2read.c (create_debug_type_hash_table): Initialize
alloca (0);
}
-enum register_status
-regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
+void
+regcache_raw_update (struct regcache *regcache, int regnum)
{
- gdb_assert (regcache != NULL && buf != NULL);
+ gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
+
/* Make certain that the register cache is up-to-date with respect
to the current thread. This switching shouldn't be necessary
only there is still only one target side register cache. Sigh!
On the bright side, at least there is a regcache object. */
+
if (!regcache->readonly_p
&& regcache_register_status (regcache, regnum) == REG_UNKNOWN)
{
if (regcache->register_status[regnum] == REG_UNKNOWN)
regcache->register_status[regnum] = REG_UNAVAILABLE;
}
+}
+
+enum register_status
+regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
+{
+ gdb_assert (buf != NULL);
+ regcache_raw_update (regcache, regnum);
if (regcache->register_status[regnum] != REG_VALID)
memset (buf, 0, regcache->descr->sizeof_register[regnum]);
enum register_status regcache_register_status (const struct regcache *regcache,
int regnum);
+/* Make certain that the register REGNUM in REGCACHE is up-to-date. */
+
+void regcache_raw_update (struct regcache *regcache, int regnum);
+
/* Transfer a raw register [0..NUM_REGS) between core-gdb and the
regcache. The read variants return the status of the register. */
{
struct remote_arch_state *rsa = get_remote_arch_state ();
int i;
- gdb_byte buf[MAX_REGISTER_SIZE];
/* Make sure the entire registers array is valid. */
switch (packet_support (PACKET_P))
/* Make sure all the necessary registers are cached. */
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
if (rsa->regs[i].in_g_packet)
- regcache_raw_read (regcache, rsa->regs[i].regnum, buf);
+ regcache_raw_update (regcache, rsa->regs[i].regnum);
break;
case PACKET_ENABLE:
break;