Convert the registers_from_string function into a method of the regcache
struct. Also constify the buffer argument.
---
gdbserver/regcache.cc | 4 +---
gdbserver/regcache.h | 7 +++----
gdbserver/server.cc | 2 +-
3 files changed, 5 insertions(+), 8 deletions(-)
@@ -235,11 +235,9 @@ regcache::registers_to_string (char *buf)
}
void
-registers_from_string (struct regcache *regcache, char *buf)
+regcache::registers_from_string (const char *buf)
{
int len = strlen (buf);
- unsigned char *registers = regcache->registers;
- const struct target_desc *tdesc = regcache->tdesc;
if (len != tdesc->registers_size * 2)
{
@@ -88,6 +88,9 @@ struct regcache : public reg_buffer_common
/* Convert all registers to a string in the currently specified remote
format. */
void registers_to_string (char *buf);
+
+ /* Convert a string to register values and fill our register cache. */
+ void registers_from_string (const char *buf);
};
regcache *get_thread_regcache (thread_info *thread, bool fetch = true);
@@ -110,10 +113,6 @@ void regcache_invalidate (void);
void regcache_release (void);
-/* Convert a string to register values and fill our register cache. */
-
-void registers_from_string (struct regcache *regcache, char *buf);
-
/* For regcache_read_pc see gdbsupport/common-regcache.h. */
void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
@@ -4271,7 +4271,7 @@ process_serial_event (void)
else
{
regcache = get_thread_regcache (current_thread);
- registers_from_string (regcache, &cs.own_buf[1]);
+ regcache->registers_from_string (&cs.own_buf[1]);
write_ok (cs.own_buf);
}
}