aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-regs.h
AgeCommit message (Collapse)AuthorFilesLines
2024-09-07Clean up refreshing in TUI register windowTom Tromey1-0/+2
This patch rearranges the TUI register window code a bit, removing a call to tui_wrefresh and hoisting the calls to refresh_window to "more outer" spots. Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
2024-06-15Make tui_register_info::highlight privateTom Tromey1-2/+6
This changes tui_register_info::highlight to be private, renaming it to m_highlight.
2024-06-07gdb/tui: cleanup includesSimon Marchi1-0/+1
Remove includes reported as unused by clangd. Then, add any includes necessary to get rid of errors (includes possibly relying on previous includes).. I didn't remove the includes of gdb-safe-ctypes.h, because it appears to do some some preprocessor magic, redefining standard macros. I'm afraid that removing these includes could change the behavior unintentionally. Change-Id: I4c5b652355c3bbce022fe0d447a72dc4e1d17d34 Approved-By: Tom Tromey <tom@tromey.com>
2024-06-07gdb/tui: change some macros to functionsSimon Marchi1-0/+8
Change the `TUI_*` macros to access known windows to functions. Define them in their respective files, because trying to define them in tui-data.h would end up causing include cycles. This makes static analysis (detection of unused include files in this case) more accurate, and I think in general we should avoid hiding code behind macros if not necessary. Change-Id: I1e38cee843984c48ab34030b19dac0d726f851af Approved-By: Tom Tromey <tom@tromey.com>
2024-02-20gdb: pass frames as `const frame_info_ptr &`Simon Marchi1-1/+1
We currently pass frames to function by value, as `frame_info_ptr`. This is somewhat expensive: - the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass by value - the constructors and destructor link/unlink the object in the global `frame_info_ptr::frame_list` list. This is an `intrusive_list`, so it's not so bad: it's just assigning a few points, there's no memory allocation as if it was `std::list`, but still it's useless to do that over and over. As suggested by Tom Tromey, change many function signatures to accept `const frame_info_ptr &` instead of `frame_info_ptr`. Some functions reassign their `frame_info_ptr` parameter, like: void the_func (frame_info_ptr frame) { for (; frame != nullptr; frame = get_prev_frame (frame)) { ... } } I wondered what to do about them, do I leave them as-is or change them (and need to introduce a separate local variable that can be re-assigned). I opted for the later for consistency. It might not be clear why some functions take `const frame_info_ptr &` while others take `frame_info_ptr`. Also, if a function took a `frame_info_ptr` because it did re-assign its parameter, I doubt that we would think to change it to `const frame_info_ptr &` should the implementation change such that it doesn't need to take `frame_info_ptr` anymore. It seems better to have a simple rule and apply it everywhere. Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Update TUI register window when the inferior exitsTom Tromey1-0/+4
When the inferior exits, the TUI register window should clear. Fixing this was mostly a matter of sticking an assignment into tui_inferior_exit. However, some changes to the register window itself were also needed. While working on this, I realized that the TUI register window would not work correctly when moving between frames of different architectures. This patch attempts to fix this as well, though I have no way to test it. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28600 Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Rename show_registers -> set_register_groupTom Tromey1-1/+1
This renames a method on the TUI register window to reflect its real purpose. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Simplify tui_data_win::erase_data_contentTom Tromey1-1/+1
There's only a single call to tui_data_win::erase_data_content now, so remove the parameter and make it just render the "empty window" text. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Remove the TUI register window rerender overloadTom Tromey1-8/+6
After these restructurings, it should be clear that the rerender overload can be removed from the TUI register window. This is done by moving a bit more logic from show_registers into update_register_data. After this, update_register_data simply updates the internal state, and rerender will write to the screen. All the actual rendering work is done, ultimately, by display_registers_from. This split between updating the model and rendering makes it clear that the recursive case can't happen any longer. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Change tui_register_info::visible to a methodTom Tromey1-5/+3
tui_register_info::visible is redundant with the fact that y==0 means that the register is not visible. This patch changes this member in favor of having a single indication of the register's visibility -- a method with the same name. This change makes it clear that delete_data_content_windows is not needed, so this is removed as well. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Rename tui_data_item_window -> tui_register_infoTom Tromey1-7/+7
tui_data_item_window used to hold a curses window, but we removed that ages ago. Now it just holds information about a single register. This patch renames the class to make it more clearly reflect its meaning. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Simplify tui_data_window::show_register_groupTom Tromey1-6/+15
This simplifies tui_data_window::show_register_group, renaming it as well. The old method had two loops to iterate over all the registers for the arch, but in the new scheme, the vector is set up when switching groups, and then updates simply iterate over the vector. tui_data_item_window is made self-updating, which also clarifies the code somewhat. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-01-12Update copyright year range in header of all files managed by GDBAndrew Burgess1-1/+1
This commit is the result of the following actions: - Running gdb/copyright.py to update all of the copyright headers to include 2024, - Manually updating a few files the copyright.py script told me to update, these files had copyright headers embedded within the file, - Regenerating gdbsupport/Makefile.in to refresh it's copyright date, - Using grep to find other files that still mentioned 2023. If these files were updated last year from 2022 to 2023 then I've updated them this year to 2024. I'm sure I've probably missed some dates. Feel free to fix them up as you spot them.
2023-12-16[gdb/tui] Show regs when switching to regs layoutTom de Vries1-1/+5
When starting gdb in CLI mode, running to main and switching into the TUI regs layout: ... $ gdb -q a.out -ex start -ex "layout regs" ... we get: ... +---------------------------------+ | | | [ Register Values Unavailable ] | | | +---------------------------------+ ... Fix this by handling this case in tui_data_window::rerender. Tested on x86_64-linux. Approved-By: Tom Tromey <tom@tromey.com> PR tui/28600 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28600
2023-01-01Update copyright year range in header of all files managed by GDBJoel Brobecker1-1/+1
This commit is the result of running the gdb/copyright.py script, which automated the update of the copyright year range for all source files managed by the GDB project to be updated to include year 2023.
2022-10-10Change GDB to use frame_info_ptrTom Tromey1-2/+2
This changes GDB to use frame_info_ptr instead of frame_info * The substitution was done with multiple sequential `sed` commands: sed 's/^struct frame_info;/class frame_info_ptr;/' sed 's/struct frame_info \*/frame_info_ptr /g' - which left some issues in a few files, that were manually fixed. sed 's/\<frame_info \*/frame_info_ptr /g' sed 's/frame_info_ptr $/frame_info_ptr/g' - used to remove whitespace problems. The changed files were then manually checked and some 'sed' changes undone, some constructors and some gets were added, according to what made sense, and what Tromey originally did Co-Authored-By: Bruno Larsen <blarsen@redhat.com> Approved-by: Tom Tomey <tom@tromey.com>
2022-04-07gdb: switch to using 'const reggroup *' in tui-regs.{c,h}Andrew Burgess1-4/+5
Make uses of 'reggroup *' const throughout tui-regs.{c,h}. There should be no user visible changes after this commit.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-07-01Don't derive tui_data_item_window from tui_gen_win_infoTom Tromey1-18/+9
There's no deep reason that tui_data_item_window should derive from tui_gen_win_info -- it currently uses a curses window to render, but that isn't truly needed, and it adds some hacks to other parts of the TUI. This patch changes tui_data_item_window so that it doesn't have a base class, and updates the register window. This simplifies the code and enables a subsequent cleanup. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (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): Update. (tui_data_window::refresh_window, tui_data_window::no_refresh): Remove. (tui_data_window::check_register_values): Update. (tui_data_item_window::rerender): Add parameters. Update. (tui_data_item_window::refresh_window): Remove. * tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: No longer virtual. * tui/tui-regs.h (struct tui_data_item_window): Don't derive from tui_gen_win_info. <refresh_window, max_height, min_height>: Remove. <rerender>: Add parameters. <x, y, visible>: New members. (struct tui_data_window) <refresh_window, no_refresh>: Remove. <m_item_width>: New member.
2020-07-01Rename tui_data_item_window::item_noTom Tromey1-2/+2
tui_data_item_window::item_no is misnamed -- it only can be used for a register, but it references a "display" number as well. (Based on other comments I've seen in the past -- most since deleted -- I think there were plans at one point to display variables in this window as well. However, this was never implemented.) This patch renames this member to be more correct. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group) (tui_data_window::check_register_values): Update. * tui/tui-regs.h (struct tui_data_item_window) <regno>: Rename from item_no.
2020-07-01Remove tui_data_window::nameTom Tromey1-1/+0
The "name" member of tui_data_window was set, but never used. This removes it. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_data_window::show_register_group): Update. * tui/tui-regs.h (struct tui_data_item_window) <name>: Remove.
2020-07-01Remove tui_expand_tabsTom Tromey1-1/+1
tui_expand_tabs only has a single caller. This patch removes this function, in favor of a tab-expanding variant of string_file. This simplifies the code somewhat. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <content>: Now a std::string. * tui/tui-regs.c (class tab_expansion_file): New. (tab_expansion_file::write): New method. (tui_register_format): Change return type. Use tab_expansion_file. (tui_get_register, tui_data_window::display_registers_from) (tui_data_item_window::rerender): Update. * tui/tui-io.h (tui_expand_tabs): Don't declare. * tui/tui-io.c (tui_expand_tabs): Remove.
2020-02-22TUI windows do not need to store their typeTom Tromey1-8/+2
TUI windows no longer need to store their type -- there's only a single spot that uses this information, and it can be changed to use dynamic_cast. (It could be cleaned up even more, by using a virtual method, but I haven't done so.) This patch removes the "type" field from tui_gen_win_info, and this in turn allows removing a couple of enumerator constants. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>: Remove constants. * tui/tui-winsource.h (struct tui_source_window_base) <tui_source_window_base>: Remove parameter. * tui/tui-winsource.c (tui_source_window_base::tui_source_window_base): Remove parameter. (tui_source_window_base::refill): Update. * tui/tui-stack.h (struct tui_locator_window) <tui_locator_window>: Update. * tui/tui-source.h (struct tui_source_window) <tui_source_window>: Default the constructor. * tui/tui-regs.h (struct tui_data_item_window) <tui_data_item_window>: Default the constructor. (struct tui_data_window) <tui_data_window>: Likewise. * tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>: Default the constructor. * tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>: Default the constructor. <type>: Remove. (struct tui_win_info) <tui_win_info>: Default the constructor. * tui/tui-data.c (tui_win_info::tui_win_info): Remove. * tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>: Default the constructor. Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
2020-01-19Remove flickering from the TUITom Tromey1-0/+2
In some cases, the TUI flickers when redrawing. This can be seen mostly easily when switching layouts. This patch fixes the problem by exploiting the double buffering that curses already does. In some spots, the TUI will now disable flushing the curses buffers to the screen; and then flush them all at once when the rendering is complete. gdb/ChangeLog 2020-01-19 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_show_assembly): Use tui_suppress_output. * tui/tui-wingeneral.h (class tui_suppress_output): New. (tui_wrefresh): Declare. * tui/tui-wingeneral.c (suppress_output): New global. (tui_suppress_output, ~tui_suppress_output): New constructor and destructor. (tui_wrefresh): New function. (tui_gen_win_info::refresh_window): Use tui_wrefresh. (tui_gen_win_info::make_window): Call wnoutrefresh when needed. * tui/tui-regs.h (struct tui_data_window) <no_refresh>: Declare method. * tui/tui-regs.c (tui_data_window::erase_data_content): Call tui_wrefresh. (tui_data_window::no_refresh): New method. (tui_data_item_window::refresh_window): Call tui_wrefresh. (tui_reg_command): Use tui_suppress_output * tui/tui-layout.c (tui_set_layout): Use tui_suppress_output. * tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: New method. * tui/tui-command.c (tui_refresh_cmd_win): Call tui_wrefresh. Change-Id: Icb832ae100b861de3af3307488e636fa928d5c9f
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-11Introduce the tui_gen_win_info::min_height methodTom Tromey1-0/+5
This introduces a new method, tui_gen_win_info::min_height, to fetch the minimum height of a window. This is used in the subsequent unified layout patch. gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window) <min_height>: Implement. * tui/tui-regs.h (struct tui_data_item_window) <min_height>: Implement. * tui/tui-data.h (struct tui_gen_win_info) <min_height>: New method. (struct tui_win_info) <min_height>: Implement. Change-Id: Id33baffdf041fde072e15c1ff89b75f8b8118adb
2019-12-11Move max_height method to tui_gen_win_infoTom Tromey1-0/+5
This moves the max_height method to tui_gen_win_info and implements it in the subclasses. This is used by a subsequent patch, which will normalize window layout across all window types. gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-stack.h (struct tui_locator_window) <max_height>: New method. * tui/tui-regs.h (struct tui_data_item_window) <max_height>: New method. * tui/tui-data.h (struct tui_gen_win_info) <max_height>: New method. (struct tui_win_info) <max_height>: Now override. Change-Id: I4ba3e8899bc4668328d3d78e3c1674c61882450d
2019-09-20Rename private data members of tui_data_windowTom Tromey1-4/+4
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-1/+1
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-2/+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-0/+4
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-5/+10
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 tui_data_window::display_all_dataTom Tromey1-4/+0
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-20Change some tui_data_window methods to be privateTom Tromey1-30/+32
Turning various calls into methods has made it possible to now change some tui_data_window methods to be private. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <last_regs_line_no, line_from_reg_element_no, first_reg_element_no_inline, display_all_data, delete_data_content_windows, erase_data_content>: Now private.
2019-08-20Remove tui_data_window::display_regsTom Tromey1-2/+0
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-1/+5
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-2/+6
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-1/+2
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-20Change tui_data_item_window::content to be a unique_xmalloc_ptrTom Tromey1-3/+1
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-15TUI resize unificationTom Tromey1-3/+2
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-13clear_detail can only be called on TUI source windowsTom Tromey1-1/+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/+19
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-1/+83
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-17Introduce two more tui_data_window methodsTom Tromey1-2/+0
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-17Don't declare unimplemented functionsTom Tromey1-1/+0
A couple of functions were declared but never defined. This removes the declarations. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.h (tui_refresh_data_win): Don't declare. * tui/tui-regs.h (tui_first_reg_element_inline): Don't declare.
2019-07-17Remove tui_display_data_from_lineTom Tromey1-1/+1
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-1/+0
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-1/+0
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.