diff options
author | Alan Hayward <alan.hayward@arm.com> | 2018-03-26 10:39:24 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2018-03-26 10:54:55 +0100 |
commit | 5cd3e386e0ac84b0ba1e0737853f4504ba24f677 (patch) | |
tree | 16ec0192a901f38def1cef893c650f8aec1912ab /gdb/gdbserver/regcache.c | |
parent | af9d57d205eb656a01b9688c3efa591ad8f1a2a9 (diff) | |
download | gdb-5cd3e386e0ac84b0ba1e0737853f4504ba24f677.zip gdb-5cd3e386e0ac84b0ba1e0737853f4504ba24f677.tar.gz gdb-5cd3e386e0ac84b0ba1e0737853f4504ba24f677.tar.bz2 |
Make gdbserver reg_defs a vector of objects
gdb/
* regformats/regdef.h (reg): Add constructors.
gdb/gdbserver/
* regcache.c (find_register_by_number): Return a ref.
(find_regno): Use references.
(register_size): Likewise.
(register_data): Likewise.
* tdesc.c (target_desc::~target_desc): Remove free calls.
(target_desc::operator==): Use std::vector compare.
(init_target_desc): Use reference.
(tdesc_create_reg): Use reg constructors.
* tdesc.h (struct target_desc): Replace pointer with object.
Diffstat (limited to 'gdb/gdbserver/regcache.c')
-rw-r--r-- | gdb/gdbserver/regcache.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c index d6511fd..cbdf766 100644 --- a/gdb/gdbserver/regcache.c +++ b/gdb/gdbserver/regcache.c @@ -196,9 +196,9 @@ regcache_cpy (struct regcache *dst, struct regcache *src) dst->registers_valid = src->registers_valid; } -/* Return a pointer to the description of register N. */ +/* Return a reference to the description of register N. */ -static const struct reg * +static const struct reg & find_register_by_number (const struct target_desc *tdesc, int n) { return tdesc->reg_defs[n]; @@ -251,7 +251,7 @@ find_regno (const struct target_desc *tdesc, const char *name) { for (int i = 0; i < tdesc->reg_defs.size (); ++i) { - if (strcmp (name, find_register_by_number (tdesc, i)->name) == 0) + if (strcmp (name, find_register_by_number (tdesc, i).name) == 0) return i; } internal_error (__FILE__, __LINE__, "Unknown register %s requested", @@ -288,7 +288,7 @@ register_cache_size (const struct target_desc *tdesc) 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. */ @@ -303,7 +303,7 @@ static unsigned char * 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. |