From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id dv5LAs8immdqSR4AWB0awg (envelope-from ) for ; Wed, 29 Jan 2025 07:45:03 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GQAhYBia; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wIxakkPx; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GQAhYBia; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wIxakkPx; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ED9161E105; Wed, 29 Jan 2025 07:45:02 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.0 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A5C931E08E for ; Wed, 29 Jan 2025 07:45:00 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38BC03857BB0 for ; Wed, 29 Jan 2025 12:45:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 38BC03857BB0 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GQAhYBia; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wIxakkPx; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=GQAhYBia; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=wIxakkPx Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 87CE33858D34 for ; Wed, 29 Jan 2025 12:44:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87CE33858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87CE33858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738154650; cv=none; b=Z2qkmtqqwozQdIx8jrFO+GGfqg4n5vPiOBN13KJbmlMDbmAfZubJUyh/NCzBfjL5Numtnl/8zTqBAfKv39KEidYukh6pzO3U/wsX/tXl69an0/b1XGzzFjGubKuUBonkY06ZHpSKf2eBvOWT8Iol0oDlhL3dL7YGNF4Kg4CUYtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738154650; c=relaxed/simple; bh=emPI47e5Z+JARraI8M/43X/AgY0DUzPgy4qMmk9TF40=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=vYqWEyNEttXZbPjpKZ4FpGrlz8nUiaOE1fx7EJZCN6gDMs9HRdwdCQB7l5WrycUEY2TpqRXxkxQh4JdzVf4TzsOJLlM5tM5F73H5MGiuRZtmhioTu0qHwdpItQEQ9kysK1y98lK3Goq7YPt3NRk5UmWWTD/T17gjK3I2cf1Q8Y8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87CE33858D34 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 72DAF210E4; Wed, 29 Jan 2025 12:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738154649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qT0p6WrSIRhwLaVMM3Hlh3O9h9mp/ZH9s6jgJ360tcw=; b=GQAhYBiaRGnl0u1489SBdlRIu/Yrvuu7phICYSueqWzUGDbsF15VtrmFeQannDyY2dry4T ZTSFhTt04z7WisrrRz0RHJqXRQHuO9fXKIHNsx7EMPRpSV9YzceO+8ntSaRvendZ+YJYlY u+ebvZzbPjCqNgvva6sGdtvBYFH5Bmw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738154649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qT0p6WrSIRhwLaVMM3Hlh3O9h9mp/ZH9s6jgJ360tcw=; b=wIxakkPxI1KuKusz0y+xRQhiad599d4pRzc01R3BrvwQp7jgQ0xTP/t3yROGVsM9zfMU33 ebeS7k/xRn9mqlDg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=GQAhYBia; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=wIxakkPx DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1738154649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qT0p6WrSIRhwLaVMM3Hlh3O9h9mp/ZH9s6jgJ360tcw=; b=GQAhYBiaRGnl0u1489SBdlRIu/Yrvuu7phICYSueqWzUGDbsF15VtrmFeQannDyY2dry4T ZTSFhTt04z7WisrrRz0RHJqXRQHuO9fXKIHNsx7EMPRpSV9YzceO+8ntSaRvendZ+YJYlY u+ebvZzbPjCqNgvva6sGdtvBYFH5Bmw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1738154649; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qT0p6WrSIRhwLaVMM3Hlh3O9h9mp/ZH9s6jgJ360tcw=; b=wIxakkPxI1KuKusz0y+xRQhiad599d4pRzc01R3BrvwQp7jgQ0xTP/t3yROGVsM9zfMU33 ebeS7k/xRn9mqlDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 585EA137D2; Wed, 29 Jan 2025 12:44:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id /IBDFJkimmejOAAAD6G6ig (envelope-from ); Wed, 29 Jan 2025 12:44:09 +0000 Message-ID: <304fb3ec-74f9-4544-b9a7-3c4ed05e28bf@suse.de> Date: Wed, 29 Jan 2025 13:44:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/tui] Don't show incorrect source file in source window From: Tom de Vries To: Andrew Burgess , gdb-patches@sourceware.org References: <20250129102102.28617-1-tdevries@suse.de> <875xlx9803.fsf@redhat.com> <3e18503c-2048-4ff8-8ba2-18eb51337b5f@suse.de> Content-Language: en-US In-Reply-To: <3e18503c-2048-4ff8-8ba2-18eb51337b5f@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 72DAF210E4 X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 1/29/25 13:27, Tom de Vries wrote: > On 1/29/25 12:25, Andrew Burgess wrote: >> Tom de Vries writes: >> >>> Consider the test-case sources main.c and foo.c: >>> ... >>> $ cat main.c >>> extern int foo (void); >>> >>> int >>> main (void) >>> { >>>    return foo (); >>> } >>> $ cat foo.c >>> extern int foo (void); >>> >>> int >>> foo (void) >>> { >>>    return 0; >>> } >>> ... >>> and main.c compiled with debug info, and foo.c without: >>> ... >>> $ gcc -g main.c -c >>> $ gcc foo.c -c >>> $ gcc -g main.o foo.o >>> ... >>> >>> In TUI mode, if we run to foo: >>> ... >>> $ gdb -q a.out -tui -ex "b foo" -ex run >>> ... >>> it gets us "[ No Source Available ]": >>> ... >>> ┌─main.c─────────────────────────────────────────┐ >>> │                                                │ >>> │                                                │ >>> │                                                │ >>> │            [ No Source Available ]             │ >>> │                                                │ >>> │                                                │ >>> └────────────────────────────────────────────────┘ >>> (src) In: foo                  L??   PC: 0x400566 >>> db.so.1". >>> >>> Breakpoint 1, 0x0000000000400566 in foo () >>> (gdb) >>> ... >>> >>> But after resizing (pressing ctrl- in the gnome-terminal), we get >>> instead the source for main.c: >>> ... >>> ┌─main.c───────────────────────────────────────────────────┐ >>> │        3 int                                             │ >>> │        4 main (void)                                     │ >>> │        5 {                                               │ >>> │        6   return foo ();                                │ >>> │        7 }                                               │ >>> │                                                          │ >>> │                                                          │ >>> └──────────────────────────────────────────────────────────┘ >>> (src) In: foo                            L??   PC: 0x400566 >>> db.so.1". >>> >>> Breakpoint 1, 0x0000000000400566 in foo () >>> (gdb) >>> ... >>> which is inappropriate because we're stopped in function foo, which >>> is not in >>> main.c. >>> >>> Fix this in tui_source_window_base::rerender. >>> >>> Tested on x86_64-linux. >>> >>> Reported-By: Andrew Burgess >>> >>> PR tui/32614 >>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32614 >>> --- >>>   gdb/testsuite/gdb.tui/resize-3-foo.c  | 24 ++++++++++ >>>   gdb/testsuite/gdb.tui/resize-3-main.c | 24 ++++++++++ >>>   gdb/testsuite/gdb.tui/resize-3.exp    | 63 +++++++++++++++++++++++++++ >>>   gdb/tui/tui-winsource.c               |  6 +++ >>>   4 files changed, 117 insertions(+) >>>   create mode 100644 gdb/testsuite/gdb.tui/resize-3-foo.c >>>   create mode 100644 gdb/testsuite/gdb.tui/resize-3-main.c >>>   create mode 100644 gdb/testsuite/gdb.tui/resize-3.exp >>> >>> diff --git a/gdb/testsuite/gdb.tui/resize-3-foo.c b/gdb/testsuite/ >>> gdb.tui/resize-3-foo.c >>> new file mode 100644 >>> index 00000000000..653b24ba92b >>> --- /dev/null >>> +++ b/gdb/testsuite/gdb.tui/resize-3-foo.c >>> @@ -0,0 +1,24 @@ >>> +/* This testcase is part of GDB, the GNU debugger. >>> + >>> +   Copyright 2025 Free Software Foundation, Inc. >>> + >>> +   This program is free software; you can redistribute it and/or modify >>> +   it under the terms of the GNU General Public License as published by >>> +   the Free Software Foundation; either version 3 of the License, or >>> +   (at your option) any later version. >>> + >>> +   This program is distributed in the hope that it will be useful, >>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of >>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the >>> +   GNU General Public License for more details. >>> + >>> +   You should have received a copy of the GNU General Public License >>> +   along with this program.  If not, see >> licenses/>.  */ >>> + >>> +extern int foo (void); >>> + >>> +int >>> +foo (void) >>> +{ >>> +  return 0; >>> +} >>> diff --git a/gdb/testsuite/gdb.tui/resize-3-main.c b/gdb/testsuite/ >>> gdb.tui/resize-3-main.c >>> new file mode 100644 >>> index 00000000000..95fdd3b6ba0 >>> --- /dev/null >>> +++ b/gdb/testsuite/gdb.tui/resize-3-main.c >>> @@ -0,0 +1,24 @@ >>> +/* This testcase is part of GDB, the GNU debugger. >>> + >>> +   Copyright 2025 Free Software Foundation, Inc. >>> + >>> +   This program is free software; you can redistribute it and/or modify >>> +   it under the terms of the GNU General Public License as published by >>> +   the Free Software Foundation; either version 3 of the License, or >>> +   (at your option) any later version. >>> + >>> +   This program is distributed in the hope that it will be useful, >>> +   but WITHOUT ANY WARRANTY; without even the implied warranty of >>> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the >>> +   GNU General Public License for more details. >>> + >>> +   You should have received a copy of the GNU General Public License >>> +   along with this program.  If not, see >> licenses/>.  */ >>> + >>> +extern int foo (void); >>> + >>> +int >>> +main (void) >>> +{ >>> +  return foo (); >>> +} >>> diff --git a/gdb/testsuite/gdb.tui/resize-3.exp b/gdb/testsuite/ >>> gdb.tui/resize-3.exp >>> new file mode 100644 >>> index 00000000000..ec022b4a177 >>> --- /dev/null >>> +++ b/gdb/testsuite/gdb.tui/resize-3.exp >>> @@ -0,0 +1,63 @@ >>> +# Copyright 2025 Free Software Foundation, Inc. >>> + >>> +# This program is free software; you can redistribute it and/or modify >>> +# it under the terms of the GNU General Public License as published by >>> +# the Free Software Foundation; either version 3 of the License, or >>> +# (at your option) any later version. >>> +# >>> +# This program is distributed in the hope that it will be useful, >>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of >>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the >>> +# GNU General Public License for more details. >>> +# >>> +# You should have received a copy of the GNU General Public License >>> +# along with this program.  If not, see . >>> + >>> +# Test TUI resizing while showing "No Source Available". >>> + >>> +require allow_tui_tests >>> + >>> +standard_testfile -main.c -foo.c >>> + >>> +if { [build_executable_from_specs "failed to prepare" \ >>> +      $testfile {debug} \ >>> +      $srcfile {debug} \ >>> +      $srcfile2 {nodebug}] == -1 } { >>> +    return -1 >>> +} >>> + >>> +tuiterm_env >>> + >>> +Term::clean_restart 24 80 $testfile >>> + >>> +# It would be simpler to run directly to foo and then enter TUI, but >>> that >>> +# fails to trigger PR32614.  So instead, we first run to main, enter >>> TUI and >>> +# then run to foo. >>> +if {![runto_main]} { >>> +    perror "test suppressed" >>> +    return >>> +} >>> + >>> +# Set a breakpoint on foo, easier to do before entering TUI. >>> +gdb_breakpoint foo >>> + >>> +if {![Term::enter_tui]} { >>> +    unsupported "TUI not supported" >>> +    return >>> +} >>> + >>> +# Continue to foo. >>> +Term::command continue >>> + >>> +with_test_prefix "before resize" { >>> +    Term::check_contents "Source window empty" \ >>> +    "No Source Available" >>> +} >>> + >>> +Term::resize 40 90 >>> + >>> +with_test_prefix "after resize" { >>> +    # Regression test for PR32614. >>> +    Term::check_contents "Source window empty" \ >>> +    "No Source Available" >>> +} >>> diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c >>> index a5d0c594545..bf4052755df 100644 >>> --- a/gdb/tui/tui-winsource.c >>> +++ b/gdb/tui/tui-winsource.c >>> @@ -460,6 +460,12 @@ tui_source_window_base::rerender () >>>         struct gdbarch *gdbarch = get_frame_arch (frame); >>>         struct symtab *s = find_pc_line_symtab (get_frame_pc (frame)); >>> +      if (s == nullptr) >>> +    { >>> +      erase_source_content (); >>> +      return; >>> +    } >> >> This didn't look quite right to me.  But while trying to find the set of >> steps to show why I don't think this change is exactly right ... I ran >> into another bug, which means that this isn't wrong right now ... but >> might be once the other bug is fixed ... maybe .... >> >> So, what worried me, is that this ::rerender is called for both the SRC >> window and the ASM window.  My thinking was that if this change is >> fixing things so we call erase_source_content() when we cannot find the >> source file, then we're also going to call erase_source_content() for >> the ASM window when we cannot find the source file, and that cannot be >> right, we should always be able to update the ASM window with the >> correct disassembler output. >> > > Hi Andrew, > > thanks for the review, and bringing up this point. > > I've submitted a v2 that limits the impact of the fix to the source > window ( https://sourceware.org/pipermail/gdb-patches/2025- > January/215043.html ). > >> So I tried the following with an UNPATCHED gdb: >> >>    1. layout src >>    2. step into a region where "No Source Available" is shown. >>    3. layout asm >> >> My expectation is that I should immediately see the disassembler output >> for the current $pc location.  What I actually see is "No Assembly >> Available". >> > > I can reproduce this. > FWIW, I investigated this as well, and tried to make a similar minimal fix, and ended up with: ... diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index a5d0c594545..07aca28eb53 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -459,9 +459,11 @@ tui_source_window_base::rerender () frame_info_ptr frame = deprecated_safe_get_selected_frame (); struct gdbarch *gdbarch = get_frame_arch (frame); - struct symtab *s = find_pc_line_symtab (get_frame_pc (frame)); if (this != tui_src_win ()) - find_line_pc (s, cursal.line, &cursal.pc); + { + update_source_window_with_addr (gdbarch, get_frame_pc (frame)); + return; + } /* This centering code is copied from tui_source_window::maybe_update. ... Thanks, - Tom >> Turns out we hit the erase_source_content() call in >> tui_source_window_base::update_source_window_as_is because the sal.pc >> within that function is 0, and so the set_contents call returns false. >> >> If I then `si` the ASM window immediately updates with the disassembler >> output.  This time the update originates from tui_show_frame_info, which >> gets the symtab_and_line via a different approach than the ::rerender >> function does. >> >> So I wondered, would a better solution be to rewrite at least part of >> ::rerender based on tui_show_frame_info? >> >> Below is a _rough_ patch which does just this.  There's no commit >> message or anything yet.  It passes all the gdb.tui/ tests, including >> your new test that you added with this patch. >> >> This also seems to resolve the src -> asm switching issue I detail >> above. >> >> I'd love to hear what you think about this approach. >> > > I like it because it make the resulting code much shorter, and straight- > line code. > > Superficially it doesn't look wrong to me, but unfortunately, my > understanding of the TUI code is not sufficient to approve or even > review it. > > FWIW, it would be good to known whether all the paths in the old code > are covered by the test-suite. > >> If you think this is the way to go then I'd propose that I write this >> up, steal your new test, and add another test to expose the src to asm >> switching issue. >> > > We could do that, or go with the v2 I proposed (if that is indeed > acceptable) and work from there.  I have a very slight preference for > the latter. > > Thanks, > - Tom > >> But I'm worried that I might be missing something. >> >> Thanks, >> Andrew >> >> --- >> >> diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c >> index a5d0c594545..b9c26e88a3a 100644 >> --- a/gdb/tui/tui-winsource.c >> +++ b/gdb/tui/tui-winsource.c >> @@ -454,25 +454,10 @@ tui_source_window_base::rerender () >>       } >>     else if (deprecated_safe_get_selected_frame () != NULL) >>       { >> -      symtab_and_line cursal >> -    = get_current_source_symtab_and_line (current_program_space); >>         frame_info_ptr frame = deprecated_safe_get_selected_frame (); >> -      struct gdbarch *gdbarch = get_frame_arch (frame); >> - >> -      struct symtab *s = find_pc_line_symtab (get_frame_pc (frame)); >> -      if (this != tui_src_win ()) >> -    find_line_pc (s, cursal.line, &cursal.pc); >> - >> -      /* This centering code is copied from >> tui_source_window::maybe_update. >> -     It would be nice to do centering more often, and do it in just one >> -     location.  But since this is a regression fix, handle this >> -     conservatively for now.  */ >> -      int start_line = (cursal.line - ((height - box_size ()) / 2)) + 1; >> -      if (start_line <= 0) >> -    start_line = 1; >> -      cursal.line = start_line; >> - >> -      update_source_window (gdbarch, cursal); >> +      symtab_and_line cursal = find_frame_sal (frame); >> + >> +      maybe_update (frame, cursal); >>       } >>     else >>       { >