aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/tui/tui-data.h11
-rw-r--r--gdb/tui/tui-regs.c54
-rw-r--r--gdb/tui/tui-regs.h2
-rw-r--r--gdb/tui/tui-windata.c6
5 files changed, 52 insertions, 36 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0366091..f98fa42 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2019-07-17 Tom Tromey <tom@tromey.com>
+ * tui/tui-regs.h (tui_display_registers_from)
+ (tui_display_registers_from_line): Don't declare.
+ * tui/tui-windata.c (tui_data_window::display_all_data)
+ (tui_data_window::refresh_all)
+ (tui_data_window::do_scroll_vertical): Update.
+ * tui/tui-regs.c (tui_data_window::display_registers_from): Rename
+ from tui_display_registers_from.
+ (tui_display_reg_element_at_line): Update.
+ (tui_data_window::display_registers_from_line): Rename from
+ tui_display_registers_from_line.
+ * tui/tui-data.h (struct tui_data_window) <display_registers_from,
+ display_registers_from_line>: New methods.
+
+2019-07-17 Tom Tromey <tom@tromey.com>
+
* tui/tui-windata.h (tui_erase_data_content): Don't declare.
* tui/tui-windata.c (tui_data_window::erase_data_content): Rename
from tui_erase_data_content.
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index 306f413..5220c4b 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -513,6 +513,17 @@ struct tui_data_window : public tui_win_info
void erase_data_content (const char *prompt);
+ /* Display the registers in the content from 'start_element_no'
+ until the end of the register content or the end of the display
+ height. No checking for displaying past the end of the registers
+ is done here. */
+ void display_registers_from (int start_element_no);
+
+ /* Display the registers starting at line line_no in the data
+ window. Answers the line number that the display actually
+ started from. If nothing is displayed (-1) is returned. */
+ int display_registers_from_line (int line_no);
+
protected:
void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 9b396e4..05b4b55 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -244,19 +244,17 @@ tui_show_register_group (struct reggroup *group,
}
}
-/* Function to display the registers in the content from
- 'start_element_no' until the end of the register content or the end
- of the display height. No checking for displaying past the end of
- the registers is done here. */
+/* See tui-data.h. */
+
void
-tui_display_registers_from (int start_element_no)
+tui_data_window::display_registers_from (int start_element_no)
{
- if (!TUI_DATA_WIN->regs_content.empty ())
+ if (!regs_content.empty ())
{
int j, item_win_width, cur_y;
int max_len = 0;
- for (auto &&data_item_win : TUI_DATA_WIN->regs_content)
+ for (auto &&data_item_win : regs_content)
{
char *p;
int len;
@@ -278,28 +276,25 @@ tui_display_registers_from (int start_element_no)
item_win_width = max_len + 1;
int i = start_element_no;
- TUI_DATA_WIN->regs_column_count =
- (TUI_DATA_WIN->width - 2) / item_win_width;
- if (TUI_DATA_WIN->regs_column_count == 0)
- TUI_DATA_WIN->regs_column_count = 1;
- item_win_width =
- (TUI_DATA_WIN->width - 2) / TUI_DATA_WIN->regs_column_count;
+ regs_column_count = (width - 2) / item_win_width;
+ if (regs_column_count == 0)
+ regs_column_count = 1;
+ item_win_width = (width - 2) / regs_column_count;
/* Now create each data "sub" window, and write the display into
it. */
cur_y = 1;
- while (i < TUI_DATA_WIN->regs_content.size ()
- && cur_y <= TUI_DATA_WIN->viewport_height)
+ while (i < regs_content.size ()
+ && cur_y <= viewport_height)
{
for (j = 0;
- j < TUI_DATA_WIN->regs_column_count
- && i < TUI_DATA_WIN->regs_content.size ();
+ j < regs_column_count && i < regs_content.size ();
j++)
{
struct tui_data_item_window *data_item_win;
/* Create the window if necessary. */
- data_item_win = TUI_DATA_WIN->regs_content[i].get ();
+ data_item_win = regs_content[i].get ();
if (data_item_win->handle != NULL
&& (data_item_win->height != 1
|| data_item_win->width != item_win_width
@@ -362,20 +357,17 @@ tui_display_reg_element_at_line (int start_element_no,
= (TUI_DATA_WIN->first_reg_element_no_inline
(first_line_on_last_page));
}
- tui_display_registers_from (element_no);
+ TUI_DATA_WIN->display_registers_from (element_no);
}
}
+/* See tui-data.h. */
-
-/* Function to display the registers starting at line line_no in the
- data window. Answers the line number that the display actually
- started from. If nothing is displayed (-1) is returned. */
int
-tui_display_registers_from_line (int line_no)
+tui_data_window::display_registers_from_line (int line_no)
{
- tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
- if (!TUI_DATA_WIN->regs_content.empty ())
+ tui_check_and_display_highlight_if_needed (this);
+ if (!regs_content.empty ())
{
int element_no;
@@ -385,16 +377,16 @@ tui_display_registers_from_line (int line_no)
{
/* Make sure that we don't display off the end of the
registers. */
- if (line_no >= TUI_DATA_WIN->last_regs_line_no ())
+ if (line_no >= last_regs_line_no ())
{
- if ((line_no = TUI_DATA_WIN->line_from_reg_element_no (
- TUI_DATA_WIN->regs_content.size () - 1)) < 0)
+ line_no = line_from_reg_element_no (regs_content.size () - 1);
+ if (line_no < 0)
line_no = 0;
}
}
- element_no = TUI_DATA_WIN->first_reg_element_no_inline (line_no);
- if (element_no < TUI_DATA_WIN->regs_content.size ())
+ element_no = first_reg_element_no_inline (line_no);
+ if (element_no < regs_content.size ())
tui_display_reg_element_at_line (element_no, line_no);
else
line_no = (-1);
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index c99910b..354605c 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -26,7 +26,5 @@
extern void tui_check_register_values (struct frame_info *);
extern void tui_show_registers (struct reggroup *group);
-extern void tui_display_registers_from (int);
-extern int tui_display_registers_from_line (int);
#endif /* TUI_TUI_REGS_H */
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index 47d777a..2ee259e 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -101,7 +101,7 @@ tui_data_window::display_all_data ()
erase_data_content (NULL);
delete_data_content_windows ();
tui_check_and_display_highlight_if_needed (this);
- tui_display_registers_from (0);
+ display_registers_from (0);
}
}
@@ -125,7 +125,7 @@ tui_data_window::refresh_all ()
if (first_line >= 0)
{
erase_data_content (NULL);
- tui_display_registers_from_line (first_line);
+ display_registers_from_line (first_line);
}
}
}
@@ -152,7 +152,7 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
first_line += num_to_scroll;
erase_data_content (NULL);
delete_data_content_windows ();
- tui_display_registers_from_line (first_line);
+ display_registers_from_line (first_line);
}
}