aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-regs.c
AgeCommit message (Collapse)AuthorFilesLines
2019-10-09Don't call erase_data_content from tui_data_window::show_registersTom Tromey1-2/+3
tui_data_window::show_registers currently calls erase_data_content. However, I think it's better to have fewer calls to this (ideally just one would suffice). This refactors that function to remove this call. gdb/ChangeLog 2019-10-09 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_registers): Don't call erase_data_content.
2019-10-09Make TUI window handle a unique_ptrTom Tromey1-16/+13
This changes tui_gen_win_info::handle to be a specialization of unique_ptr. This is perhaps mildly uglier in some spots, due to the proliferation of "get"; but on the other hand it cleans up some manual management and it allows for the removal of tui_delete_win. gdb/ChangeLog 2019-10-09 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_delete_win): Don't declare. * tui/tui-stack.c (tui_locator_window::rerender): Update. * tui/tui-command.c (tui_cmd_window::resize) (tui_refresh_cmd_win): Update. * tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update. * tui/tui.c (tui_rl_other_window, tui_enable): Update. * tui/tui-data.c (~tui_gen_win_info): Remove. * tui/tui-layout.c (tui_gen_win_info::resize): 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_getc): Update. * tui/tui-regs.c (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_item_window::rerender) (tui_data_item_window::refresh_window): Update. * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window) (box_win, tui_gen_win_info::make_window) (tui_gen_win_info::make_visible): Update. (tui_delete_win): Remove. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content): Update. (tui_show_source_line, tui_source_window_base::update_tab_width) (tui_source_window_base::update_exec_info): Update. * tui/tui-data.h (struct curses_deleter): New. (struct tui_gen_win_info) <handle>: Now a unique_ptr. (struct tui_gen_win_info) <~tui_gen_win_info>: Define.
2019-09-20Rename private data members of tui_data_windowTom Tromey1-32/+32
As Pedro suggested, this patch renames the private data members of tui_data_window to use the "m_" prefix. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <get_current_group>: Update. <m_regs_content, m_regs_column_count, m_current_group>: Add "m_" prefix. * tui/tui-regs.c (tui_data_window::last_regs_line_no) (tui_data_window::line_from_reg_element_no) (tui_data_window::first_reg_element_no_inline) (tui_data_window::show_registers) (tui_data_window::show_register_group) (tui_data_window::display_registers_from) (tui_data_window::display_registers_from_line) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_window::do_scroll_vertical) (tui_data_window::refresh_window) (tui_data_window::check_register_values): Update.
2019-09-20Use "bool" in tui_data_window::show_register_groupTom Tromey1-2/+2
This changes tui_data_window::show_register_group to use "bool" rather than "int". gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <show_register_group>: Change type of "refresh_values_only". * tui/tui-regs.c (tui_data_window::show_register_group): Change type of "refresh_values_only".
2019-08-30Remove tui_win_info::refresh_allTom Tromey1-23/+0
The TUI has two duplicate "re-render this window" methods, "rerender" and "refresh_all". They differ only slightly in semantics, so I wanted to see if they could be unified. After looking into this, I decided that refresh_all was not needed. There are 4 calls to tui_refresh_all_win (the only caller of this method): 1. tui_enable. This sets the layout, which renders the windows. 2. tui_cont_sig. Here, I think it's sufficient to simply redraw the current window contents from the curses backing store, because gdb state didn't change while it was suspended 3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's explicitly enough to just refresh the screen (as above). 4. tui_refresh_all_command. This is the command equivalent of C-l. So, this patch removes this method entirely and simplifies tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <refresh_all>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Remove. * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or tui_show_locator_content. * tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't declare. * tui/tui-regs.c (tui_data_window::refresh_all): Remove. * tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't declare.
2019-08-30Simplify register displayTom Tromey1-58/+42
This patch starts with the observation that the code in tui_data_window::display_registers_from can all be replaced with a call to resize. To make this work propertly, it also changes tui_display_register to be the "rerender" method on tui_data_item_window. The refresh_window method is needed due to the use of nested windows here. The ncurses man page makes it sound like this is not very well supported; and experience bears this out: negelecting the touchwin call in this path will cause the register window to blank when switching focus. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <rerender, refresh_window>: Declare. * tui/tui-regs.c (tui_data_window::display_registers_from): Call resize. (tui_data_item_window::rerender): Rename from tui_display_register. (tui_data_item_window::refresh_window): New method. * tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on no-op.
2019-08-30Private data members in tui_data_windowTom Tromey1-1/+1
This changes tui_data_window so that the data members are private. This required the addition of a simple accessor method in one case. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <regs_content, regs_column_count, current_group>: Move later. Now private. <get_current_group>: New method. * tui/tui-regs.c (tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.
2019-08-30Remove some calls in tui_data_windowTom Tromey1-7/+1
This patch removes a call to erase_data_content in refresh_all and then removes some other calls that are more clearly unnecessary once one follows calls from that point. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::display_registers_from_line) (tui_data_window::rerender): Don't call check_and_display_highlight_if_needed. (tui_data_window::refresh_all): Remove call to erase_data_content.
2019-08-30Remove some checks of .empty()Tom Tromey1-111/+96
A few methods in tui_data_window check whether the contents are empty; but all the callers already check this, so these calls can be removed. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::last_regs_line_no) (tui_data_window::display_registers_from) (tui_data_window::display_reg_element_at_line) (tui_data_window::display_registers_from_line): Remove checks of "empty".
2019-08-30Remove tui_data_window::display_all_dataTom Tromey1-16/+2
tui_data_window::rerender clears the data item windows, and then calls display_all_data. However, that method only does anything if the contents are not empty. So, display_all_data can be renamed and the wrapper removed. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <display_all_data>: Don't declare. * tui/tui-regs.c (tui_data_window::show_registers): Call rerender. (tui_data_window::rerender): Rename from display_all_data. (tui_data_window::rerender): Remove old implementation.
2019-08-30Remove NO_DATA_STRINGTom Tromey1-1/+1
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-20Change tui_make_window to be a methodTom Tromey1-3/+2
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-20Remove tui_data_window::display_regsTom Tromey1-5/+1
There's no need for tui_data_window::display_regs any more (if there ever was). All the paths through data window construction will end up setting this to true. This patch removes the member. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <display_regs>: Remove. * tui/tui-regs.c (tui_data_window::show_registers): Update. (tui_data_window::check_register_values): Update.
2019-08-20Remove indirection from tui_data_window::regs_contentTom Tromey1-33/+18
tui_data_window::regs_content is currently a vector of unique_ptr. However, due to the way this is managed now, there is no need to keep the pointers -- it can simply be a vector of the objects themselves. This patch removes this extra layer of indirection. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window): Use DISABLE_COPY_AND_ASSIGN. <regs_content>: Change type, removing unique_ptr. <tui_data_window>: Add move constructor. * tui/tui-regs.c (tui_data_window::show_registers) (tui_data_window::show_register_group) (tui_data_window::display_registers_from) (tui_data_window::display_registers_from) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_data_window::rerender, tui_data_window::refresh_window) (tui_data_window::check_register_values): Update.
2019-08-20Add two methods to tui_data_windowTom Tromey1-32/+23
This changes tui_show_registers and tui_show_register_group to be methods on tui_data_window. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <show_registers, show_register_group>: Declare. (tui_show_register_group): Don't declare. * tui/tui-regs.c (tui_data_window::show_registers): Rename from tui_show_registers. (tui_data_window::show_register_group): Rename from tui_show_register_group. (tui_data_window::check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.
2019-08-20Change tui_check_register_values to be a methodTom Tromey1-17/+12
This changes tui_check_register_values to be a method on tui_data_window. An additional check in tui_register_changed is needed, because TUI_DATA_WIN could be NULL at this point. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <check_register_values>: Declare. (tui_check_register_values): Don't declare. * tui/tui-regs.c (tui_data_window::check_register_values): Rename from tui_check_register_values. * tui/tui-hooks.c (tui_register_changed): Update.
2019-08-20Rearrange tui-regs.c some moreTom Tromey1-23/+15
This moves tui_reg_layout later in tui-regs.c, closer to where it is used. It also changes tui_show_registers not to enable the TUI or change the layout -- this is already done by this point by all the callers. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_layout): Move later. (tui_show_registers): Don't enable TUI mode or change layout.
2019-08-20Change tui_data_item_window::content to be a unique_xmalloc_ptrTom Tromey1-24/+10
This changes tui_data_item_window::content to be a unique_xmalloc_ptr and fixes up the fallout. It also removes a parameter from tui_expand_tabs, as it was only ever given one value. This also removes some tab-handling code from tui_data_window::display_registers_from. Because the content can only be set by tui_register_format, and because that calls tui_expand_tabs, it's not possible to see a tab here. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <~tui_data_item_window>: Remove. <content>: Now a unique_xmalloc_ptr. * tui/tui-regs.c (tui_register_format): Return a unique_xmalloc_ptr. (tui_get_register): Update. (~tui_data_item_window): Remove. (tui_data_window::display_registers_from, tui_display_register): Update. * tui/tui-io.h (tui_expand_tabs): Update. * tui/tui-io.c (tui_expand_tabs): Return a unique_xmalloc_ptr. Remove "col" parameter.
2019-08-20Remove tui_data_item_window::valueTom Tromey1-1/+0
The field tui_data_item_window::value is not used, so remove it. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <value>: Remove field. * tui/tui-regs.c (~tui_data_item_window): Update.
2019-08-20Minor rearrangement in tui-regs.cTom Tromey1-53/+48
This moves a couple of functions earlier in tui-regs.c. Previously they were in the "command" section of the file, but really they belong in the "window implementation" section. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_register_format, tui_get_register): Move earlier.
2019-08-20Remove NULL check from tui_reg_commandTom Tromey1-3/+1
tui_reg_command has an unnecessary NULL check. The preceding call to tui_reg_layout will ensure the window exists. This patch removes the check. gdb/ChangeLog 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_command): Remove NULL check.
2019-08-20Some i18n fixes for the TUITom Tromey1-1/+1
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-5/+4
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-8/+1
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-15Simplify TUI boxingTom Tromey1-1/+1
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-13Change tui_check_and_display_highlight_if_needed to be a methodTom Tromey1-3/+3
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-13clear_detail can only be called on TUI source windowsTom Tromey1-10/+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 TUI data item window to tui-regs.hTom Tromey1-0/+9
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-17Rearrange TUI data window codeTom Tromey1-34/+179
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-17Change tui_get_register to return voidTom Tromey1-9/+4
tui_get_register returns a tui_status, but nothing checks this, so it can return void instead. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_get_register): Return void.
2019-07-17Clean up tui_layout_commandTom Tromey1-2/+16
tui_layout_command is a simple wrapper for tui_set_layout_by_name. This removes the extra layer and cleans up the resulting function a bit -- changing it to call error rather than return a result. This necessitated a small change to tui-regs.c, to avoid calling the function that is being removed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.h (tui_set_layout_by_name): Don't declare. * tui/tui-regs.c (tui_reg_layout): New function. (tui_show_registers, tui_reg_command): Use it. * tui/tui-layout.c (LAYOUT_USAGE): Remove. (tui_layout_command): Rename from tui_set_layout_by_name. Change parameters. (tui_layout_command): Remove.
2019-07-17Minor tui_reg_next / tui_reg_prev cleanupTom Tromey1-10/+11
This changes tui_reg_next and tui_reg_prev so that they don't need to reference the TUI_DATA_WIN globals. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_next, tui_reg_prev): Add "current_group" parameter. Don't reference globals. (tui_reg_command): Update.
2019-07-17Simplify tui_show_registersTom Tromey1-11/+6
tui_show_registers keeps a local status variable, but it is not actually needed. This rearranges the function to remove the variable. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_show_registers): Simplify.
2019-07-17Parameterize tui_show_register_group with windowTom Tromey1-11/+13
This changes tui_show_register_group not to reference the TUI_DATA_WIN global, instead leaving that to its caller. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_show_registers): Update. (tui_show_register_group): Add win_info parameter.
2019-07-17Introduce tui_data_window::display_reg_element_at_line methodTom Tromey1-16/+10
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-31/+23
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-1/+1
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::display_all_data methodTom Tromey1-1/+1
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-17Remove tui_display_data_from_lineTom Tromey1-17/+13
tui_display_data_from_line is just a wrapper for tui_display_registers_from_line, so remove it. Also, nothing passed 0 as the "force_display" parameter to tui_display_registers_from_line, so remove that parameter as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.h (tui_display_data_from_line): Don't declare. * tui/tui-windata.c (tui_display_data_from_line): Remove. (tui_display_data_from, tui_data_window::do_scroll_vertical): Call tui_display_registers_from_line. * tui/tui-regs.h (tui_display_registers_from_line): Update. * tui/tui-regs.c (tui_display_registers_from_line): Remove "force_display" parameter.
2019-07-17Introduce tui_data_window::first_reg_element_no_inlineTom Tromey1-9/+7
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-7/+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-9/+8
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-06-25Separate out data windowTom Tromey1-104/+62
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-6/+3
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-25Separate out data item windowTom Tromey1-48/+36
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-25Introduce refresh_window methodTom Tromey1-1/+1
This replaces tui_refresh_win with a new refresh_window method. This removes another spot that was checking the window's type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_erase_source_content) (tui_show_source_content, tui_show_exec_info_content) (tui_erase_exec_info_content): Use refresh_window method. * tui/tui-wingeneral.h (tui_refresh_win): Don't declare. * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window): Rename from tui_refresh_win. (tui_data_window::refresh_window): New method. (tui_win_info::refresh, tui_source_window_base::refresh) (tui_refresh_all): Use refresh_window method. * tui/tui-stack.c (tui_show_locator_content): Call refresh_window method. * tui/tui-regs.c (tui_display_register): Call refresh_window method. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Call refresh_window method. * tui/tui-data.h (struct tui_gen_win_info) (struct tui_data_window, struct tui_cmd_window) <refresh_window>: New method.
2019-06-25Derive tui_win_info from tui_gen_win_infoTom Tromey1-14/+14
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-25Change tui_which_element::data_window to be a pointerTom Tromey1-5/+5
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-25Change tui_data_window::display_regs to boolTom Tromey1-1/+1
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-63/+52
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.