diff options
author | Andrew Burgess <aburgess@redhat.com> | 2022-03-31 11:43:13 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2022-04-07 16:01:18 +0100 |
commit | 1bca9b1e6be9cb45684f38dba0d4d323447a653a (patch) | |
tree | 1dd7781dc5cc99264f61bb158ef3329ef5edfbd0 /gdb/infcmd.c | |
parent | b89f77be528605fb1781bdd481c3ba1b9d6afab7 (diff) | |
download | binutils-1bca9b1e6be9cb45684f38dba0d4d323447a653a.zip binutils-1bca9b1e6be9cb45684f38dba0d4d323447a653a.tar.gz binutils-1bca9b1e6be9cb45684f38dba0d4d323447a653a.tar.bz2 |
gdb: remove reggroup_next and reggroup_prev
Add a new function gdbarch_reggroups that returns a reference to a
vector containing all the reggroups for an architecture.
Make use of this function throughout GDB instead of the existing
reggroup_next and reggroup_prev functions.
Finally, delete the reggroup_next and reggroup_prev functions.
Most of these changes are pretty straight forward, using range based
for loops instead of the old style look using reggroup_next. There
are two places where the changes are less straight forward.
In gdb/python/py-registers.c, the register group iterator needed to
change slightly. As the iterator is tightly coupled to the gdbarch, I
just fetch the register group vector from the gdbarch when needed, and
use an index counter to find the next item from the vector when
needed.
In gdb/tui/tui-regs.c the tui_reg_next and tui_reg_prev functions are
just wrappers around reggroup_next and reggroup_prev respectively.
I've just inlined the logic of the old functions into the tui
functions. As the tui function had its own special twist (wrap around
behaviour) I think this is OK.
There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r-- | gdb/infcmd.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b76345d..9abb91f 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2295,17 +2295,17 @@ registers_info (const char *addr_exp, int fpregs) /* A register group? */ { - struct reggroup *group; - - for (group = reggroup_next (gdbarch, NULL); - group != NULL; - group = reggroup_next (gdbarch, group)) + const struct reggroup *group = nullptr; + for (const struct reggroup *g : gdbarch_reggroups (gdbarch)) { /* Don't bother with a length check. Should the user enter a short register group name, go with the first group that matches. */ - if (strncmp (start, reggroup_name (group), end - start) == 0) - break; + if (strncmp (start, reggroup_name (g), end - start) == 0) + { + group = g; + break; + } } if (group != NULL) { |