aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
AgeCommit message (Collapse)AuthorFilesLines
5 daysFix using Page-Up in TUI source window close to the topHannes Domani1-2/+2
Currently, when you're already less than a page from the top in the TUI source window, and you press Page-Up, nothing happens, while I would expect that it then scrolls the source up to the first line. It's happening because scrolling a full page up would result in a negative starting line number, which is then checked if it's higher than the (unsigned) number of available lines, and since this will always be true, the original starting line number is restored. Afterwards it would check if the line number is too low, but since the negative value was already gone, it didn't do much. Fixed by moving the low line number check before the maximum line number check. Approved-By: Tom Tromey <tom@tromey.com>
2024-11-01Add gdb.events.tui_enabledTom Tromey1-0/+5
This adds a new event source so that Python scripts can track whether or not the TUI is presently enabled. v2 of the patch renames "status" -> "enabled". Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32162 Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-09-30Add line-number stylingTom Tromey3-4/+26
This patch adds separate styling for line numbers. That is, whenever gdb prints a source line number, it uses this style. v2 includes a change to ensure that %ps works in query. Reviewed-By: Eli Zaretskii <eliz@gnu.org> Reviewed-by: Keith Seitz <keiths@redhat.com>
2024-09-07Remove tui_refresh_cmd_winTom Tromey3-14/+3
tui_refresh_cmd_win is no longer needed and can be replaced with a call to the refresh_window method.
2024-09-07Remove tui_wrefreshTom Tromey5-27/+3
This removes tui_wrefresh, moving the code into refresh_window. We remove tui_norefresh_window as well, because now the command window's refresh_window has to do what tui_wrefresh previously did.
2024-09-07Rename tui_suppress_outputTom Tromey8-36/+22
This patch renames tui_suppress_output to the more descriptive tui_batch_rendering. This code was never really correct, and was based on a misunderstanding of the curses API. The updated comments describe the intended use of this class. This also removes the erroneous tui_win_info::no_refresh. wnoutrefresh does not prevent any output; rather, it copies from one curses buffer to another but (unlike woutrefresh) without then flushing to the screen. tui_batch_rendering now works in the correct way: calling doupdate in the destructor of the outermost instance, thus batching all screen output until that point. The patch adds instantiations of tui_batch_rendering to various spots, to make sure it is active when refreshing.
2024-09-07Clean up refreshing in TUI register windowTom Tromey2-24/+19
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-08-12gdb: add program_space parameter to lookup_minimal_symbolSimon Marchi1-1/+1
>From what I can see, lookup_minimal_symbol doesn't have any dependencies on the global current state other than the single reference to current_program_space. Add a program_space parameter and make that current_program_space reference bubble up one level. Change-Id: I759415e2f9c74c9627a2fe05bd44eb4147eee6fe Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12gdb: make lookup_minimal_symbol objf and sfile parameters optionalSimon Marchi1-1/+1
Most calls to lookup_minimal_symbol don't pass a value for sfile and objf. Make these parameters optional (have a default value of nullptr). And since passing a value to `objf` is much more common than passing a value to `sfile`, swap the order so `objf` comes first, to avoid having to pass a nullptr value to `sfile` when wanting to pass a value to `objf`. Change-Id: I8e9cc6b942e593bec640f9dfd30f62786b0f5a27 Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-08-12gdb: drop struct keyword when using bound_minimal_symbolSimon Marchi1-6/+6
This is a simple find / replace from "struct bound_minimal_symbol" to "bound_minimal_symbol", to make things shorter and more consisten througout. In some cases, move variable declarations where first used. Change-Id: Ica4af11c4ac528aa842bfa49a7afe8fe77a66849 Reviewed-by: Keith Seitz <keiths@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-07-15gdb: pass program space to get_current_source_symtab_and_lineSimon Marchi4-9/+12
Make the current program space reference bubble up one level. Change-Id: I6ba6dc4a2cb188720cbb61b84ab5c954aac105c6 Approved-By: Tom Tromey <tom@tromey.com> Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
2024-07-15gdb: pass program space to have_{full,partial}_symbolsSimon Marchi1-1/+2
Make the current program space reference bubble up one level. Change-Id: I19c4fc2ca955f9c828ef426a077b43983865697b Approved-By: Tom Tromey <tom@tromey.com> Reviewed-By: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
2024-06-15Make tui_register_info::highlight privateTom Tromey2-12/+14
This changes tui_register_info::highlight to be private, renaming it to m_highlight.
2024-06-15Remove a call to fflushTom Tromey1-1/+0
This TUI code calls fflush on stdout, but I don't believe this is useful in gdb.
2024-06-11Remove useless call to wnoutrefreshTom Tromey1-2/+0
This call to wnoutrefresh is not useful. It's based on the misunderstanding that wnoutrefresh somehow prevents display, whereas actually what it does is copy from one curses buffer to another. I'm working on a larger patch to clean up this area, but this particular call can be removed immediately without consequence. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-06-10gdb: re-add necessary includes in tui/tui-win.cSimon Marchi1-0/+2
Commit 9102a6c15c75 ("gdb/tui: cleanup includes") broke gdb.python/tui-window.exp on Linux: Running /data/vries/gdb/src/gdb/testsuite/gdb.python/tui-window.exp ... WARNING: timeout in accept_gdb_output WARNING: timeout in accept_gdb_output FAIL: gdb.python/tui-window.exp: Window was updated and caused a build failure on AIX: CXX tui/tui-win.o tui/tui-win.c: In function 'void tui_sigwinch_handler(int)': tui/tui-win.c:532:3: error: 'mark_async_signal_handler' was not declared in this scope; did you mean 'async_signal_handler'? 532 | mark_async_signal_handler (tui_sigwinch_token); | ^~~~~~~~~~~~~~~~~~~~~~~~~ | async_signal_handler tui/tui-win.c: At global scope: tui/tui-win.c:538:1: error: variable or field 'tui_async_resize_screen' declared void 538 | tui_async_resize_screen (gdb_client_data arg) | ^~~~~~~~~~~~~~~~~~~~~~~ tui/tui-win.c:538:26: error: 'gdb_client_data' was not declared in this scope 538 | tui_async_resize_screen (gdb_client_data arg) | ^~~~~~~~~~~~~~~ tui/tui-win.c: In function 'void tui_initialize_win()': tui/tui-win.c:579:36: error: 'tui_async_resize_screen' was not declared in this scope 579 | = create_async_signal_handler (tui_async_resize_screen, NULL, | ^~~~~~~~~~~~~~~~~~~~~~~ tui/tui-win.c:579:7: error: 'create_async_signal_handler' was not declared in this scope; did you mean 'async_signal_handler'? 579 | = create_async_signal_handler (tui_async_resize_screen, NULL, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | async_signal_handler gmake: *** [Makefile:1947: tui/tui-win.o] Error 1 On Linux, the removal of the signal.h include causes the `#ifdef SIGWINCH` sections to become inactive. The code builds, but then the TUI fails to react to terminal size changes. When we add back the inclusion of signal.h, then we see the same build error as on AIX. On AIX, I suppose that the SIGWINCH define is still seen by some other transitive include. When I go back to before 9102a6c15c75, I don't see async-event.h and signal.h being marked as unneeded by clangd, so I'm not sure why I removed them in the first place... I'll be more careful in the future (files with #ifdef/#ifndef can be tricky w.r.t. determining necessary includes). So, re-add the inclusion of signal.h and async-event.h Change-Id: I3ed385c2dc1726ade2118a5186ea7cccffd12635 Reported-By: Aditya Kamath1 <Aditya.Kamath1@ibm.com> Reported-By: Tom de Vries <tdevries@suse.de> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31865
2024-06-07gdb/tui: cleanup includesSimon Marchi22-81/+5
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 Marchi17-72/+102
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-06-03Remove one call to can_box from TUITom Tromey1-9/+3
This removes a call to can_box from tui_source_window_base::show_source_content. can_box will always return true here. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-06-02Fix typo in tui-data.hTom Tromey1-1/+1
I noticed a typo in a comment in tui-data.h.
2024-05-30gdb: remove unused includes in utils.hSimon Marchi3-0/+3
Remove some includes reported as unused by clangd. Add some includes in other files that were previously relying on the transitive include. Change-Id: Ibdd0a998b04d21362a20d0ca8e5267e21e2e133e
2024-05-28Make tui_win_info::make_window non-virtualTom Tromey1-1/+2
Nothing overrides tui_win_info::make_window, so remove the "virtual". Tested by rebuilding.
2024-05-17Remove gdb_stdtargerrTom Tromey1-2/+0
This patch removes gdb_stdtargerr. There doesn't seem to be a need for this -- it is always the same as stdtarg, and (I believe) has been for many years. Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-05-17Don't allow new-ui to start the TUITom Tromey1-0/+3
The TUI can't really work properly with new-ui, at least not as currently written. This patch changes new-ui to reject an attempt. Attempting to make a DAP ui this way is also now rejected. Regression tested on x86-64 Fedora 38. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29273 Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-05-14Remove fflush call from tui_refresh_cmd_winTom Tromey1-5/+0
tui_refresh_cmd_win calls fflush, but there's a comment explaining that the reason for the call is unknown. This patch removes the call. I don't think it can be useful, since gdb doesn't generally use stdout in this way -- only through ui_file.
2024-05-10Remove tui_refresh_allTom Tromey3-14/+5
This removes tui_refresh_all. There is only a single caller, tui_refresh_all_win, so inlining the code there simplifies gdb at no cost. Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-05-07Fix heap-use-after-free because all_objfiles_removed triggers tui_display_mainHannes Domani1-11/+2
Since gdb-10 there is a heap-use-after free happening if starting the target in TUI triggers a re-reading of symbols. It can be reproduced with: $ gdb -q -batch a.out -ex "tui enable" -ex "shell touch a.out" -ex start ==28392== Invalid read of size 1 ==28392== at 0x79E97E: lookup_global_or_static_symbol(char const*, block_enum, objfile*, domain_enum) (symtab.h:503) ==28392== by 0x79F859: lookup_global_symbol(char const*, block const*, domain_enum) (symtab.c:2641) ==28392== by 0x79F8E9: language_defn::lookup_symbol_nonlocal(char const*, block const*, domain_enum) const (symtab.c:2473) ==28392== by 0x7A66EE: lookup_symbol_aux(char const*, symbol_name_match_type, block const*, domain_enum, language, field_of_this_result*) (symtab.c:2150) ==28392== by 0x7A68C9: lookup_symbol_in_language(char const*, block const*, domain_enum, language, field_of_this_result*) (symtab.c:1958) ==28392== by 0x7A6A25: lookup_symbol(char const*, block const*, domain_enum, field_of_this_result*) (symtab.c:1970) ==28392== by 0x77120F: select_source_symtab() (source.c:319) ==28392== by 0x7EE2D5: tui_get_begin_asm_address(gdbarch**, unsigned long*) (tui-disasm.c:401) ==28392== by 0x807558: tui_display_main() (tui-winsource.c:55) ==28392== by 0x7937B5: clear_symtab_users(enum_flags<symfile_add_flag>) (functional:2464) ==28392== by 0x794F40: reread_symbols(int) (symfile.c:2690) ==28392== by 0x6497D1: run_command_1(char const*, int, run_how) (infcmd.c:398) ==28392== Address 0x4e67848 is 3,864 bytes inside a block of size 4,064 free'd ==28392== at 0x4A0A430: free (vg_replace_malloc.c:446) ==28392== by 0x936B63: _obstack_free (obstack.c:280) ==28392== by 0x79541E: reread_symbols(int) (symfile.c:2579) ==28392== by 0x6497D1: run_command_1(char const*, int, run_how) (infcmd.c:398) ==28392== by 0x4FFC45: cmd_func(cmd_list_element*, char const*, int) (cli-decode.c:2735) ==28392== by 0x7DAB50: execute_command(char const*, int) (top.c:575) ==28392== by 0x5D2B43: command_handler(char const*) (event-top.c:552) ==28392== by 0x5D3A50: command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) (event-top.c:788) ==28392== by 0x5D1F4B: gdb_rl_callback_handler(char*) (event-top.c:259) ==28392== by 0x857B3F: rl_callback_read_char (callback.c:290) ==28392== by 0x5D215D: gdb_rl_callback_read_char_wrapper_noexcept() (event-top.c:195) ==28392== by 0x5D232F: gdb_rl_callback_read_char_wrapper(void*) (event-top.c:234) The problem is that tui_display_main is called by the all_objfiles_removed hook, which tries to access the symbol cache. This symbol cache is actually stale at this point, and would have been flushed immediately afterwards by that same all_objfiles_removed hook. It's not possible to tell the hook to call the observers in a specific order, but in this case the tui_all_objfiles_removed observer is actually not needed, since it only calls tui_display_main, and a 'main' can only be found if objfiles are added, not removed. So the fix is to simply remove the tui_all_objfiles_removed observer. The clearing of the source window (if symbols were removed by e.g. 'file' without arguments) still works, since this is done by the tui_before_prompt observer. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31697 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-27Fix typo in TUI commentTom Tromey1-1/+1
tui_win_info::make_visible has a mildly misleading comment -- it says "visible" where "invisible" is meant. This patch fixes it.
2024-04-27Remove two unneeded forward declarationsTom Tromey2-4/+0
I noticed a couple of forward declarations in the TUI that aren't needed -- the declarations aren't used in the header files in which they appear. This patch removes these.
2024-04-25gdb: remove gdbcmd.hSimon Marchi3-3/+2
Most files including gdbcmd.h currently rely on it to access things actually declared in cli/cli-cmds.h (setlist, showlist, etc). To make things easy, replace all includes of gdbcmd.h with includes of cli/cli-cmds.h. This might lead to some unused includes of cli/cli-cmds.h, but it's harmless, and much faster than going through the 170 or so files by hand. Change-Id: I11f884d4d616c12c05f395c98bbc2892950fb00f Approved-By: Tom Tromey <tom@tromey.com>
2024-04-23gdb: move a bunch of quit-related things to event-top.{c,h}Simon Marchi1-0/+1
Move some declarations related to the "quit" machinery from defs.h to event-top.h. Most of the definitions associated to these declarations are in event-top.c. The exceptions are `quit()` and `maybe_quit()`, that are defined in utils.c. For consistency, move these two definitions to event-top.c. Include "event-top.h" in many files that use these things. Change-Id: I6594f6df9047a9a480e7b9934275d186afb14378 Approved-By: Tom Tromey <tom@tromey.com>
2024-04-02[gdb/tui] Fix centering and highlighting of current lineTom de Vries2-1/+11
After starting TUI like this with a hello world a.out: ... $ gdb -q a.out -ex start -ex "tui enable" ... we get: ... ┌─hello.c──────────────────────────────┐ │ 5 { │ │ 6 printf ("hello\n"); │ │ 7 │ │ 8 return 0; │ │ 9 } │ │ │ └──────────────────────────────────────┘ ... This is a regression since commit ee1e9bbb513 ("[gdb/tui] Fix displaying main after resizing"), before which we had instead: ... ┌─hello.c──────────────────────────────┐ │ 4 main (void) │ │ 5 { │ │ > 6  printf ("hello\n"); │ │ 7 │ │ 8 return 0; │ │ 9 } │ └──────────────────────────────────────┘ ... In other words, the problems are: - the active line (source line 6) is no longer highlighted, and - the active line is not vertically centered (screen line 2 out 6 instead of screen line 3 out of 6). Fix these problems respectively by: - in tui_enable, instead of "tui_show_frame_info (0)" using 'tui_show_frame_info (deprecated_safe_get_selected_frame ())", and - in tui_source_window_base::rerender, adding centering functionality. Tested on aarch64-linux. Co-Authored-By: Tom Tromey <tom@tromey.com> Approved-By: Tom Tromey <tom@tromey.com> PR tui/31522 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31522
2024-03-30Lower variable definitions in tui_redisplay_readlineTom Tromey1-18/+9
I noticed a redundant assignment to 'prev_col' in tui_redisplay_readline, and then went ahead and lowered most of the variable definitions in that function to their initialization point.
2024-03-26gdb, gdbserver, gdbsupport: remove includes of early headersSimon Marchi16-16/+0
Now that defs.h, server.h and common-defs.h are included via the `-include` option, it is no longer necessary for source files to include them. Remove all the inclusions of these files I could find. Update the generation scripts where relevant. Change-Id: Ia026cff269c1b7ae7386dd3619bc9bb6a5332837 Approved-By: Pedro Alves <pedro@palves.net>
2024-03-11Remove tui-out.[ch]Tom Tromey3-177/+1
The other day on irc, we were discussing the "m_line" hack in tui-out.c, and I mentioned that it would be nice to replace this with a new ui_out_flag. Later, I looked at ui_out_flag and found: ui_source_list = (1 << 0), ... and sure enough, this is tested already. This patch removes tui-out.[ch] and changes the TUI to use an ordinary cli-out object without this flag set. As far as I can tell, this doesn't affect behavior at all -- the TUI tests all pass, and interactively I tried switching stack frames, "list", etc, and it all seems to work. New in v2: fixed the problem pointed out by Keith, and added a test case for that scenario. Reviewed-By: Andrew Burgess <aburgess@redhat.com>
2024-03-01Fix TUI text centeringTom Tromey4-36/+22
In a couple of spots, the TUI tries to center some text in the window. Andrew noticed that the calculation is done strangely and the text ends up somewhat to the left of center. This patch fixes the problem. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31355
2024-02-24[gdb/build] Fix static cast of virtual baseTom de Vries1-2/+2
With this change in bfd/development.sh: ... -development=true +development=false ... we run into: ... In file included from tui-data.h:28:0, from tui-command.c:24: gdb-checked-static-cast.h: In instantiation of \ ‘T gdb::checked_static_cast(V*) [with T = tui_cmd_window*; V = tui_win_info]’: tui-command.c:65:15: required from here gdb-checked-static-cast.h:63:14: error: cannot convert from pointer to base \ class ‘tui_win_info’ to pointer to derived class ‘tui_cmd_window’ because \ the base is virtual T result = static_cast<T> (v); ^~~~~~~~~~~~~~~~~~ ... Fix this by using dynamic_cast instead of gdb::checked_static_cast in TUI_CMD_WIN and TUI_STATUS_WIN. Tested on x86_64-linux, with development set to false. Reported-By: Robert Xiao <spam_hole@shaw.ca> Reported-By: Simon Marchi <simark@simark.ca> Approved-By: Tom Tromey <tom@tromey.com> PR build/31399 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31399
2024-02-20gdb: pass frames as `const frame_info_ptr &`Simon Marchi10-12/+12
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 Tromey3-24/+45
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 Tromey2-4/+4
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-08Return void from tui_show_frame_infoTom Tromey2-11/+7
Nothing uses the tui_show_frame_info result any more, so change it to return void. 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 redundant check from tui_refresh_frame_and_register_informationTom Tromey1-3/+2
tui_refresh_frame_and_register_information checks 'from_stack' in a block that's already guarded by a 'from_stack' check. This patch removes the redundant check. 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 tui_refreshing_registersTom Tromey1-14/+2
The comment by tui_refreshing_registers mentions a hook that no longer exists. However, maybe the comment is wrong. The code paths touching tui_refreshing_registers can only be called in two places: 1. From the before_prompt observer. This is only called when a prompt is about to be displayed. 2. From the register_changed observer. This is only called when value_assign changes a register value. From this it seems clear that the recursion case here cannot in fact occur. This patch removes the variable. 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 Tromey2-13/+11
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 Tromey2-37/+28
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-08Simplify update_register_dataTom Tromey1-36/+21
This changes update_register_data to always update the register data. The idea here is that this is really only called when either the desired register group changes, or when gdb transitions from not having a frame to having a frame. show_registers is also simplified slightly to account for this. Tested-By: Tom de Vries <tdevries@suse.de> Reviewed-By: Andrew Burgess <aburgess@redhat.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-08Move scrollok call in register windowTom Tromey1-4/+4
The register window calls scrollok each time a register is written to the window. However, we only need to call this once, at the start of display. (We could actually call it just once when the window is made, but that would involve making another method virtual or adding a new member -- both which I think are worse than this approach.) 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 Tromey2-20/+5
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 Tromey2-15/+12
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 Tromey2-77/+57
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>