From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 458523858D34; Thu, 28 Mar 2024 10:33:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 458523858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1711622016; bh=L71BqtqKEd9RMOWSruFum7hLMHHwUxSM8HaTvy1N1mg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Z9uHQOo53RwZue99z42VIb88laTidbH1FRD/s/pXdB0sZn4HCAYAd490WNuGGGr5I tTPnWeINBoN8uzd0vhzPX+dRxqhJj1x4wdh2PuK6hZx9pXPj+bhYmknVurdB63JoYw Z+tyNVSB1tMcb9FTPfH+N/hoij0cabsPNALvWLrQ= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tui/31522] TUI misses highlight after run to main Date: Thu, 28 Mar 2024 10:33:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tui X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: 15.1 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31522 --- Comment #7 from Tom de Vries --- I investigated a bit, by setting a breakpoint on tui_source_window::set_contents, and observing what sal.line is used. With commit ee1e9bbb513^, we have (for the "tui enable" command): - sal.line =3D=3D 6 (set by tui_source_window_base::rerender) - sal.line =3D=3D 0 (set by tui_update_source_windows_with_addr) - sal.line =3D=3D 2 (set by tui_source_window::maybe_update) With commit ee1e9bbb513 (as well as with the fix of comment 4), we have: - sal.line =3D=3D 6 (set by tui_source_window_base::rerender) The desired behaviour of centering on a source line is only present in tui_source_window::maybe_update. Duplicating that functionality in tui_source_window_base::rerender: ... diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 52c0b5b69a4..c140e9053be 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -482,6 +482,10 @@ tui_source_window_base::rerender () struct symtab *s =3D find_pc_line_symtab (get_frame_pc (frame)); if (this !=3D TUI_SRC_WIN) find_line_pc (s, cursal.line, &cursal.pc); + int start_line =3D (cursal.line - ((height - box_size ()) / 2)) + 1; + if (start_line <=3D 0) + start_line =3D 1; + cursal.line =3D start_line; update_source_window (gdbarch, cursal); } else ... gives us the desired centering. It passes the TUI tests. --=20 You are receiving this mail because: You are on the CC list for the bug.=