Make gdbserver find_register_by_number static
authorAlan Hayward <alan.hayward@arm.com>
Fri, 23 Mar 2018 11:17:22 +0000 (11:17 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Fri, 23 Mar 2018 14:49:09 +0000 (14:49 +0000)
gdbserver/
* regcache.c (find_register_by_number): Make static.
(find_regno): Use find_register_by_number
* regcache.h (struct reg): Remove declaration.

gdb/gdbserver/ChangeLog
gdb/gdbserver/regcache.c
gdb/gdbserver/regcache.h

index 093eec7ddb59dc927753b097a6a9c2c384ccde4f..c07d40a75d1bb37fa5909e6b00b2e2ef10cee1f7 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-23  Alan Hayward  <alan.hayward@arm.com>
+
+       * regcache.c (find_register_by_number): Make static.
+       (find_regno): Use find_register_by_number
+       * regcache.h (struct reg): Remove declaration.
+
 2018-03-23  Alan Hayward  <alan.hayward@arm.com>
 
        * tdesc.c (target_desc::~target_desc): Move to here.
index 1bb15900dd2db59b209a3a672d23f9ee6ceda237..d6511fda650ca52688cd4d7db1acd94e822a3c0d 100644 (file)
@@ -196,6 +196,13 @@ regcache_cpy (struct regcache *dst, struct regcache *src)
   dst->registers_valid = src->registers_valid;
 }
 
+/* Return a pointer 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
 
@@ -244,24 +251,13 @@ find_regno (const struct target_desc *tdesc, const char *name)
 {
   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)
 {
index 3a75ce3fe10c7e42cd811e2dfdafc22f8a5cab5c..6ff13084b0f168482c7f23e0ea3e348bfac8e687 100644 (file)
@@ -94,10 +94,6 @@ void registers_from_string (struct regcache *regcache, char *buf);
 
 void regcache_write_pc (struct regcache *regcache, CORE_ADDR pc);
 
-/* Return a pointer to the description of register ``n''.  */
-
-struct reg *find_register_by_number (const struct target_desc *tdesc, int n);
-
 int register_cache_size (const struct target_desc *tdesc);
 
 int register_size (const struct target_desc *tdesc, int n);