Add two methods to tui_data_window
This changes tui_show_registers and tui_show_register_group to be methods on tui_data_window. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <show_registers, show_register_group>: Declare. (tui_show_register_group): Don't declare. * tui/tui-regs.c (tui_data_window::show_registers): Rename from tui_show_registers. (tui_data_window::show_register_group): Rename from tui_show_register_group. (tui_data_window::check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.
This commit is contained in:
parent
63356bfda1
commit
ca02d7c800
|
@ -1,3 +1,16 @@
|
||||||
|
2019-08-20 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-regs.h (struct tui_data_window) <show_registers,
|
||||||
|
show_register_group>: Declare.
|
||||||
|
(tui_show_register_group): Don't declare.
|
||||||
|
* tui/tui-regs.c (tui_data_window::show_registers): Rename from
|
||||||
|
tui_show_registers.
|
||||||
|
(tui_data_window::show_register_group): Rename from
|
||||||
|
tui_show_register_group.
|
||||||
|
(tui_data_window::check_register_values, tui_reg_command):
|
||||||
|
Update.
|
||||||
|
* tui/tui-layout.c (tui_set_layout): Update.
|
||||||
|
|
||||||
2019-08-20 Tom Tromey <tom@tromey.com>
|
2019-08-20 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
|
* tui/tui-regs.h (struct tui_data_window) <check_register_values>:
|
||||||
|
|
|
@ -189,7 +189,7 @@ tui_set_layout (enum tui_layout_type layout_type)
|
||||||
tui_update_source_windows_with_addr (gdbarch, addr);
|
tui_update_source_windows_with_addr (gdbarch, addr);
|
||||||
if (new_layout == SRC_DATA_COMMAND
|
if (new_layout == SRC_DATA_COMMAND
|
||||||
|| new_layout == DISASSEM_DATA_COMMAND)
|
|| new_layout == DISASSEM_DATA_COMMAND)
|
||||||
tui_show_registers (TUI_DATA_WIN->current_group);
|
TUI_DATA_WIN->show_registers (TUI_DATA_WIN->current_group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,6 @@
|
||||||
|
|
||||||
static void tui_display_register (struct tui_data_item_window *data);
|
static void tui_display_register (struct tui_data_item_window *data);
|
||||||
|
|
||||||
static void tui_show_register_group (tui_data_window *win_info,
|
|
||||||
struct reggroup *group,
|
|
||||||
struct frame_info *frame,
|
|
||||||
int refresh_values_only);
|
|
||||||
|
|
||||||
/* Get the register from the frame and return a printable
|
/* Get the register from the frame and return a printable
|
||||||
representation of it. */
|
representation of it. */
|
||||||
|
|
||||||
|
@ -152,33 +147,33 @@ tui_data_window::first_reg_element_no_inline (int line_no) const
|
||||||
/* Show the registers of the given group in the data window
|
/* Show the registers of the given group in the data window
|
||||||
and refresh the window. */
|
and refresh the window. */
|
||||||
void
|
void
|
||||||
tui_show_registers (struct reggroup *group)
|
tui_data_window::show_registers (struct reggroup *group)
|
||||||
{
|
{
|
||||||
if (group == 0)
|
if (group == 0)
|
||||||
group = general_reggroup;
|
group = general_reggroup;
|
||||||
|
|
||||||
/* Say that registers should be displayed, even if there is a
|
/* Say that registers should be displayed, even if there is a
|
||||||
problem. */
|
problem. */
|
||||||
TUI_DATA_WIN->display_regs = true;
|
display_regs = true;
|
||||||
|
|
||||||
if (target_has_registers && target_has_stack && target_has_memory)
|
if (target_has_registers && target_has_stack && target_has_memory)
|
||||||
{
|
{
|
||||||
tui_show_register_group (TUI_DATA_WIN, group, get_selected_frame (NULL),
|
show_register_group (group, get_selected_frame (NULL),
|
||||||
group == TUI_DATA_WIN->current_group);
|
group == current_group);
|
||||||
|
|
||||||
/* Clear all notation of changed values. */
|
/* Clear all notation of changed values. */
|
||||||
for (auto &&data_item_win : TUI_DATA_WIN->regs_content)
|
for (auto &&data_item_win : regs_content)
|
||||||
{
|
{
|
||||||
if (data_item_win != nullptr)
|
if (data_item_win != nullptr)
|
||||||
data_item_win->highlight = false;
|
data_item_win->highlight = false;
|
||||||
}
|
}
|
||||||
TUI_DATA_WIN->current_group = group;
|
current_group = group;
|
||||||
TUI_DATA_WIN->display_all_data ();
|
display_all_data ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TUI_DATA_WIN->current_group = 0;
|
current_group = 0;
|
||||||
TUI_DATA_WIN->erase_data_content (_("[ Register Values Unavailable ]"));
|
erase_data_content (_("[ Register Values Unavailable ]"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,22 +182,18 @@ tui_show_registers (struct reggroup *group)
|
||||||
using the given frame. Values are refreshed only when
|
using the given frame. Values are refreshed only when
|
||||||
refresh_values_only is TRUE. */
|
refresh_values_only is TRUE. */
|
||||||
|
|
||||||
static void
|
void
|
||||||
tui_show_register_group (tui_data_window *win_info,
|
tui_data_window::show_register_group (struct reggroup *group,
|
||||||
struct reggroup *group,
|
struct frame_info *frame,
|
||||||
struct frame_info *frame,
|
int refresh_values_only)
|
||||||
int refresh_values_only)
|
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
int nr_regs;
|
int nr_regs;
|
||||||
int regnum, pos;
|
int regnum, pos;
|
||||||
char title[80];
|
|
||||||
|
|
||||||
/* Make a new title showing which group we display. */
|
/* Make a new title showing which group we display. */
|
||||||
snprintf (title, sizeof (title) - 1, "Register group: %s",
|
xfree (title);
|
||||||
reggroup_name (group));
|
title = xstrprintf ("Register group: %s", reggroup_name (group));
|
||||||
xfree (win_info->title);
|
|
||||||
win_info->title = xstrdup (title);
|
|
||||||
|
|
||||||
/* See how many registers must be displayed. */
|
/* See how many registers must be displayed. */
|
||||||
nr_regs = 0;
|
nr_regs = 0;
|
||||||
|
@ -224,14 +215,14 @@ tui_show_register_group (tui_data_window *win_info,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refresh_values_only)
|
if (!refresh_values_only)
|
||||||
win_info->regs_content.clear ();
|
regs_content.clear ();
|
||||||
|
|
||||||
if (nr_regs < win_info->regs_content.size ())
|
if (nr_regs < regs_content.size ())
|
||||||
win_info->regs_content.resize (nr_regs);
|
regs_content.resize (nr_regs);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = win_info->regs_content.size (); i < nr_regs; ++i)
|
for (int i = regs_content.size (); i < nr_regs; ++i)
|
||||||
win_info->regs_content.emplace_back (new tui_data_item_window ());
|
regs_content.emplace_back (new tui_data_item_window ());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now set the register names and values. */
|
/* Now set the register names and values. */
|
||||||
|
@ -251,7 +242,7 @@ tui_show_register_group (tui_data_window *win_info,
|
||||||
if (name == 0 || *name == '\0')
|
if (name == 0 || *name == '\0')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data_item_win = win_info->regs_content[pos].get ();
|
data_item_win = regs_content[pos].get ();
|
||||||
if (data_item_win)
|
if (data_item_win)
|
||||||
{
|
{
|
||||||
if (!refresh_values_only)
|
if (!refresh_values_only)
|
||||||
|
@ -558,7 +549,7 @@ void
|
||||||
tui_data_window::check_register_values (struct frame_info *frame)
|
tui_data_window::check_register_values (struct frame_info *frame)
|
||||||
{
|
{
|
||||||
if (regs_content.empty () && display_regs)
|
if (regs_content.empty () && display_regs)
|
||||||
tui_show_registers (current_group);
|
show_registers (current_group);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto &&data_item_win_ptr : regs_content)
|
for (auto &&data_item_win_ptr : regs_content)
|
||||||
|
@ -710,7 +701,7 @@ tui_reg_command (const char *args, int from_tty)
|
||||||
if (match == NULL)
|
if (match == NULL)
|
||||||
error (_("unknown register group '%s'"), args);
|
error (_("unknown register group '%s'"), args);
|
||||||
|
|
||||||
tui_show_registers (match);
|
TUI_DATA_WIN->show_registers (match);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,6 +102,8 @@ struct tui_data_window : public tui_win_info
|
||||||
|
|
||||||
void check_register_values (struct frame_info *frame);
|
void check_register_values (struct frame_info *frame);
|
||||||
|
|
||||||
|
void show_registers (struct reggroup *group);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void do_scroll_vertical (int num_to_scroll) override;
|
void do_scroll_vertical (int num_to_scroll) override;
|
||||||
|
@ -120,8 +122,10 @@ protected:
|
||||||
void display_reg_element_at_line (int start_element_no, int start_line_no);
|
void display_reg_element_at_line (int start_element_no, int start_line_no);
|
||||||
|
|
||||||
void rerender () override;
|
void rerender () override;
|
||||||
|
|
||||||
|
void show_register_group (struct reggroup *group,
|
||||||
|
struct frame_info *frame,
|
||||||
|
int refresh_values_only);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void tui_show_registers (struct reggroup *group);
|
|
||||||
|
|
||||||
#endif /* TUI_TUI_REGS_H */
|
#endif /* TUI_TUI_REGS_H */
|
||||||
|
|
Loading…
Reference in New Issue