From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id C3D4F3858C2F; Fri, 27 Jan 2023 16:25:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C3D4F3858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674836733; bh=hxiorSFRHoWQCAw8py0f9neXPaiux+VaHYk5nXviQd4=; h=From:To:Subject:Date:From; b=Hq12RvfxSN+8+pSv9WTeGb48csqbGT3wnT7Kxwp4kSDUgen1t/PnvplrmZRX7+ocI ctkFGPaqEUsHFON/oLjN0w6AOFxYg7oS9ftneFTo2kWpqNWLzSSn8jtod+Xn71KVQv DpRaRyF5j6a9vyRcBolUhDLwOysC179bNwqxNoZA= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/tui: avoid extra refresh_window on vertical scroll X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: d2a5ea5622ec7a2a3e255186c88d69812f148913 X-Git-Newrev: 99c15700fd47e59a14d6338fda7aeadf5ba480f3 Message-Id: <20230127162533.C3D4F3858C2F@sourceware.org> Date: Fri, 27 Jan 2023 16:25:33 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D99c15700fd47= e59a14d6338fda7aeadf5ba480f3 commit 99c15700fd47e59a14d6338fda7aeadf5ba480f3 Author: Andrew Burgess Date: Thu Jan 5 12:26:09 2023 +0000 gdb/tui: avoid extra refresh_window on vertical scroll =20 While working on the previous couple of patches I noticed that when I scroll the src and asm windows vertically, I get two refresh_window calls. =20 The two calls can be traced back to tui_source_window_base::update_source_window_as_is, in here we call show_source_content, which calls refresh_window, and then update_exec_info, which also calls refresh_window. =20 In this commit I propose making the refresh_window call in update_exec_info optional. In update_source_window_as_is I'll then call update_exec_info before calling show_source_content, and pass a flag to update_exec_info to defer the refresh. =20 There are places where update_exec_info is used without any subsequent refresh_window call (e.g. when a breakpoint is updated), so update_exec_info does not to call refresh_window in some cases, which is why I'm using a flag to control the refresh. =20 With this changes I'm now only seeing a single refresh_window call for each vertical scroll. =20 There should be no user visible changes after this commit. Diff: --- gdb/tui/tui-winsource.c | 12 ++++++------ gdb/tui/tui-winsource.h | 9 ++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 50efa80576f..b5b6079a909 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -172,8 +172,8 @@ tui_source_window_base::update_source_window_as_is { validate_scroll_offsets (); update_breakpoint_info (nullptr, false); + update_exec_info (false); show_source_content (); - update_exec_info (); } } =20 @@ -636,11 +636,10 @@ tui_source_window_base::update_breakpoint_info return need_refresh; } =20 -/* Function to initialize the content of the execution info window, - based upon the input window which is either the source or - disassembly window. */ +/* See tui-winsource.h. */ + void -tui_source_window_base::update_exec_info () +tui_source_window_base::update_exec_info (bool refresh_p) { update_breakpoint_info (nullptr, true); for (int i =3D 0; i < m_content.size (); i++) @@ -668,5 +667,6 @@ tui_source_window_base::update_exec_info () =20 show_line_number (i); } - refresh_window (); + if (refresh_p) + refresh_window (); } diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index 2762afff010..7370ae95d8b 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -148,7 +148,14 @@ public: =20 virtual bool location_matches_p (struct bp_location *loc, int line_no) = =3D 0; =20 - void update_exec_info (); + /* Fill in the left margin of the current window with execution indicator + information, e.g. breakpoint indicators, and line numbers. When + REFRESH_P is true this function will call refresh_window to ensure + updates are written to the screen, otherwise the refresh is skipped, + which will leave the on screen contents out of date. When passing + false for REFRESH_P you should be planning to call refresh_window + yourself. */ + void update_exec_info (bool refresh_p =3D true); =20 /* Update the window to display the given location. Does nothing if the location is already displayed. */