aboutsummaryrefslogtreecommitdiff
path: root/gdb/reggroups.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-05-21 21:51:53 +0200
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-05-26 22:18:50 +0100
commit55b400279267cad460ca62a8211f0b414f564e93 (patch)
tree9a86945461e96428aae5ac7b9a6266d632c8e614 /gdb/reggroups.c
parent7e16ef34742d853239608fadde4a19f3a105b0a2 (diff)
downloadgdb-55b400279267cad460ca62a8211f0b414f564e93.zip
gdb-55b400279267cad460ca62a8211f0b414f564e93.tar.gz
gdb-55b400279267cad460ca62a8211f0b414f564e93.tar.bz2
gdb: Add 'tui reg prev' command.
There is already a 'tui reg next' command, this adds a symmetric 'tui reg prev' command. gdb/ChangeLog: * tui/tui-regs.c (tui_reg_prev_command): New function. (_initialize_tui_regs): Add 'prev' command for 'tui reg'. * reggroups.c (reggroup_prev): New function. * reggroups.h (reggroup_prev): Add declaration. Update comment. gdb/doc/ChangeLog: * gdb.texinfo (TUI Commands): Add 'tui reg prev' details.
Diffstat (limited to 'gdb/reggroups.c')
-rw-r--r--gdb/reggroups.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index cbafc01..745c5ea 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -150,6 +150,35 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup *last)
return NULL;
}
+/* See reggroups.h. */
+
+struct reggroup *
+reggroup_prev (struct gdbarch *gdbarch, struct reggroup *curr)
+{
+ struct reggroups *groups;
+ struct reggroup_el *el;
+ struct reggroup *prev;
+
+ /* Don't allow this function to be called during architecture
+ creation. If there are no groups, use the default groups list. */
+ groups = gdbarch_data (gdbarch, reggroups_data);
+ gdb_assert (groups != NULL);
+ if (groups->first == NULL)
+ groups = &default_groups;
+
+ prev = NULL;
+ for (el = groups->first; el != NULL; el = el->next)
+ {
+ gdb_assert (el->group != NULL);
+ if (el->group == curr)
+ return prev;
+ prev = el->group;
+ }
+ if (curr == NULL)
+ return prev;
+ return NULL;
+}
+
/* Is REGNUM a member of REGGROUP? */
int
default_register_reggroup_p (struct gdbarch *gdbarch, int regnum,