From: Alan Hayward Date: Fri, 23 Mar 2018 11:17:22 +0000 (+0000) Subject: Make gdbserver find_register_by_number static X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dff7492c9b221aacd4efa6675bb288dfb5d50f80;p=binutils-gdb.git Make gdbserver find_register_by_number static gdbserver/ * regcache.c (find_register_by_number): Make static. (find_regno): Use find_register_by_number * regcache.h (struct reg): Remove declaration. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 093eec7ddb5..c07d40a75d1 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2018-03-23 Alan Hayward + + * 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 * tdesc.c (target_desc::~target_desc): Move to here. diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index 1bb15900dd2..d6511fda650 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -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) { diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h index 3a75ce3fe10..6ff13084b0f 100644 --- a/gdb/gdbserver/regcache.h +++ b/gdb/gdbserver/regcache.h @@ -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);