+2020-01-09 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.
+
2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
* tui/tui.c (tui_enable): Register tui hooks after calling
+2020-01-09 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.
+
2020-01-09 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.tui/tui-layout-asm.exp: New file.
Term::command "list main"
Term::check_contents "list main" "21 *return 0"
+# Get the first source line.
+set line [Term::get_line 1]
+# Send an up arrow.
+send_gdb "\033\[A"
+# Wait for a redraw and check that the first line changed.
+if {[Term::wait_for [string_to_regexp $line]] \
+ && [Term::get_line 1] != $line\
+ && [Term::get_line 2] == $line} {
+ pass "scroll up"
+} else {
+ fail "scroll up"
+}
+
Term::check_box "source box" 0 0 80 15
Term::command "layout asm"
_clear_lines 0 $_rows
}
- # Accept some output from gdb and update the screen.
- proc _accept {wait_for} {
+ # Accept some output from gdb and update the screen. WAIT_FOR is
+ # a regexp matching the line to wait for. Return 0 on timeout, 1
+ # on success.
+ proc wait_for {wait_for} {
global expect_out
global gdb_prompt
variable _cur_x
timeout {
# Assume a timeout means we somehow missed the
# expected result, and carry on.
- return
+ return 0
}
}
set wait_for $prompt_wait_for
}
}
+
+ return 1
}
# Like ::clean_restart, but ensures that gdb starts in an
# be supplied by this function.
proc command {cmd} {
send_gdb "$cmd\n"
- _accept [string_to_regexp $cmd]
+ wait_for [string_to_regexp $cmd]
}
# Return the text of screen line N, without attributes. Lines are
# Due to the strange column resizing behavior, and because we
# don't care about this intermediate resize, we don't check
# the size here.
- _accept "@@ resize done $_resize_count"
+ wait_for "@@ resize done $_resize_count"
incr _resize_count
# Somehow the number of columns transmitted to gdb is one less
# than what we request from expect. We hide this weird
# details from the caller.
_do_resize $_rows $cols
stty columns [expr {$_cols + 1}] < $gdb_spawn_name
- _accept "@@ resize done $_resize_count, size = ${_cols}x${rows}"
+ wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}"
incr _resize_count
}
}
{
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);
}
}