aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-data.h
AgeCommit message (Collapse)AuthorFilesLines
2019-08-30Remove NO_DATA_STRINGTom Tromey1-1/+0
NO_DATA_STRING shouldn't be used. It's referenced in a single spot, in tui_data_window::display_all_data. This patch removes the use and replaces it with the more correct text. A later patch (though not in this series) will remove this call entirely, when it's more obviously correct to do so. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::display_all_data): Change text. * tui/tui-data.h (NO_DATA_STRING): Remove define.
2019-08-21Fix g++ 9.1 build breakageChristian Biesinger1-0/+1
gdb/ChangeLog: 2019-08-21 Christian Biesinger <cbiesinger@google.com> * tui/tui-data.h (tui_gen_win_info): Add an =default move constructor, required by some GCC versions.
2019-08-20Remove some defines from tui-data.hTom Tromey1-2/+0
This removes the HILITE and NO_HILITE defines from tui-data.h, in favor of simply passing a bool to box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (box_win): Change type of highlight_flag. (tui_unhighlight_win, tui_highlight_win) (tui_win_info::make_window): Update. * tui/tui-data.h (HILITE, NO_HILITE): Remove.
2019-08-20Move some defines to tui-stack.cTom Tromey1-11/+0
Some #defines in tui-data.h are only used in tui-stack.c, so move them there. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-data.h (PROC_PREFIX, LINE_PREFIX, PC_PREFIX) (MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH) (MAX_PID_WIDTH): Move to tui-stack.c. * tui/tui-stack.c (PROC_PREFIX, LINE_PREFIX, PC_PREFIX) (MIN_LINE_WIDTH, MIN_PROC_WIDTH, MAX_TARGET_WIDTH) (MAX_PID_WIDTH): Move from tui-data.h.
2019-08-20Change tui_make_window to be a methodTom Tromey1-9/+8
I combined several small changes into one patch here. I believe I started by noticing that the "title" is not needed by tui_gen_win_info and could be self-managing (i.e. std::string). Moving this revealed that "can_box" is also a property of tui_win_info and not tui_gen_win_info; and this in turn caused the changes to tui_make_window and box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Don't declare. * tui/tui-wingeneral.c (box_win): Change type of win_info. (box_win): Update. (tui_gen_win_info::make_window): Rename from tui_make_window. (tui_win_info::make_window): New method. (tui_gen_win_info::make_visible): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-regs.c (tui_data_window::show_register_group): Update. (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <make_window>: Declare. <can_box>: Remove. <title>: Remove. (struct tui_win_info) <make_window>: Declare. <can_box>: Now virtual. <title>: New member. * tui/tui-data.c (~tui_gen_win_info): Don't free title. * tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-20Some i18n fixes for the TUITom Tromey1-3/+0
The TUI has a few #defines that hold user-visible strings. As these are only used in a single spot, this patch removes the defines, preferring direct use of the string where needed. Furthermore, now the strings are wrapped in _(), which is friendlier for i18n purposes. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-source.h (struct tui_source_window): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-disasm.h (struct tui_disasm_window): Update. * tui/tui-data.h (NO_SRC_STRING, NO_DISASSEM_STRING) (NO_REGS_STRING): Remove defines.
2019-08-16Remove separate visibility flagTom Tromey1-2/+6
TUI windows keep track of their visibility in a boolean field. However, this is not needed, because a window is visible if and only if it has an underlying curses handle. So, we can remove this separate field. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_is_window_visible): Update. * tui/tui-wingeneral.c (tui_make_window) (tui_gen_win_info::make_visible, tui_refresh_all): Update. * tui/tui-win.c (window_name_completer, tui_refresh_all_win) (tui_set_focus_command, tui_all_windows_info, update_tab_width) (tui_set_win_height_command, parse_scrolling_args): Update. * tui/tui-source.c (tui_source_window::style_changed): Update. * tui/tui-regs.c (tui_show_registers) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_check_register_values, tui_reg_command): Update. * tui/tui-disasm.c (tui_show_disassem): Update. * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New method. <is_visible>: Remove field. * tui/tui-data.c (tui_next_win, tui_prev_win) (tui_delete_invisible_windows): Update.
2019-08-15TUI resize unificationTom Tromey1-17/+7
The TUI currently has two different ways to resize a window: the resize method, and the methods make_invisible_and_set_new_height and make_visible_with_new_height. There's no deep reason to have two different ways to resize a window, so this patch unifies them, leaving just the "resize" method. This also changes the locator to be handled more like an ordinary window and less like an adjunct of the associated source window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before calling update_cmdwin_start_line. * tui/tui-winsource.h (struct tui_source_window_base) <do_make_visible_with_new_height, set_new_height>: Don't declare. <rerender>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_tab_width): Call rerender. (tui_source_window_base::set_new_height): Remove. (tui_source_window_base::rerender): Rename from do_make_visible_with_new_height. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use resize method. (tui_win_info::make_invisible_and_set_new_height) (tui_win_info::make_visible_with_new_height): Remove. * tui/tui-stack.h (struct tui_locator_window) <rerender>: Declare. * tui/tui-stack.c (tui_locator_window::rerender): New method. * tui/tui-regs.h (struct tui_data_window) <set_new_height, do_make_visible_with_new_height>: Don't declare. <rerender>: Declare. * tui/tui-regs.c (tui_data_window::rerender): Rename from set_new_height. (tui_data_window::do_make_visible_with_new_height): Remove. * tui/tui-layout.c (show_source_disasm_command, show_data): Don't call tui_show_locator_content. (tui_gen_win_info::resize): Call rerender. (show_source_or_disasm_and_command): Don't call tui_show_locator_content. * tui/tui-data.h (struct tui_gen_win_info) <rerender>: New method. (struct tui_win_info) <rerender>: Declare. <set_new_height, make_invisible_and_set_new_height, make_visible_with_new_height>: Don't declare. * tui/tui-data.c (tui_win_list::rerender): New method. * tui/tui-command.h (struct tui_cmd_window) <do_make_visible_with_new_height>: Don't declare. * tui/tui-command.c (tui_cmd_window::do_make_visible_with_new_height): Remove. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * gdb.tui/empty.exp: Enable resizing tests.
2019-08-15Change TUI source window iterationTom Tromey1-3/+0
Currently the TUI does separate bookkeeping to track which source windows exist. It seems better to me to just refer to the list of windows for this, so this patch removes the special handling and instead adds a new iterator. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_iterator): New. (struct tui_source_windows): New. * tui/tui-winsource.c (tui_display_main): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (new_height_ok, parse_scrolling_args): Update. * tui/tui-layout.c (show_layout, show_data): Update. * tui/tui-data.h (tui_source_windows, tui_clear_source_windows) (tui_add_to_source_windows): Don't declare. * tui/tui-data.c (source_windows, tui_source_windows) (tui_clear_source_windows, tui_add_to_source_windows): Remove.
2019-08-15Rename the "reset" method to "resize"Tom Tromey1-3/+3
tui_gen_win_info::reset really just resizes the window. This patch renames it to reflect this. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <resize>: Rename from reset. * tui/tui-winsource.c (tui_source_window_base::resize): Rename. * tui/tui-layout.c (show_source_disasm_command, show_data): Update. (tui_gen_win_info::resize): Rename. (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <resize>: Rename from reset.
2019-08-15Remove tui_initialize_static_dataTom Tromey1-1/+0
tui_initialize_static_data is not needed, because locator moving and resizing is already handled in the layout code. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-stack.c (tui_initialize_static_data): Remove. * tui/tui-interp.c (tui_interp::init): Don't call tui_initialize_static_data. * tui/tui-data.h (tui_initialize_static_data): Don't declare.
2019-08-15Move locator code to tui-stack.cTom Tromey1-25/+0
The locator is mostly implemented in tui-stack.c. This moves the remaining bits to tui-stack.c and tui-stack.h, as appropriate. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c: Include tui-stack.h. * tui/tui-stack.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move from tui-data.h. * tui/tui-stack.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move from tui-data.c. * tui/tui-data.h (MAX_LOCATOR_ELEMENT_LEN) (struct tui_locator_window): Move to tui-stack.c. * tui/tui-data.c (_locator, tui_locator_win_info_ptr) (tui_initialize_static_data): Move to tui-stack.c.
2019-08-15Simplify TUI boxingTom Tromey1-7/+11
In the TUI, whether or not a window can be boxed is a property of the window's type. This adds a can_box method to the window classes, and changes tui_make_window to defer to this, removing the "box_it" paramter. This also lets us remove "enum tui_box", as it is no longer used. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Update. * tui/tui-wingeneral.c (tui_make_window): Remove "box_it" parameter. (tui_gen_win_info::make_visible): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method. (enum tui_box): Remove. (struct tui_win_info) <can_box>: New method. * tui/tui-command.h (struct tui_cmd_window) <can_box>: New method.
2019-08-13Remove tui_gen_win_info::last_visible_lineTom Tromey1-2/+0
The last_visible_line field of tui_gen_win_info is not used, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>: Remove. * tui/tui-data.c (tui_initialize_static_data): Update.
2019-08-13Move code to tui-winsource.hTom Tromey1-41/+0
This moves code related to the execution info window from tui-data.h to tui-winsource.h. It fits better here because the execution info is conceptually part of the source and disassembly windows, and tui-winsource.h is where this common class lives. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element) (TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS) (TUI_EXECINFO_SIZE, tui_exec_info_content): Move ... * tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS) (TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content): ... here.
2019-08-13Change tui_check_and_display_highlight_if_needed to be a methodTom Tromey1-0/+2
This changes tui_check_and_display_highlight_if_needed to be a method on tui_win_info. This makes it clear that the NULL check in that function is not needed, so it is removed here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_erase_source_content) (tui_show_source_content, tui_source_window_base::refresh_all): Update. * tui/tui-wingeneral.h (tui_check_and_display_highlight_if_needed): Don't declare. * tui/tui-wingeneral.c (tui_win_info::check_and_display_highlight_if_needed): Rename from check_and_display_highlight_if_needed. * tui/tui-win.c (tui_rehighlight_all) (tui_win_info::make_visible_with_new_height): Update. * tui/tui-regs.c (tui_data_window::display_registers_from_line) (tui_data_window::erase_data_content) (tui_data_window::display_all_data): Update. * tui/tui-data.h (struct tui_win_info) <check_and_display_highlight_if_needed>: Declare.
2019-08-13Delete invisible TUI windowsTom Tromey1-0/+5
This changes the TUI so that when the layout changes, any windows that are invisible are now deleted. This makes it simpler to understand window lifetimes. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all): Call tui_delete_invisible_windows. * tui/tui-layout.c (show_layout): Call tui_delete_invisible_windows. * tui/tui-data.h (tui_delete_invisible_windows): Declare. * tui/tui-data.c (tui_delete_invisible_windows): New function.
2019-08-13Move current_layout to tui-layout.cTom Tromey1-1/+0
This moves the current_layout global to tui-layout.c. This allows for the removal of an accessor function; but also it just seems clearer to have it here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (current_layout, tui_current_layout): Move from tui-data.c. (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Don't use tui_set_current_layout_to. * tui/tui-data.h (tui_set_current_layout_to): Don't declare. * tui/tui-data.c (current_layout, tui_current_layout): Move to tui-layout.c. (tui_set_current_layout_to): Remove.
2019-08-13Remove struct tui_layout_defTom Tromey1-7/+0
"layout_def" isn't actually used in the TUI, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_layout_def): Remove. (tui_layout_def): Don't declare. * tui/tui-data.c (layout_def): Remove. (tui_layout_def): Remove.
2019-08-13clear_detail can only be called on TUI source windowsTom Tromey1-3/+0
The clear_detail method can only be called on source windows, so remove definitions from the base of the class hierarchy, leaving only a single non-virtual method. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: No longer "override". * tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove. * tui/tui-regs.c (tui_data_window::clear_detail): Remove. * tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove. * tui/tui-command.h (struct tui_cmd_window) <clear_detail>: Remove. * tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-07-17Move source window common to code to tui-winsource.[ch]Tom Tromey1-84/+1
Like the previous rearranging patches, this moves the source and disassembly window base class code to tui-winsource.[ch]. The execution info window is also moved, because it is associated with this base class. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) (struct tui_source_window_base): Move from tui-data.h. * tui/tui-winsource.c: Move many method definitions from elsewhere. Remove "structuring" comments. * tui/tui-wingeneral.c (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Move to tui-winsource.c. * tui/tui-win.c (tui_source_window_base::refresh_all) (tui_source_window_base::update_tab_width) (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Move to tui-winsource.c. * tui/tui-source.h: Update. * tui/tui-source.c (tui_source_window_base::reset): Move to tui-winsource.c. * tui/tui-disasm.h: Update. * tui/tui-data.h (struct tui_exec_info_window): Move to tui-winsource.h. (struct tui_source_window_base): Likewise. * tui/tui-data.c (tui_source_window_base::clear_detail) (tui_source_window_base, ~tui_source_window_base): Move to tui-winsource.c.
2019-07-17Change make_invisible_and_set_new_height to be a methodTom Tromey1-0/+5
This changes make_invisible_and_set_new_height to be a method on tui_win_info. I felt that this was cleaner. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all) (tui_source_window_base::update_tab_width) (tui_adjust_win_heights): Update. (tui_win_info::make_invisible_and_set_new_height): Rename from make_invisible_and_set_new_height. * tui/tui-data.h (struct tui_win_info) <make_invisible_and_set_new_height>: New method.
2019-07-17Move tui_source_window to tui-source.hTom Tromey1-30/+1
This moves tui_source_window to tui-source.h. In this case there were no method definitions to be moved. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-source.h (struct tui_source_window): Move from tui-data.h. * tui/tui-layout.c: Update. * tui/tui-disasm.c: Update. * tui/tui-data.h (struct tui_source_window): Move to tui-source.h.
2019-07-17Move tui_disasm_window to tui-disasm.hTom Tromey1-23/+0
This moves tui_disasm_window to tui-disasm.h. In this case there were no method definitions to be moved. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-disasm.h (struct tui_disasm_window): Move from tui-data.h. * tui/tui-data.h (struct tui_disasm_window): Move to tui-disasm.h.
2019-07-17Move TUI data item window to tui-regs.hTom Tromey1-19/+0
The TUI data item window is only used by the TUI register window. So, this patch moves the relevant code to tui-regs.[ch]. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window): Move from tui-data.h. * tui/tui-regs.c (tui_data_item_window): Move from tui-data.c. * tui/tui-data.h (struct tui_data_item_window): Move to tui-regs.h. * tui/tui-data.c (~tui_data_item_window): Move to tui-regs.c.
2019-07-17Move TUI command window codeTom Tromey1-47/+2
Like the earlier change to the data window, this moves the TUI command window code to tui-command.[ch], and removes the old "structuring" comments from tui-command.c. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-win.c (tui_cmd_window::do_make_visible_with_new_height) (tui_cmd_window::max_height): Move to tui-command.c. * tui/tui-layout.c: Update. * tui/tui-data.h (struct tui_cmd_window): Move to tui-command.h. * tui/tui-data.c (tui_cmd_window::clear_detail): Move to tui-command.c. * tui/tui-command.h (struct tui_cmd_window): Move from tui-data.h. * tui/tui-command.c: Remove "structuring" comments. (tui_cmd_window::clear_detail) (tui_cmd_window::do_make_visible_with_new_height) (tui_cmd_window::max_height): Move from elsewhere.
2019-07-17Rearrange TUI data window codeTom Tromey1-81/+0
An earlier patch caused tui-windata.h to be essentially empty. And, other earlier patches implemented TUI data window methods in any spot that happened to be convenient at the time. This patch rearranges all the data window code to be somewhat more organized. It moves tui_data_window to tui-regs.h, and moves the implementation of all methods to tui-regs.c. It then removes tui-windata.h and tui-windata.c. It also removes the "structuring" comments from tui-regs.c; these are not the usual gdb style, and were out of date anyhow. Finally, it moves _initialize_tui_regs to the end of the file, per the usual gdb convention. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to tui-regs.c. * tui/tui-windata.h: Remove file. * tui/tui-windata.c: Remove file. * tui/tui-win.c (tui_data_window::set_new_height) (tui_data_window::do_make_visible_with_new_height): Move to tui-regs.c. * tui/tui-regs.h (struct tui_data_window): Move from tui-data.h. * tui/tui-regs.c: Remove "structuring" comments. (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_window::display_all_data) (tui_data_window::refresh_all) (tui_data_window::do_scroll_vertical) (tui_data_window::clear_detail, tui_data_window::set_new_height) (tui_data_window::do_make_visible_with_new_height) (tui_data_window::refresh_window): Move from elsewhere. (_initialize_tui_regs): Move to end of file. * tui/tui-layout.c: Update. * tui/tui-hooks.c: Update. * tui/tui-data.h (struct tui_data_window): Move to tui-regs.h. * tui/tui-data.c (tui_data_window::clear_detail): Move to tui-regs.c. * Makefile.in (SUBDIR_TUI_SRCS): Remove tui-windata.c.
2019-07-17Remove has_locator methodTom Tromey1-12/+0
Earlier changes made it obvious that the has_locator method can only be called for source/disassembly windows. Because the only reference to this now occurs in methods on this object, we can remove the has_locator method entirely, in favor of using the member directly. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Use m_has_locator field directly. * tui/tui-data.h (struct tui_win_info) <has_locator>: Remove method. (struct tui_source_window_base) <has_locator>: Likewise.
2019-07-17Remove the win_type parameter from tui_gen_win_info::resetTom Tromey1-7/+4
tui_gen_win_info::reset has a window type parameter that is only used for an assertion. This made sense as a defensive measure when window creation was more dynamic -- it ensured that one did not make mistakes. However, there's no need for it any more, so this removes it. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window_base::reset): Remove win_type parameter. * tui/tui-layout.c (make_command_window, make_source_window) (make_disasm_window, make_data_window) (show_source_disasm_command, show_data, tui_gen_win_info::reset) (reset_locator, show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove win_type parameter. (struct tui_source_window_base) <reset>: Likewise.
2019-07-17Always create an execution info window for a source windowTom Tromey1-4/+8
A source or disassembly window will always have an "execution info" window (the window along the side that displays breakpoint info), but this isn't immediately clear from the source. As a result, some code has checks to see whether the execution_info is NULL. This changes the source window base class to always instantiate an execution_info window, then updates the rest of the code. It also simplifies window creation in tui-layout.c. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_set_exec_info_content): Remove condition. * tui/tui-wingeneral.c (tui_source_window_base::make_visible): Remove condition. * tui/tui-source.c (tui_source_window_base::reset): New method. * tui/tui-layout.c (make_command_window): Don't call init_and_make_win. (make_source_window, make_disasm_window): Don't call make_source_or_disasm_window. (make_data_window): Don't call init_and_make_win. Change calling convention. (show_source_disasm_command, show_data): Simplify. (make_source_or_disasm_window): Remove. (show_source_or_disasm_and_command): Simplify. * tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual. (struct tui_source_window_base) <reset>: Likewise. <execution_info>: Remove initializer. * tui/tui-data.c (tui_source_window_base): Initialize execution_info.
2019-07-17Merge refresh and refresh_window methodsTom Tromey1-4/+1
Earlier refactorings introduced the refresh and refresh_window methods, following the previous TUI code. However, these methods are essentially the same, so this patch merges them. It also removes some redundant refresh_window calls, because the execution window is updated automatically by the corresponding source (or disassembly) window. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_show_exec_info_content): Don't call refresh_window. * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Call touchwin. (tui_data_window::refresh_window): Call refresh_window on data items. Always call superclass refresh_window. (tui_win_info::refresh): Remove. (tui_source_window_base::refresh_window): Update. (tui_refresh_all): Update. * tui/tui-layout.c (show_source_disasm_command): Remove call to refresh_window. (show_source_or_disasm_and_command): Likewise. * tui/tui-data.h (struct tui_win_info) <refresh>: Remove. (struct tui_source_window_base) <refresh>: Likewise.
2019-07-17Remove tui_source_window::content_in_useTom Tromey1-2/+0
Now that source window clearing has been simplified, we don't need a special flag to say whether the source window is in use -- we can simply check whether the contents are set. This patch implements this idea, removing the content_in_use field. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_show_source_content): Update. * tui/tui-source.c (tui_source_window::showing_source_p): Check whether content is empty. * tui/tui-data.h (struct tui_source_window_base) <content_in_use>: Remove.
2019-07-17Remove UNDEFINED_ITEM define from TUITom Tromey1-2/+1
The TUI defined UNDEFINED_ITEM, but only used it in a single spot. I think this isn't very useful, so this removes the define. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-data.h (UNDEFINED_ITEM): Remove define. (struct tui_data_item_window): Update.
2019-07-17Remove unused TUI definesTom Tromey1-5/+0
This removes some #defines that were unused in the TUI. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-data.h (MAX_CONTENT_COUNT, TUI_NULL_STR) (DEFAULT_HISTORY_COUNT, WITH_LOCATOR, NO_LOCATOR): Remove defines.
2019-07-17Remove unused parameter from two TUI functionsTom Tromey1-2/+0
The "display_prompt" parameter of tui_erase_source_content and tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT value, so remove the parameter. Once this is done, the EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so remove those as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_source_content) (tui_clear_source_content): Remove "display_prompt" parameter. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr): Update. (tui_clear_source_content): Remove "display_prompt" parameter. (tui_erase_source_content): Likewise. Simplify. (tui_show_source_content): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT): Remove defines.
2019-07-17Move content_in_use to tui_source_window classTom Tromey1-3/+5
From scanning the source now, it's clear that the content_in_use field is only used for the source window. This patch moves the field there, and changes it to be a bool at the same time. (A future patch will clean this up further, removing the field entirely.) gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_show_source_content, tui_show_exec_info_content) (tui_clear_exec_info_content): Update. * tui/tui-stack.c (tui_show_locator_content): Update. (tui_show_frame_info): Update. * tui/tui-source.h (tui_source_window): Don't declare. * tui/tui-source.c (tui_source_window::showing_source_p): Rename from tui_source_is_displayed. * tui/tui-data.h (struct tui_gen_win_info) <content_in_use>: Remove field. (struct tui_source_window_base) <content_in_use>: New field. Now bool. (struct tui_source_window) <showing_source_p>: New method. (TUI_SRC_WIN): Change cast. * tui/tui-data.c (tui_initialize_static_data): Update.
2019-07-17Introduce tui_source_window_base::location_matches_p methodTom Tromey1-0/+8
This introduces the location_matches_p method, removing a spot that explicitly examines a window's type. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_breakpoint_info): Use location_matches_p. * tui/tui-source.c (tui_source_window::location_matches_p): New method. * tui/tui-disasm.c (tui_disasm_window::location_matches_p): New method. * tui/tui-data.h (struct tui_source_window_base) <location_matches_p>: New method. (struct tui_source_window, struct tui_disasm_window) <location_matches_p>: Likewise.
2019-07-17Make source windows be self-updatingTom Tromey1-4/+10
This changes the TUI source window to register itself on the source_styling_changed observable, and removes a bit of code from tui-hooks.c. This reduces the number of uses of the TUI_SRC_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window): New constructor. Add observer. (~tui_source_window): New destructor. (tui_source_window::style_changed): New method. * tui/tui-hooks.c (tui_redisplay_source): Remove. (tui_attach_detach_observers): Update. * tui/tui-data.h (struct tui_source_window): Make constructor not inline. Add destructor. (struct tui_source_window) <style_changed>: New method. <m_observable>: New member.
2019-07-17Introduce TUI window iteratorTom Tromey1-0/+69
This introduces an iterator class and a range adapter to make it simpler to iterate over TUI windows. One explicit iteration remains, in tui-win.c, because that spot is deleting windows as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_refresh_all): Update. * tui/tui-wingeneral.c (make_all_visible): Use foreach. (tui_refresh_all): Remove "list" parameter. Use foreach. * tui/tui-win.c (window_name_completer): Use foreach. (tui_refresh_all_win, tui_rehighlight_all, tui_all_windows_info) (update_tab_width): Likewise. * tui/tui-layout.c (show_layout): Update. * tui/tui-data.h (class tui_window_iterator): New. (struct all_tui_windows): New. * tui/tui-data.c (tui_partial_win_by_name): Use foreach.
2019-07-17Introduce tui_data_window::display_reg_element_at_line methodTom Tromey1-0/+6
This changes tui_display_reg_element_at_line to be a method on tui_data_window, allowing for the removal of some uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::display_reg_element_at_line): Rename from tui_display_reg_element_at_line. (tui_data_window::display_registers_from_line): Update. * tui/tui-data.h (struct tui_data_window) <display_reg_element_at_line>: New method.
2019-07-17Introduce two more tui_data_window methodsTom Tromey1-0/+11
This changes tui_display_registers_from and tui_display_registers_from_line to be methods on tui_data_window, allowing for the removal of more uses of the TUI_DATA_WIN global. gdb/ChangeLog 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-17Introduce tui_data_window::erase_data_content methodTom Tromey1-0/+2
This changes tui_erase_data_content to be a method on tui_data_window, allowing for the removal of some uses of the TUI_DATA_WIN global. gdb/ChangeLog 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. (tui_data_window::display_all_data) (tui_data_window::refresh_all) (tui_data_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-data.h (struct tui_data_window) <erase_data_content>: New method.
2019-07-17Introduce tui_data_window::delete_data_content_windows methodTom Tromey1-0/+4
This changes tui_delete_data_content_windows to be a method on tui_data_window, removing some uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.h (tui_delete_data_content_windows): Don't declare. * tui/tui-windata.c (tui_data_window::delete_data_content_windows): Rename from tui_delete_data_content_windows. (tui_data_window::display_all_data) (tui_data_window::do_scroll_vertical): Update. * tui/tui-data.h (struct tui_data_window) <delete_data_content_windows>: New method.
2019-07-17Introduce tui_data_window::display_all_data methodTom Tromey1-0/+4
This changes tui_display_all_data to be a method on tui_data_window. This helps cluster uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.h (tui_display_all_data): Don't declare. * tui/tui-windata.c (tui_data_window::display_all_data): Rename from tui_display_all_data. * tui/tui-win.c (tui_data_window::do_make_visible_with_new_height): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_data_window) <display_all_data>: New method.
2019-07-17Introduce tui_data_window::first_reg_element_no_inlineTom Tromey1-0/+4
This changes tui_first_reg_element_no_inline to be a method on tui_data_window. This again moves uses of the TUI_DATA_WIN global from this function into other functions that are already using the global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (tui_first_reg_element_no_inline): Don't declare. * tui/tui-regs.c (tui_data_window::first_reg_element_no_inline): Rename from tui_first_reg_element_no_inline. (tui_display_reg_element_at_line) (tui_display_registers_from_line): Update. * tui/tui-data.h (struct tui_data_window) <first_reg_element_no_inline>: New method.
2019-07-17Introduce tui_data_window::line_from_reg_element_no methodTom Tromey1-0/+5
This changes tui_line_from_reg_element_no to be a method on tui_data_window, allowing for the removal of some uses of the TUI_DATA_WIN global. (Actually, in this particular patch, the number of uses is not decreased, but rather the uses are moved to spots that are already using the global, i.e., increasing the clustering.) gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.c (tui_display_data_from) (tui_data_window::do_scroll_vertical): Update. * tui/tui-regs.h (tui_line_from_reg_element_no): Don't declare. * tui/tui-regs.c (tui_data_window::line_from_reg_element_no): Rename from tui_line_from_reg_element_no. (tui_display_registers_from_line): Update. * tui/tui-data.h (struct tui_data_window) <line_from_reg_element_no>: New method.
2019-07-17Introduce tui_data_window::last_regs_line_no methodTom Tromey1-0/+4
This changes tui_last_regs_line_no into a method on tui_data_window, allowing the removal of uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (tui_last_regs_line_no): Don't declare. * tui/tui-regs.c (tui_data_window::last_regs_line_no): Rename from tui_last_regs_line_no. (tui_display_reg_element_at_line) (tui_display_registers_from_line): Update. * tui/tui-data.h (struct tui_data_window) <last_regs_line_no>: New method.
2019-07-17Introduce can_scroll methodTom Tromey1-0/+11
This introduces a "can_scroll" method, removing a spot that explicitly checks a window's type. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_win_info) <can_scroll>: New method. (struct tui_cmd_window) <can_scroll>: New method. * tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll method.
2019-07-04Fix TUI use of "has_break" fieldTom Tromey1-8/+13
The TUI uses the "has_break" in two different ways: sometimes as a boolean, and sometimes as flags. This patch changes the TUI to be more type-safe here, and fixes the code. I could not find a bug that this caused, so apparently this is just cosmetic. This deletes some code from tui_set_disassem_content. Whenver this is called, I believe the TUI updates the breakpoint information afterward, so this assignment is redundant; which is good because it is also incorrect. gdb/ChangeLog 2019-07-04 Tom Tromey <tom@tromey.com> PR tui/24724: * tui/tui-winsource.c (tui_clear_source_content): Update. (tui_source_window_base::set_is_exec_point_at): Fix comment. (tui_update_breakpoint_info): Update. (tui_set_exec_info_content): Update. * tui/tui-source.c (tui_set_source_content_nil): Update. * tui/tui-disasm.c (tui_set_disassem_content): Don't set has_break. * tui/tui-data.h (enum tui_bp_flag): New. (tui_bp_flags): New enum flags type. (struct tui_source_element) <break_mode>: Change type. Rename from has_break. (TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT) (TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): Don't define. Now enum constants. * tui/tui-winsource.h: Fix comment.
2019-06-25Make tui_gen_win_info constructor protectedTom Tromey1-0/+4
Now that all the window types have their own concrete classes, the tui_gen_win_info constructor can be protected. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (init_and_make_win): Assert on unrecognized type. * tui/tui-data.h (struct tui_gen_win_info): Make constructor protected.