/* Register support routines for the remote server for GDB.
- Copyright (C) 2001-2017 Free Software Foundation, Inc.
+ Copyright (C) 2001-2018 Free Software Foundation, Inc.
This file is part of GDB.
dst->registers_valid = src->registers_valid;
}
+/* Return a reference to the description of register N. */
+
+static const struct reg &
+find_register_by_number (const struct target_desc *tdesc, int n)
+{
+ return tdesc->reg_defs[n];
+}
#ifndef IN_PROCESS_AGENT
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
- struct reg *reg = tdesc->reg_defs[i];
-
if (regcache->register_status[i] == REG_VALID)
{
bin2hex (registers, buf, register_size (tdesc, i));
{
for (int i = 0; i < tdesc->reg_defs.size (); ++i)
{
- struct reg *reg = tdesc->reg_defs[i];
-
- if (strcmp (name, reg->name) == 0)
+ if (strcmp (name, find_register_by_number (tdesc, i).name) == 0)
return i;
}
internal_error (__FILE__, __LINE__, "Unknown register %s requested",
name);
}
-#endif
-
-struct reg *
-find_register_by_number (const struct target_desc *tdesc, int n)
-{
- return tdesc->reg_defs[n];
-}
-
-#ifndef IN_PROCESS_AGENT
static void
free_register_cache_thread (struct thread_info *thread)
{
regcache_release (void)
{
/* Flush and release all pre-existing register caches. */
- for_each_inferior (&all_threads, free_register_cache_thread);
+ for_each_thread (free_register_cache_thread);
}
#endif
int
register_size (const struct target_desc *tdesc, int n)
{
- return find_register_by_number (tdesc, n)->size / 8;
+ return find_register_by_number (tdesc, n).size / 8;
}
/* See common/common-regcache.h. */
register_data (struct regcache *regcache, int n, int fetch)
{
return (regcache->registers
- + find_register_by_number (regcache->tdesc, n)->offset / 8);
+ + find_register_by_number (regcache->tdesc, n).offset / 8);
}
/* Supply register N, whose contents are stored in BUF, to REGCACHE.
#endif
}
+#ifndef IN_PROCESS_AGENT
+
+/* Supply register called NAME with value zero to REGCACHE. */
+
+void
+supply_register_by_name_zeroed (struct regcache *regcache,
+ const char *name)
+{
+ supply_register_zeroed (regcache, find_regno (regcache->tdesc, name));
+}
+
+#endif
+
/* Supply the whole register set whose contents are stored in BUF, to
REGCACHE. If BUF is NULL, all the registers' values are recorded
as unavailable. */