From patchwork Tue Jan 7 11:52:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 37238 Received: (qmail 23365 invoked by alias); 7 Jan 2020 11:52:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23278 invoked by uid 89); 7 Jan 2020 11:52:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=horizontal, 4833, screen X-HELO: mail-wr1-f46.google.com Received: from mail-wr1-f46.google.com (HELO mail-wr1-f46.google.com) (209.85.221.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2020 11:52:33 +0000 Received: by mail-wr1-f46.google.com with SMTP id t2so53602758wrr.1 for ; Tue, 07 Jan 2020 03:52:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=wHUt2Vw2/pJhYL+9TveF+gsax/DXSAsWU67HKDNbaoA=; b=JMzBZvm48OuqLOER18qrm03xZp8JQ2lWV7xf0TAD8EzJZvZEIRP/1uMqazbTjNLT3R 8qAsBZnC++8HnFCERgOcGRNuHin9sCRL4zUFapE76X/tz87U5uoLIOipaIIzTGX4AxMo xZjembM153mnzuaqJWvUY9pk0MZrYg0YU5y5/6X4YxX7sV7BJ5cIjJnolJEmxbiVFCI8 bDDE1k6THRs7h6xK2vZr/EEn9E4SJUN72Xn3/5ZBTHnneY949QR/WlJppC0FqvQ/Vx8n oqmTLE5bNTasye7aJXyEw0868ySQ7nhyo8AGJhUmuJhecIUmjg1aeotKhpbh7yZVDlwE HuTQ== Return-Path: Received: from localhost (host86-186-80-236.range86-186.btcentralplus.com. [86.186.80.236]) by smtp.gmail.com with ESMTPSA id s1sm27280923wmc.23.2020.01.07.03.52.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jan 2020 03:52:30 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Tom Tromey , Hannes Domani , Andrew Burgess Subject: [PATCH 6/6] gdb/tui: Link source and assembler scrolling .... again Date: Tue, 7 Jan 2020 11:52:19 +0000 Message-Id: <1a149112fcd452da8d704ae67a8e98ec88d68ef3.1578397591.git.andrew.burgess@embecosm.com> In-Reply-To: References: In-Reply-To: References: <874kxrc3ha.fsf@tromey.com> X-IsSubscribed: yes Until recently when the source window was scrolled the assembler window would scroll in sync - keeping the disassembly for the current line in view. This was broken in commit: commit b4b49dcbff6b437fa8b4e2fc0c3f27b457f11310 Date: Wed Nov 13 16:47:58 2019 -0700 Don't call tui_show_source from tui_ui_out This commit restores the synchronised scrolling and also maintains the horizontal scroll within the source view when it is vertically scrolled, something that was broken before. This commit does not mean that scrolling the assembler view scrolls the source view. The connection this way never existed, though maybe it should, but I'll leave adding this feature for a separate commit. gdb/ChangeLog: * tui/tui-source.c (tui_source_window::do_scroll_vertical): Update all source windows, and maintain horizontal scroll status while doing so. gdb/testsuite/ChangeLog: * gdb.tui/basic.exp: Add more scrolling tests. Change-Id: I250114a3bc670040a6a759d41905776771b2f818 --- gdb/ChangeLog | 6 ++++++ gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.tui/basic.exp | 27 +++++++++++++++++++++++++++ gdb/tui/tui-source.c | 4 +++- 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.tui/basic.exp b/gdb/testsuite/gdb.tui/basic.exp index be822f8a915..34e60384c4e 100644 --- a/gdb/testsuite/gdb.tui/basic.exp +++ b/gdb/testsuite/gdb.tui/basic.exp @@ -48,6 +48,33 @@ if {[Term::wait_for [string_to_regexp $line]] \ fail "scroll up" } +# Check the horizontal scrolling. First confirm that 'main ()' is +# where we expect it to be. This relies on the current way we +# position source code on the screen, which might change in the +# future. The important part of this test is detecting the left/right +# scrolling, not which line main is actually on. +set line_num 6 +set line [Term::get_line $line_num] +gdb_assert {[regexp -- "19\[\\t \]+main \\(\\)" $line]} \ + "check main is where we expect on the screen" +set regexp "19\[\\t \]+ain \\(\\)" +# Send a right arrow. +send_gdb "\033\[C" +if {[Term::wait_for $regexp]} { + pass "scroll right" +} else { + fail "scroll right" +} +set line [Term::get_line $line_num] +# Send a down arrow. +send_gdb "\033\[B" +if {[Term::wait_for $regexp] \ + && [Term::get_line [expr {$line_num - 1}]] == $line} { + pass "scroll down" +} else { + fail "scroll down" +} + Term::check_box "source box" 0 0 80 15 Term::command "layout asm" diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 13f2dc7cfe1..912eaa45440 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -158,7 +158,9 @@ tui_source_window::do_scroll_vertical (int num_to_scroll) line_no = 1; cursal.line = line_no; - update_source_window (arch, cursal); + find_line_pc (cursal.symtab, cursal.line, &cursal.pc); + for (struct tui_source_window_base *win_info : tui_source_windows ()) + win_info->update_source_window_as_is (arch, cursal); } }