aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-win.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-23 14:27:04 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:50 -0600
commit53e7cdbaa1d8c0c53038226de07d8160d7f66d82 (patch)
tree5a7bb07390157fe841fc65034a7bd7fa843a59bc /gdb/tui/tui-win.c
parent7908abbf18dde6d3163758e447d72d6d2b267927 (diff)
downloadgdb-53e7cdbaa1d8c0c53038226de07d8160d7f66d82.zip
gdb-53e7cdbaa1d8c0c53038226de07d8160d7f66d82.tar.gz
gdb-53e7cdbaa1d8c0c53038226de07d8160d7f66d82.tar.bz2
Remove union tui_which_element
This removes union tui_which_element, instead moving the content directly into tui_source_window_base. This allows for the deletion of a fair amount of code. Now the TUI window hierarchy is more type-safe. In particular, there is never any confusion now about which members are in use by which subtype. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_update_source_window_as_is) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_show_source_line) (tui_show_source_content, tui_source_window_base::refill) (tui_source_window_base::set_is_exec_point_at) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content): Update. (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::do_make_visible_with_new_height): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil) (tui_source_window::do_scroll_vertical): Update. * tui/tui-layout.c (show_layout): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (tui_win_content): Remove. (struct tui_gen_win_info) <content, content_size>: Remove. (struct tui_source_element): Add initializers and destructor. (union tui_which_element, struct tui_win_element): Remove. (struct tui_source_window_base) <content>: New field. (struct tui_data_window): Remove destructor. (tui_alloc_content, tui_free_win_content) (tui_free_all_source_wins_content): Don't declare. * tui/tui-data.c (tui_initialize_static_data): Update. (init_content_element, tui_alloc_content): Remove. (~tui_gen_win_info): Update. (~tui_data_window, tui_free_all_source_wins_content) (tui_free_win_content, free_content, free_content_elements): Remove.
Diffstat (limited to 'gdb/tui/tui-win.c')
-rw-r--r--gdb/tui/tui-win.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 2f862c1..557f8b5 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -616,7 +616,7 @@ tui_resize_all (void)
make_invisible_and_set_new_height (TUI_CMD_WIN, new_height);
first_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
- if (src_win->content_size <= 0)
+ if (src_win->content.empty ())
tui_erase_source_content (src_win, EMPTY_SOURCE_PROMPT);
break;
default:
@@ -681,7 +681,7 @@ tui_resize_all (void)
first_win->make_visible_with_new_height ();
second_win->make_visible_with_new_height ();
TUI_CMD_WIN->make_visible_with_new_height ();
- if (src_win->content_size <= 0)
+ if (src_win->content.empty ())
tui_erase_source_content (src_win, EMPTY_SOURCE_PROMPT);
break;
}
@@ -1127,11 +1127,14 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
win_info->make_visible_with_new_height ();
primary_win_info->make_visible_with_new_height ();
if ((src_win_info->type == SRC_WIN
- || src_win_info->type == DISASSEM_WIN)
- && src_win_info->content_size <= 0)
- tui_erase_source_content
- ((tui_source_window_base *) src_win_info,
- EMPTY_SOURCE_PROMPT);
+ || src_win_info->type == DISASSEM_WIN))
+ {
+ tui_source_window_base *src_base
+ = (tui_source_window_base *) src_win_info;
+ if (src_base->content.empty ())
+ tui_erase_source_content (src_base,
+ EMPTY_SOURCE_PROMPT);
+ }
}
else
{
@@ -1236,9 +1239,9 @@ tui_adjust_win_heights (struct tui_win_info *primary_win_info,
TUI_CMD_WIN->make_visible_with_new_height ();
second_win->make_visible_with_new_height ();
first_win->make_visible_with_new_height ();
- if (src1 != nullptr && src1->content_size <= 0)
+ if (src1 != nullptr && src1->content.empty ())
tui_erase_source_content (src1, EMPTY_SOURCE_PROMPT);
- if (second_win->content_size <= 0)
+ if (second_win->content.empty ())
tui_erase_source_content (second_win, EMPTY_SOURCE_PROMPT);
}
}
@@ -1319,16 +1322,14 @@ tui_win_info::make_visible_with_new_height ()
void
tui_source_window_base::do_make_visible_with_new_height ()
{
- tui_free_win_content (execution_info);
tui_make_visible (execution_info);
- if (content != NULL)
+ if (!content.empty ())
{
struct tui_line_or_address line_or_addr;
struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
line_or_addr = start_line_or_addr;
- tui_free_win_content (this);
tui_update_source_window (this, gdbarch,
cursal.symtab, line_or_addr, TRUE);
}