From: Andrew Burgess Date: Sat, 8 Feb 2025 21:22:45 +0000 (+0000) Subject: gdb/tui: use tui_batch_rendering more X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2ab74973cf59d5f0c53a99143745bacc2ad9e51;p=thirdparty%2Fbinutils-gdb.git 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 --- diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 25358d08352..69294cc3f7f 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -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); diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 33b24d8946d..95639f5fc4b 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -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) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 83d9fc09d11..587162bcbf7 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -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)) diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index 59aa1bc1483..8b79d8bc310 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -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. */