From e80cd2047079a63ab087df15d179c49ca18de202 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 26 Jun 2019 16:25:40 -0600 Subject: [PATCH] Parameterize tui_show_register_group with window This changes tui_show_register_group not to reference the TUI_DATA_WIN global, instead leaving that to its caller. gdb/ChangeLog 2019-07-17 Tom Tromey * tui/tui-regs.c (tui_show_registers): Update. (tui_show_register_group): Add win_info parameter. --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-regs.c | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f4e9e5ef3a1..15bdcc7cc18 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-07-17 Tom Tromey + + * tui/tui-regs.c (tui_show_registers): Update. + (tui_show_register_group): Add win_info parameter. + 2019-07-17 Tom Tromey * tui/tui-regs.c (tui_data_window::display_reg_element_at_line): diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 56441bc454b..17b3b286712 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -49,7 +49,8 @@ ******************************************/ static void tui_display_register (struct tui_data_item_window *data); -static void tui_show_register_group (struct reggroup *group, +static void tui_show_register_group (tui_data_window *win_info, + struct reggroup *group, struct frame_info *frame, int refresh_values_only); @@ -139,7 +140,7 @@ tui_show_registers (struct reggroup *group) if (target_has_registers && target_has_stack && target_has_memory) { - tui_show_register_group (group, get_selected_frame (NULL), + tui_show_register_group (TUI_DATA_WIN, group, get_selected_frame (NULL), group == TUI_DATA_WIN->current_group); ret = TUI_SUCCESS; } @@ -167,7 +168,8 @@ tui_show_registers (struct reggroup *group) refresh_values_only is TRUE. */ static void -tui_show_register_group (struct reggroup *group, +tui_show_register_group (tui_data_window *win_info, + struct reggroup *group, struct frame_info *frame, int refresh_values_only) { @@ -179,8 +181,8 @@ tui_show_register_group (struct reggroup *group, /* Make a new title showing which group we display. */ snprintf (title, sizeof (title) - 1, "Register group: %s", reggroup_name (group)); - xfree (TUI_DATA_WIN->title); - TUI_DATA_WIN->title = xstrdup (title); + xfree (win_info->title); + win_info->title = xstrdup (title); /* See how many registers must be displayed. */ nr_regs = 0; @@ -202,14 +204,14 @@ tui_show_register_group (struct reggroup *group, } if (!refresh_values_only) - TUI_DATA_WIN->regs_content.clear (); + win_info->regs_content.clear (); - if (nr_regs < TUI_DATA_WIN->regs_content.size ()) - TUI_DATA_WIN->regs_content.resize (nr_regs); + if (nr_regs < win_info->regs_content.size ()) + win_info->regs_content.resize (nr_regs); else { - for (int i = TUI_DATA_WIN->regs_content.size (); i < nr_regs; ++i) - TUI_DATA_WIN->regs_content.emplace_back (new tui_data_item_window ()); + for (int i = win_info->regs_content.size (); i < nr_regs; ++i) + win_info->regs_content.emplace_back (new tui_data_item_window ()); } /* Now set the register names and values. */ @@ -229,7 +231,7 @@ tui_show_register_group (struct reggroup *group, if (name == 0 || *name == '\0') continue; - data_item_win = TUI_DATA_WIN->regs_content[pos].get (); + data_item_win = win_info->regs_content[pos].get (); if (data_item_win) { if (!refresh_values_only) -- 2.30.2