gdb/tui: use tui_batch_rendering more

While working on the commit:

  commit 4f28b020a3416ac87ac12cf7ae3625a4bc178975
  Date:   Wed Feb 5 20:12:03 2025 +0000

      gdb/tui: use wrefresh if output is not surpressed

I spotted some places where tui_win_info::refresh_window() was being
called when suppress_output was false.  This means that there is no
tui_batch_rendering in place on the call stack, and so, after that
commit, we might be performing more wrefresh() calls than necessary.

Before the above commit we would have been calling wnoutrefresh() and,
due to the missing tui_batch_rendering, there might have been a delay
before doupdate() was called.

To (hopefully) make screen updates smoother, this commit adds
tui_batch_rendering in a few places where it is possible that there
might be multiple window updates performed, this will mean the final
write to screen is deferred until the tui_batch_rendering goes out of
scope.

Other than possibly smother screen updates, there should be no user
visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess 2025-02-08 21:22:45 +00:00
parent c5ac7c9f7c
commit f2ab74973c
4 changed files with 14 additions and 2 deletions

View File

@ -35,6 +35,7 @@
#include "tui/tui-regs.h"
#include "tui/tui-status.h"
#include "tui/tui-winsource.h"
#include "tui/tui-wingeneral.h"
static void
tui_new_objfile_hook (struct objfile* objfile)
@ -106,6 +107,8 @@ tui_refresh_frame_and_register_information ()
target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
tui_batch_rendering defer;
if (from_stack)
{
frame_info_ptr fi;
@ -150,6 +153,8 @@ tui_dummy_print_frame_info_listing_hook (struct symtab *s,
static void
tui_inferior_exit (struct inferior *inf)
{
tui_batch_rendering defer;
/* Leave the SingleKey mode to make sure the gdb prompt is visible. */
tui_set_key_mode (TUI_COMMAND_MODE);
tui_show_frame_info (0);

View File

@ -969,6 +969,8 @@ tui_set_win_size (const char *arg, bool set_width_p)
new_size = curr_size + input_no;
}
tui_batch_rendering defer;
/* Now change the window's height, and adjust
all other windows around it. */
if (set_width_p)

View File

@ -37,6 +37,7 @@
#include "tui/tui-source.h"
#include "tui/tui-disasm.h"
#include "tui/tui-location.h"
#include "tui/tui-wingeneral.h"
#include "gdb_curses.h"
/* Function to display the "main" routine. */
@ -52,10 +53,10 @@ tui_display_main ()
tui_get_begin_asm_address (&gdbarch, &addr);
if (addr != (CORE_ADDR) 0)
{
struct symtab *s;
tui_batch_rendering defer;
tui_update_source_windows_with_addr (gdbarch, addr);
s = find_pc_line_symtab (addr);
struct symtab *s = find_pc_line_symtab (addr);
tui_location.set_location (s);
}
}
@ -607,6 +608,8 @@ tui_source_window_base::set_is_exec_point_at (struct tui_line_or_address l)
void
tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
{
tui_batch_rendering defer;
for (tui_source_window_base *win : tui_source_windows ())
{
if (win->update_breakpoint_info (being_deleted, false))

View File

@ -387,6 +387,8 @@ tui_enable (void)
if (tui_active)
return;
tui_batch_rendering defer;
/* To avoid to initialize curses when gdb starts, there is a deferred
curses initialization. This initialization is made only once
and the first time the curses mode is entered. */