summaryrefslogtreecommitdiff
path: root/gdb/tui/tui-source.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-11-12 17:56:42 -0700
committerTom Tromey <tom@tromey.com>2019-12-20 09:15:53 -0700
commit9f7540a5deb07875fb8e75de86857a9cae8bd30a (patch)
tree0e096b931c7d2ee08da1ac95d2cf24245320aa8a /gdb/tui/tui-source.c
parent57e4b379e96383c4c7ee0aa0bb9b81018688f47d (diff)
downloadbinutils-gdb-9f7540a5deb07875fb8e75de86857a9cae8bd30a.tar.gz
Use symtab_and_line when updating TUI windows
This changes a few TUI source window methods to take a symtab_and_line rather than separate symtab and tui_line_or_address parameters. A symtab_and_line already incorporates the same information, so this seemed simpler. Also, it helps avoid the problem that the source and disassembly windows need different information -- both forms are present in the SAL. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents, update_source_window_as_is, update_source_window>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-winsource.c (tui_source_window_base::update_source_window) (tui_source_window_base::update_source_window_as_is): Take a sal, not a separate symtab and tui_line_or_address. (tui_update_source_windows_with_addr) (tui_update_source_windows_with_line) (tui_source_window_base::rerender) (tui_source_window_base::refill): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-source.c (tui_source_window::set_contents): Take a sal, not a separate symtab and tui_line_or_address. (tui_source_window::maybe_update): Update. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Take a sal, not a separate symtab and tui_line_or_address. * tui/tui-disasm.c (tui_disasm_window::set_contents): Take a sal, not a separate symtab and tui_line_or_address. (tui_disasm_window::do_scroll_vertical) (tui_disasm_window::maybe_update): Update. Change-Id: I6974a03589930a0f910c657ef50b7f6f7397c87d
Diffstat (limited to 'gdb/tui/tui-source.c')
-rw-r--r--gdb/tui/tui-source.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 113195da3cb..0728263b8c5 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -42,11 +42,10 @@
/* Function to display source in the source window. */
bool
tui_source_window::set_contents (struct gdbarch *arch,
- struct symtab *s,
- struct tui_line_or_address line_or_addr)
+ const struct symtab_and_line &sal)
{
- gdb_assert (line_or_addr.loa == LOA_LINE);
- int line_no = line_or_addr.u.line_no;
+ struct symtab *s = sal.symtab;
+ int line_no = sal.line;
if (s == NULL)
return false;
@@ -201,14 +200,16 @@ tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal)
bool source_already_displayed = (sal.symtab != 0
&& showing_source_p (m_fullname.get ()));
- struct tui_line_or_address l;
-
- l.loa = LOA_LINE;
- l.u.line_no = start_line;
if (!(source_already_displayed && line_is_displayed (sal.line)))
- update_source_window (get_frame_arch (fi), sal.symtab, l);
+ {
+ sal.line = start_line;
+ update_source_window (get_frame_arch (fi), sal);
+ }
else
{
+ struct tui_line_or_address l;
+
+ l.loa = LOA_LINE;
l.u.line_no = sal.line;
set_is_exec_point_at (l);
}