gdb/tui: Link source and assembler scrolling .... again
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 7 Jan 2020 11:39:17 +0000 (11:39 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 9 Jan 2020 23:11:47 +0000 (23:11 +0000)
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
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.tui/basic.exp
gdb/tui/tui-source.c

index 4c789119cec5576c54f3d3123d6cccbe6e6a7f7e..425bafa9b26a55133a020a31fca8649511490ec3 100644 (file)
@@ -1,3 +1,9 @@
+2020-01-09  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * tui/tui-source.c (tui_source_window::do_scroll_vertical): Update
+       all source windows, and maintain horizontal scroll status while
+       doing so.
+
 2020-01-09  Tom Tromey  <tom@tromey.com>
 
        PR tui/18932:
index 16f3b5503df25157539ac6a8ef898388f5b69e14..536a9649595535c5f60c723f99442c18c48d99b5 100644 (file)
@@ -1,3 +1,7 @@
+2020-01-09  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.tui/basic.exp: Add more scrolling tests.
+
 2020-01-09  Tom Tromey  <tom@tromey.com>
 
        PR tui/18932:
index be822f8a9151baa0fa228c7914b0643083cb6108..34e60384c4ede1fbf235173b97119ccd1daf1422 100644 (file)
@@ -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"
index 13f2dc7cfe177904495e88fe95daad9ee92d0a0b..912eaa4544018b44988a55373149d561500c4fb1 100644 (file)
@@ -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);
     }
 }
 
This page took 0.030653 seconds and 4 git commands to generate.