aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-26 19:45:53 -0600
committerTom Tromey <tom@tromey.com>2019-07-17 12:19:02 -0600
commitfe3eaf1cd9af54cd4c678a8dde7fd0df601c9490 (patch)
treebca37bb0ca8b48f24c7b8cf3c650a2244a7bb39f /gdb
parent368c1354e578eb280df37059aa6b8c1f178baaf4 (diff)
downloadbinutils-fe3eaf1cd9af54cd4c678a8dde7fd0df601c9490.zip
binutils-fe3eaf1cd9af54cd4c678a8dde7fd0df601c9490.tar.gz
binutils-fe3eaf1cd9af54cd4c678a8dde7fd0df601c9490.tar.bz2
Minor tui_reg_next / tui_reg_prev cleanup
This changes tui_reg_next and tui_reg_prev so that they don't need to reference the TUI_DATA_WIN globals. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group" parameter. Don't reference globals. (tui_reg_command): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/tui/tui-regs.c21
2 files changed, 17 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 93bb113..822a4a9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2019-07-17 Tom Tromey <tom@tromey.com>
+ * tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group"
+ parameter. Don't reference globals.
+ (tui_reg_command): Update.
+
+2019-07-17 Tom Tromey <tom@tromey.com>
+
* tui/tui-regs.c (tui_show_registers): Simplify.
2019-07-17 Tom Tromey <tom@tromey.com>
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 59bfd08..70e7763 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -460,14 +460,13 @@ tui_display_register (struct tui_data_item_window *data)
register window is not currently being displayed. */
static struct reggroup *
-tui_reg_next (struct gdbarch *gdbarch)
+tui_reg_next (struct reggroup *current_group, struct gdbarch *gdbarch)
{
struct reggroup *group = NULL;
- if (TUI_DATA_WIN != NULL)
+ if (current_group != NULL)
{
- group = TUI_DATA_WIN->current_group;
- group = reggroup_next (gdbarch, group);
+ group = reggroup_next (gdbarch, current_group);
if (group == NULL)
group = reggroup_next (gdbarch, NULL);
}
@@ -479,14 +478,13 @@ tui_reg_next (struct gdbarch *gdbarch)
register window is not currently being displayed. */
static struct reggroup *
-tui_reg_prev (struct gdbarch *gdbarch)
+tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch)
{
struct reggroup *group = NULL;
- if (TUI_DATA_WIN != NULL)
+ if (current_group != NULL)
{
- group = TUI_DATA_WIN->current_group;
- group = reggroup_prev (gdbarch, group);
+ group = reggroup_prev (gdbarch, current_group);
if (group == NULL)
group = reggroup_prev (gdbarch, NULL);
}
@@ -516,10 +514,13 @@ tui_reg_command (const char *args, int from_tty)
if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible)
tui_set_layout_by_name (DATA_NAME);
+ struct reggroup *current_group = NULL;
+ if (TUI_DATA_WIN != NULL)
+ current_group = TUI_DATA_WIN->current_group;
if (strncmp (args, "next", len) == 0)
- match = tui_reg_next (gdbarch);
+ match = tui_reg_next (current_group, gdbarch);
else if (strncmp (args, "prev", len) == 0)
- match = tui_reg_prev (gdbarch);
+ match = tui_reg_prev (current_group, gdbarch);
/* This loop matches on the initial part of a register group
name. If this initial part in ARGS matches only one register