aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-data.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-20Remove separator comments from TUITom Tromey1-20/+0
This removes various separator comments from the TUI. These aren't used elsewhere in gdb, and they were incorrect in some cases as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-data.c: Remove separator comments. * tui/tui-layout.c: Remove separator comments. * tui/tui-win.c: Remove separator comments. * tui/tui-wingeneral.c: Remove separator comments.
2019-09-20Change "win_resized" to boolTom Tromey1-4/+4
This changes the "win_resized" global to be a bool and then updates the uses. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_enable): Update. * tui/tui-win.c (tui_sigwinch_handler, tui_async_resize_screen): Update. * tui/tui-data.h (tui_win_resized, tui_set_win_resized_to): Update. * tui/tui-data.c (win_resized): Now bool. (tui_win_resized): Return bool. (tui_set_win_resized_to): Accept a bool.
2019-09-20Remove tui_clear_source_windows_detailTom Tromey1-9/+0
The calls to tui_clear_source_windows_detail in tui_add_win_to_layout aren't needed, because (after the resize unification) resizing will update the window contents. Removing these calls lets us remove several other things as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_clear_source_windows_detail): Don't declare. * tui/tui-layout.c (tui_add_win_to_layout): Don't call tui_clear_source_windows_detail. * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::clear_detail): Remove. * tui/tui-data.c (tui_clear_source_windows_detail): Remove.
2019-08-20Change tui_make_window to be a methodTom Tromey1-1/+0
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-16Remove separate visibility flagTom Tromey1-3/+3
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-0/+6
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-31/+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-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-13Remove tui_gen_win_info::last_visible_lineTom Tromey1-2/+1
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-13Delete invisible TUI windowsTom Tromey1-0/+22
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-17/+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-11/+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-07-17Move source window common to code to tui-winsource.[ch]Tom Tromey1-26/+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-17Move TUI data item window to tui-regs.hTom Tromey1-11/+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-8/+0
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-10/+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-17Always create an execution info window for a source windowTom Tromey1-1/+2
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-17Move content_in_use to tui_source_window classTom Tromey1-1/+0
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-17Fix comment typosTom Tromey1-1/+1
This fixes a couple of comment typos that I noticed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-data.c (tui_clear_source_windows_detail): Fix typo. * tui/tui-win.c (tui_resize_all): Fix typo.
2019-07-17Introduce TUI window iteratorTom Tromey1-15/+7
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-06-25Tidy tui_delete_winTom Tromey1-5/+1
tui_delete_win does its own NULL check, so ~tui_gen_win_info does not need to do it. Also, tui_delete_win has an extraneous "return". gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_delete_win): Remove "return". * tui/tui-data.c (~tui_gen_win_info): Remove "if".
2019-06-25Remove union tui_which_elementTom Tromey1-166/+0
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.
2019-06-25Use bool for is_exec_pointTom Tromey1-1/+1
This changes tui_source_element::is_exec_point to be a bool. I looked at also changing "has_break", but it turns out that this field is used inconsistently (sometimes as flags and sometimes as a bool), and so needs more invesstigation before it can be changed. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_clear_source_content) (tui_source_window_base::set_is_exec_point_at): Update. * tui/tui-source.c (tui_set_source_content_nil): Update. * tui/tui-data.h (struct tui_source_element) <is_exec_point>: Now a bool. * tui/tui-data.c (init_content_element): Update.
2019-06-25Fix "auxiliary" typoTom Tromey1-1/+1
The TUI has a function called tui_win_is_auxillary, but the word should actually be spelled "auxiliary". This fixes the typo. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Update. * tui/tui-win.c (make_invisible_and_set_new_height): Update. * tui/tui-layout.c (init_and_make_win): Update. * tui/tui.h (enum tui_win_type): Update. * tui/tui-data.h (tui_win_is_auxiliary): Rename from tui_win_is_auxillary. * tui/tui-data.c (tui_win_is_auxiliary): Rename from tui_win_is_auxillary.
2019-06-25Separate out data windowTom Tromey1-72/+2
This removes "data_window" from union tui_which_element and updates the uses. It also changes how tui_data_window refers to the register data, and changes it not to need the "content" field at all (though as this is in a base class, it can't yet be removed). gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_data_window::refresh_window): Update. * tui/tui-windata.c (tui_data_window::first_data_item_displayed) (tui_delete_data_content_windows, tui_display_all_data) (tui_data_window::do_scroll_vertical, tui_display_data_from): Update. * tui/tui-win.c (tui_data_window::set_new_height): Simplify. * tui/tui-regs.c (tui_last_regs_line_no) (tui_line_from_reg_element_no, tui_first_reg_element_no_inline) (tui_show_registers): Update. (tui_show_register_group): Return void. Update. (tui_display_registers_from, tui_display_reg_element_at_line) (tui_display_registers_from_line, tui_check_register_values): Update. * tui/tui-data.h (union tui_which_element) <data_window>: Remove member. (struct tui_data_window) <regs_content>: Now a std::vector. <regs_content_count>: Remove. (tui_add_content_elements, tui_free_data_content): Don't declare. * tui/tui-data.c (tui_data_window::clear_detail): Update. (init_content_element): Remove DATA_WIN case. Add assert. (tui_add_content_elements): Remove. (tui_data_window): Update. (tui_free_data_content): Remove. (free_content_elements): Remove DATA_WIN case.
2019-06-25Remove "data_content" and "data_content_count" from TUI data windowTom Tromey1-7/+0
The TUI has some stub code for adding data other than registers to the data window. However, it doesn't do anything, and apparently never has. This removes the dead code. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.c (tui_data_item_window): Update. * tui/tui-windata.h (tui_check_data_values): Don't declare. * tui/tui-windata.c (tui_display_all_data) (tui_display_data_from_line): Update. (tui_check_data_values): Remove. * tui/tui-regs.c (tui_show_register_group) (tui_display_reg_element_at_line): Update. * tui/tui-hooks.c (tui_register_changed) (tui_refresh_frame_and_register_information): Call tui_check_register_values. * tui/tui-data.h (struct tui_data_window) <data_content, data_content_count, data_type>: Remove. (enum tui_data_type): Remove.
2019-06-25Remove tui_init_generic_partTom Tromey1-8/+2
tui_init_generic_part has a single caller, so simply inline it there. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_init_generic_part): Don't declare. * tui/tui-data.c (tui_init_generic_part): Remove, moving contents... (tui_initialize_static_data): ...here.
2019-06-25Separate out data item windowTom Tromey1-22/+10
This introduces a new subclass of tui_gen_win_info for the data item windows, letting us remove another element from tui_which_element. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_check_register_values): Update. (tui_display_register): Remove win_info parameter; update. (tui_get_register): Change type of parameters. * tui/tui-data.h (struct tui_data_element): Remove. (union tui_which_element) <data>: Remove. <data_window>: Change type. (struct tui_data_item_window): New. * tui/tui-data.c (init_content_element): Remove DATA_ITEM_WIN case. Add assert. (~tui_data_item_window): New destructor. (free_content_elements): Remove DATA_ITEM_WIN case.
2019-06-25Remove command from tui_which_elementTom Tromey1-6/+1
union tui_which_element has a "command" member, but it is never used. This removes it. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_command_element): Remove. (union tui_which_element) <command>: Remove. * tui/tui-data.c (init_content_element): Remove CMD_WIN case. Add assert. (free_content_elements): Remove CMD_WIN case.
2019-06-25Remove layout_def::splitTom Tromey1-1/+1
The "split" field in struct layout_def is never used, so this patch removes it. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_layout_def) <split>: Remove. * tui/tui-data.c (layout_def): Update.
2019-06-25Separate out locator windowTom Tromey1-8/+4
This introduces a new subclass of tui_gen_win_info for the locator, letting us remove another element from union tui_which_element. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_all): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::set_new_height): Update. * tui/tui-stack.c (tui_make_status_line): Change parameter type. Update. (tui_set_locator_fullname, tui_set_locator_info) (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_source_is_displayed): Update. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_get_begin_asm_address): Update. * tui/tui-data.h (struct tui_locator_element): Remove. (union tui_which_element) <locator>: Remove. (struct tui_locator_window): New. (tui_locator_win_info_ptr): Change return type. * tui/tui-data.c (_locator): Change type. (tui_locator_win_info_ptr): Change return type. (init_content_element): Remove LOCATOR_WIN case. Add assert. (tui_alloc_content): Add assert.
2019-06-25Separate out execution-info windowTom Tromey1-4/+4
This pulls the EXEC_INFO_WIN case out into its own subclass of tui_gen_win_info. This lets us remove an element from union tui_which_element. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_exec_info_window::maybe_allocate_content): New method. (tui_set_exec_info_content, tui_show_exec_info_content): Update. * tui/tui-layout.c (init_and_make_win): Add EXEC_INFO_WIN case. (make_source_or_disasm_window): Add cast. * tui/tui-data.h (union tui_which_element) <simple_string>: Remove. (struct tui_source_info): New. (struct tui_source_window_base) <execution_info>: Change type. * tui/tui-data.c (init_content_element): Remove EXEC_INFO_WIN case, and add assert. (tui_alloc_content): Add assert.
2019-06-25Remove tui_alloc_win_infoTom Tromey1-22/+0
There is only a single caller of tui_alloc_win_info, and we're going to add more "new" cases to that caller, so remove tui_alloc_win_info and inline it into init_and_make_win. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_alloc_win_info): Don't declare. * tui/tui-layout.c (init_and_make_win): Use "new" directly. * tui/tui-data.c (tui_alloc_win_info): Remove.
2019-06-25Remove some TUI static allocationsTom Tromey1-40/+12
The TUI statically allocates the "execution_info" for the source and disassembly windows. However, there's no deep reason to do this, and this approach makes it harder to allow multiple such windows. This patch removes the static data and changes the code to simply allocate these windows as needed. This required pushing some code into the tui_gen_win_info destructor, but that seems like a good idea anyhow. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_source_or_disasm_window): Always use init_and_make_win for EXEC_INFO_WIN. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: No longer inline. (struct tui_win_info) <~tui_win_info>: Inline. (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr): Don't declare. * tui/tui-data.c (source_win, disasm_win): Remove globals. (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr): Remove. (tui_initialize_static_data): Update. (~tui_gen_win_info): Handle more cleanup here. (~tui_source_window_base): Delete "execution_info". (~tui_win_info): Move code to ~tui_gen_win_info; remove.
2019-06-25Introduce tui_gen_win_info::name methodTom Tromey1-30/+1
This removes tui_win_name and replaces it with a method on tui_gen_win_info, removing another spot that switched on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (window_name_completer, tui_set_focus) (tui_all_windows_info): Use name method. * tui/tui-data.h (struct tui_gen_win_info) (struct tui_source_window, struct tui_disasm_window) (struct tui_data_window, struct tui_cmd_window) <name>: New method. (tui_win_name): Don't declare. * tui/tui-data.c (tui_partial_win_by_name): Use name method. (tui_win_name): Remove.
2019-06-25Derive tui_win_info from tui_gen_win_infoTom Tromey1-24/+23
This changes tui_win_info to derive from tui_gen_win_info, rather than having a tui_gen_win_info as a member. This removes a layer of member access from the entire TUI, which is why this patch is so large. This change will enable further removal of switches based on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window, tui_enable) (tui_is_window_visible, tui_get_command_dimension): Update. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_erase_source_content) (tui_show_source_line, tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Update. * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win) (tui_check_and_display_highlight_if_needed) (tui_win_info::make_visible, tui_win_info::refresh) (tui_refresh_all): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_data_window::refresh_all) (tui_check_data_values): Update. * tui/tui-win.c (window_name_completer, tui_update_gdb_sizes) (tui_set_win_focus_to, tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_refresh_all_win) (tui_resize_all, tui_set_focus, tui_all_windows_info) (update_tab_width, tui_set_win_height, tui_adjust_win_heights) (tui_source_window_base::set_new_height) (tui_data_window::set_new_height) (make_invisible_and_set_new_height) (make_visible_with_new_height, new_height_ok) (parse_scrolling_args): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil, tui_source_is_displayed) (tui_source_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line) (tui_check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_default_win_height) (show_source_disasm_command, show_data, init_and_make_win) (show_source_or_disasm_and_command): Update. * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts) (tui_redisplay_readline, tui_mld_flush) (tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig) (tui_getc): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: Now virtual. (struct tui_win_info): Derive from tui_gen_win_info. <~tui_win_info>: Mark as override. <generic>: Remove member. * tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win) (tui_prev_win, tui_partial_win_by_name, tui_win_info) (~tui_data_window, ~tui_win_info) (tui_free_all_source_wins_content): Update. * tui/tui-command.c (tui_refresh_cmd_win): Update.
2019-06-25Use new and delete for tui_gen_win_infoTom Tromey1-21/+8
This changes tui_gen_win_info to be allocated with new and destroyed with delete. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (init_and_make_win): Use new. * tui/tui-data.h (struct tui_gen_win_info): Add constructor, destructor, initializers. (tui_alloc_generic_win_info): Don't declare. * tui/tui-data.c (_locator): Add argument to constructor. (source_win, disasm_win): New globals. (exec_info): Remove. (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr): Update. (tui_alloc_generic_win_info): Remove. (init_content_element): Use new. (tui_win_info::tui_win_info): Update. (free_content_elements) <case DATA_WIN>: Use delete.
2019-06-25Change tui_which_element::data_window to be a pointerTom Tromey1-5/+7
A coming patch will add a constructor to tui_gen_win_info. However, because the tui_which_element union contains an object of this type, first something must be done here in order to avoid having a union with a member that has a constructor. This patch changes this element to be a pointer instead. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_win): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows): Update. * tui/tui-win.c (tui_data_window::set_new_height): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_check_register_values): Update. * tui/tui-data.h (union tui_which_element) <data_window>: Now a pointer. * tui/tui-data.c (init_content_element): Update. Allocate the new window. (tui_free_data_content): Update. (free_content_elements) <case DATA_WIN>: Free the window.
2019-06-25Introduce set_highlight methodTom Tromey1-8/+0
This introduces the tui_win_info::set_highlight method, and changes the highlighting-related code to use bool rather than int. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win): Update. * tui/tui-layout.c (make_command_window) (show_source_disasm_command, show_data, init_and_make_win) (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_win_info) <set_highlight>: New method. <can_highight, is_highlighted>: Now bool. (tui_set_win_highlight): Don't declare. * tui/tui-data.c (tui_set_win_highlight): Remove.
2019-06-25Introduce two TUI source window methodsTom Tromey1-7/+6
This adds two methods to the TUI source window. These are just renamings of existing functions. It also changes the source window list to have a more precise type, letting the code be more type-safe. This will be useful again later. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_refill_source_window) (tui_set_is_exec_point_at): Don't declare. * tui/tui-winsource.c (tui_update_source_windows_with_addr) (tui_source_window_base::refill): Rename from tui_refill_source_window. (tui_source_window_base::do_scroll_horizontal): Update. (tui_source_window_base::set_is_exec_point_at): Rename from tui_set_is_exec_point_at. (tui_update_all_breakpoint_info): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-layout.c (show_data): Add cast. * tui/tui-hooks.c (tui_redisplay_source): Call refill method. * tui/tui-data.h (struct tui_source_window_base) <refill, set_is_exec_point_at>: New methods. (tui_source_windows, tui_add_to_source_windows): Update types. (tui_add_to_source_windows): Remove redundant declaration. * tui/tui-data.c (source_windows): Store tui_source_window_base. (tui_source_windows): Change return type. (tui_clear_source_windows_detail): Update. (tui_add_to_source_windows): Change type of parameter. (tui_free_all_source_wins_content): Update.
2019-06-25Use bool for visibilityTom Tromey1-2/+2
This changes the visibility-related functions and data members in the TUI to use bool rather than int. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.h (tui_is_window_visible): Return bool. * tui/tui.c (tui_is_window_visible): Return bool. * tui/tui-wingeneral.c (tui_make_window, make_visible) (tui_make_visible, tui_make_invisible) (tui_win_info::make_visible) (tui_source_window_base::make_visible, make_all_visible) (tui_make_all_visible, tui_make_all_invisible): Update. * tui/tui-windata.c (tui_delete_data_content_windows): Update. * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: Now bool. (struct tui_win_info, struct tui_source_window_base) (struct tui_cmd_window) <make_visible>: Change parameter to bool. * tui/tui-data.c (tui_init_generic_part): Update.
2019-06-25Introduce make_visible methodTom Tromey1-6/+0
This introduceds the make_visible to tui_win_info and overrides it in subclasses as appropriate. This allows the removal of the tui_win_is_source_type, as it is no longer used. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_win_info::make_visible) (tui_source_window_base::make_visible): New methods. (make_all_visible): Make method call. * tui/tui-data.h (struct tui_win_info) <make_visible>: New method. (struct tui_source_window_base, struct tui_cmd_window): Override make_visible. (tui_win_is_source_type): Don't declare. * tui/tui-data.c (tui_win_is_source_type): Remove.
2019-06-25Inline constructors and initializersTom Tromey1-17/+0
This inlines the constructors and initializers for tui_cmd_window and tui_data_window. This makes the code a bit simpler. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_data_window, struct tui_cmd_window): Inline constructor. Add initializers for members. * tui/tui-data.c (tui_data_window, tui_cmd_window): Remove constructors; now inline in class.
2019-06-25Change tui_data_window::display_regs to boolTom Tromey1-3/+3
This changes tui_data_window::display_regs to bool and updates the uses. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-data.h (struct tui_data_window) <display_regs>: Now bool. * tui/tui-data.c (tui_data_window::clear_detail) (tui_data_window): Update.
2019-06-25Remove struct tui_data_infoTom Tromey1-23/+21
Like the previous two patches, this removes struct tui_data_info in favor of inlining its contents into tui_data_window. This was the last member of the tui_win_info detail union, so that is removed. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-windata.c (tui_display_all_data) (tui_display_data_from_line, tui_display_data_from) (tui_check_data_values, tui_data_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_last_regs_line_no) (tui_line_from_reg_element_no, tui_first_reg_element_no_inline) (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line) (tui_display_registers_from_line, tui_check_register_values) (tui_reg_next, tui_reg_prev): Update. * tui/tui-layout.c (tui_set_layout, show_data): Update. * tui/tui-data.h (struct tui_data_info): Remove. Move contents to tui_data_window. (struct tui_win_info) <detail>: Remove. Add new fields from tui_data_info. (TUI_DATA_WIN): Add cast. * tui/tui-data.c (tui_data_window::clear_detail, tui_data_window) (~tui_data_window): Simplify.
2019-06-25Remove struct tui_source_infoTom Tromey1-26/+10
The tui_source_info struct is used as a member of the "detail" union in tui_win_info, and this member of the union is only used by source and disassembly windows. This patch removes tui_source_info and moves its members directly to tui_source_window_base. This simplifies the code by removing a layer of references from many places. In a few spots, a new cast was needed, but most of these will be removed by the end of the series. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_window) (tui_refill_source_window) (tui_source_window_base::do_scroll_horizontal) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_show_exec_info_content, tui_erase_exec_info_content) (tui_clear_exec_info_content): Update. * tui/tui-wingeneral.c (make_all_visible, tui_refresh_all): Update. * tui/tui-win.c (make_invisible_and_set_new_height) (make_visible_with_new_height): Update. * tui/tui-source.c (tui_set_source_content) (tui_show_symtab_source): Update. * tui/tui-layout.c (extract_display_start_addr) (show_source_disasm_command, show_data) (make_source_or_disasm_window) (show_source_or_disasm_and_command): Update. * tui/tui-disasm.c (tui_set_disassem_content): Simplify. (tui_disasm_window::do_scroll_vertical): Remove shadowing "gdbarch". * tui/tui-data.h (struct tui_source_info): Remove. Move contents to tui_source_window_base. (struct tui_win_info) <detail>: Remove source_info member. (struct tui_source_window_base) <has_locator>: Inline. Move contents from tui_source_info; rename has_locator member to m_has_locator. (TUI_SRC_WIN, TUI_DISASM_WIN): Add casts. * tui/tui-data.c (tui_source_window_base::has_locator): Move to header file. (tui_source_window_base::clear_detail, ~tui_source_window_base): Simplify. (tui_free_all_source_wins_content): Cast to tui_source_window_base.
2019-06-25Introduce has_locator methodTom Tromey1-5/+6
This changes tui_win_has_locator to be a method on tui_win_info, and changes the locator code to use bool rather than int. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (make_invisible_and_set_new_height) (make_visible_with_new_height): Call has_locator method. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update for bool change. * tui/tui-data.h (struct tui_source_info) <has_locator>: Now bool. (tui_win_info) <has_locator>: New method. (struct tui_source_window_base) <has_locator>: New method. (tui_win_has_locator): Don't declare. * tui/tui-data.c (tui_source_window_base::has_locator): Rename from tui_win_has_locator. (tui_source_window_base): Use false, not FALSE.
2019-06-25Remove tui_clear_win_detailTom Tromey1-10/+1
An earlier patch changed the context of the sole call to tui_clear_win_detail to make it clear that this can never be called with a NULL window pointer. So, remove tui_clear_win_detail in favor of calling the method directly. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_clear_win_detail): Don't declare. * tui/tui-data.c (tui_clear_source_windows_detail): Call the clear_detail method directly. (tui_clear_win_detail): Remove.
2019-06-25Create tui_disasm_windowTom Tromey1-4/+6
This introduces the new tui_disasm_window class, which represents a disassembly window. It shares a lot of behavior with the source window, so a new tui_source_window_base class is also created. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_source_window_base): New struct. (struct tui_source_window): Derive from tui_source_window_base. (struct tui_disasm_window): New struct. * tui/tui-data.c (tui_source_window_base::clear_detail): Rename from tui_source_window::clear_detail. (tui_source_window_base): Rename from tui_source_window. (~tui_source_window_base): Rename from ~tui_source_window. (tui_alloc_win_info): Create a tui_disasm_window.
2019-06-25Split the tui_win_info destructorTom Tromey1-37/+33
This patch adds destructors to tui_source_window and tui_data_window, and splits ~tui_win_info as appropriate. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_source_window) (struct tui_data_window): Declare destructors. * tui/tui-data.c (~tui_source_window, ~tui_data_window): New destructors. (tui_win_info): Simplify.