aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-source.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-12-22 16:52:56 -0700
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-01-09 23:11:46 +0000
commit9ae6bf640dc7c950e6f36097a3d2d760a132a542 (patch)
tree56debc86e8389a30050d484139d13ddb6024240c /gdb/tui/tui-source.c
parentb2efe70cf34e2f3ada8d0def69e53f27a6b71578 (diff)
downloadfsf-binutils-gdb-9ae6bf640dc7c950e6f36097a3d2d760a132a542.zip
fsf-binutils-gdb-9ae6bf640dc7c950e6f36097a3d2d760a132a542.tar.gz
fsf-binutils-gdb-9ae6bf640dc7c950e6f36097a3d2d760a132a542.tar.bz2
gdb: Fix scrolling in TUI
Hannes Domani pointed out that my previous patch to fix the "list" command in the TUI instead broke vertical scrolling. While looking at this, I found that do_scroll_vertical calls print_source_lines, which seems like a very roundabout way to change the source window. This patch removes this oddity and fixes the bug at the same time. I've added a new test case. This is somewhat tricky, because the obvious approach of sending a dummy command after the scroll did not work -- due to how the TUI works, sennding a command causes the scroll to take effect. gdb/ChangeLog 2019-12-22 Tom Tromey <tom@tromey.com> PR tui/18932: * tui/tui-source.c (tui_source_window::do_scroll_vertical): Call update_source_window, not print_source_lines. gdb/testsuite/ChangeLog 2019-12-22 Tom Tromey <tom@tromey.com> PR tui/18932: * lib/tuiterm.exp (Term::wait_for): Rename from _accept. Return a meangingful value. (Term::command, Term::resize): Update. * gdb.tui/basic.exp: Add scrolling test. Change-Id: I9636a7c8a8cade37431c6165ee996a9d556ef1c8
Diffstat (limited to 'gdb/tui/tui-source.c')
-rw-r--r--gdb/tui/tui-source.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 1503cd4..13f2dc7 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -136,26 +136,29 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
{
if (!content.empty ())
{
- struct tui_line_or_address l;
struct symtab *s;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+ struct gdbarch *arch = gdbarch;
if (cursal.symtab == NULL)
- s = find_pc_line_symtab (get_frame_pc (get_selected_frame (NULL)));
+ {
+ struct frame_info *fi = get_selected_frame (NULL);
+ s = find_pc_line_symtab (get_frame_pc (fi));
+ arch = get_frame_arch (fi);
+ }
else
s = cursal.symtab;
- l.loa = LOA_LINE;
- l.u.line_no = start_line_or_addr.u.line_no
- + num_to_scroll;
+ int line_no = start_line_or_addr.u.line_no + num_to_scroll;
const std::vector<off_t> *offsets;
if (g_source_cache.get_line_charpos (s, &offsets)
- && l.u.line_no > offsets->size ())
- l.u.line_no = start_line_or_addr.u.line_no;
- if (l.u.line_no <= 0)
- l.u.line_no = 1;
+ && line_no > offsets->size ())
+ line_no = start_line_or_addr.u.line_no;
+ if (line_no <= 0)
+ line_no = 1;
- print_source_lines (s, l.u.line_no, l.u.line_no + 1, 0);
+ cursal.line = line_no;
+ update_source_window (arch, cursal);
}
}