From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>, Hannes Domani <ssbssa@yahoo.de>,
Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH 6/6] gdb/tui: Link source and assembler scrolling .... again
Date: Tue, 07 Jan 2020 11:52:00 -0000 [thread overview]
Message-ID: <1a149112fcd452da8d704ae67a8e98ec88d68ef3.1578397591.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1578397591.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1578397591.git.andrew.burgess@embecosm.com>
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);
}
}
--
2.14.5
next prev parent reply other threads:[~2020-01-07 11:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191221153325.6961-1-ssbssa.ref@yahoo.de>
2019-12-21 15:34 ` [RFC][PATCH] Call tui_before_prompt in do_scroll_vertical Hannes Domani via gdb-patches
2019-12-22 0:58 ` Andrew Burgess
2019-12-22 1:25 ` Hannes Domani via gdb-patches
2019-12-23 0:03 ` Tom Tromey
2019-12-23 0:19 ` Hannes Domani via gdb-patches
2019-12-23 1:23 ` Andrew Burgess
2020-01-07 11:52 ` [PATCH 5/6] gdb: Fix scrolling in TUI Andrew Burgess
2020-01-07 19:36 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 2/6] gdb/testsuite/tui: Split enter_tui into two procs Andrew Burgess
2020-01-07 19:19 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 4/6] gdb/tui: Fix 'layout asm' before the inferior has started Andrew Burgess
2020-01-07 19:31 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 1/6] gdb/testsuite/tui: Always dump_screen when asked Andrew Burgess
2020-01-07 18:54 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 0/6] Vertical scrolling and another small bug fix Andrew Burgess
2020-01-07 19:38 ` Tom Tromey
2020-01-09 23:28 ` Andrew Burgess
2020-01-07 11:52 ` [PATCH 3/6] gdb/testsuite/tui: Introduce check_box_contents Andrew Burgess
2020-01-07 19:30 ` Tom Tromey
2020-01-07 11:52 ` Andrew Burgess [this message]
2020-01-07 19:37 ` [PATCH 6/6] gdb/tui: Link source and assembler scrolling .... again Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1a149112fcd452da8d704ae67a8e98ec88d68ef3.1578397591.git.andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=ssbssa@yahoo.de \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox