aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-data.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-16 10:42:09 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:26 -0600
commit8761a91b2614304963bfe211ff8c682c7eba3b51 (patch)
tree5407f564c3d3788c0f9e491cbdc2e5b4f0a0da2e /gdb/tui/tui-data.c
parent0ed69edaab683b9290a05962faa50d970facfa84 (diff)
downloadgdb-8761a91b2614304963bfe211ff8c682c7eba3b51.zip
gdb-8761a91b2614304963bfe211ff8c682c7eba3b51.tar.gz
gdb-8761a91b2614304963bfe211ff8c682c7eba3b51.tar.bz2
Introduce tui_win_info::clear_detail method
This introduces the clear_detail method and updates the various subclasses of tui_win_info to implement it. A subsequent patch will remove tui_clear_win_detail, but that isn't done for now because at this point it isn't readily obvious that the NULL check is not needed. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_win_info, struct tui_source_window) (struct tui_data_window, struct tui_cmd_window): Declare clear_detail method. * tui/tui-data.c (tui_source_window::clear_detail) (tui_cmd_window::clear_detail, tui_data_window::clear_detail): New methods. (tui_clear_win_detail): Simplify.
Diffstat (limited to 'gdb/tui/tui-data.c')
-rw-r--r--gdb/tui/tui-data.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 3320b4f..9923a2f 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -178,37 +178,44 @@ tui_add_to_source_windows (struct tui_win_info *win_info)
source_windows.list[source_windows.count++] = win_info;
}
+/* See tui-data.h. */
+
+void
+tui_source_window::clear_detail ()
+{
+ detail.source_info.gdbarch = NULL;
+ detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
+ detail.source_info.start_line_or_addr.u.addr = 0;
+ detail.source_info.horizontal_offset = 0;
+}
+
+/* See tui-data.h. */
+
+void
+tui_cmd_window::clear_detail ()
+{
+ wmove (generic.handle, 0, 0);
+}
+
+/* See tui-data.h. */
+
+void
+tui_data_window::clear_detail ()
+{
+ detail.data_display_info.data_content = NULL;
+ detail.data_display_info.data_content_count = 0;
+ detail.data_display_info.regs_content = NULL;
+ detail.data_display_info.regs_content_count = 0;
+ detail.data_display_info.regs_column_count = 1;
+ detail.data_display_info.display_regs = FALSE;
+}
/* Clear the pertinant detail in the windows. */
void
tui_clear_win_detail (struct tui_win_info *win_info)
{
if (win_info != NULL)
- {
- switch (win_info->generic.type)
- {
- case SRC_WIN:
- case DISASSEM_WIN:
- win_info->detail.source_info.gdbarch = NULL;
- win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
- win_info->detail.source_info.start_line_or_addr.u.addr = 0;
- win_info->detail.source_info.horizontal_offset = 0;
- break;
- case CMD_WIN:
- wmove (win_info->generic.handle, 0, 0);
- break;
- case DATA_WIN:
- win_info->detail.data_display_info.data_content = NULL;
- win_info->detail.data_display_info.data_content_count = 0;
- win_info->detail.data_display_info.regs_content = NULL;
- win_info->detail.data_display_info.regs_content_count = 0;
- win_info->detail.data_display_info.regs_column_count = 1;
- win_info->detail.data_display_info.display_regs = FALSE;
- break;
- default:
- break;
- }
- }
+ win_info->clear_detail ();
}