+2019-12-20 Tom Tromey <tom@tromey.com>
+
+ * tui/tui.c (tui_show_source): Update.
+ * tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
+ * tui/tui-winsource.c (tui_update_source_windows_with_line): Take
+ a symtab_symbol_info, not a separate symtab and line. Simplify.
+
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_addr):
win_info->update_source_window (gdbarch, sal);
}
-/* Function to ensure that the source and/or disassemly windows
- reflect the input address. */
+/* Function to ensure that the source and/or disassembly windows
+ reflect the symtab and line. */
void
-tui_update_source_windows_with_line (struct symtab *s, int line)
+tui_update_source_windows_with_line (struct symtab_and_line sal)
{
- struct gdbarch *gdbarch;
- CORE_ADDR pc;
- struct symtab_and_line sal;
-
- if (!s)
+ if (!sal.symtab)
return;
- sal.pspace = current_program_space;
- sal.symtab = s;
- sal.line = line;
-
- gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
+ find_line_pc (sal.symtab, sal.line, &sal.pc);
+ struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
- switch (tui_current_layout ())
- {
- case DISASSEM_COMMAND:
- case DISASSEM_DATA_COMMAND:
- find_line_pc (s, line, &pc);
- tui_update_source_windows_with_addr (gdbarch, pc);
- break;
- default:
- find_line_pc (s, line, &pc);
- sal.pc = pc;
- TUI_SRC_WIN->update_source_window (gdbarch, sal);
- if (tui_current_layout () == SRC_DISASSEM_COMMAND)
- TUI_DISASM_WIN->update_source_window (gdbarch, sal);
- break;
- }
+ for (struct tui_source_window_base *win_info : tui_source_windows ())
+ win_info->update_source_window (gdbarch, sal);
}
void
/* Function to display the "main" routine. */
extern void tui_display_main (void);
extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
-extern void tui_update_source_windows_with_line (struct symtab *,
- int);
+extern void tui_update_source_windows_with_line (struct symtab_and_line sal);
/* Extract some source text from PTR. LINE_NO is the line number. If
it is positive, it is printed at the start of the line. FIRST_COL
/* Make sure that the source window is displayed. */
tui_add_win_to_layout (SRC_WIN);
- tui_update_source_windows_with_line (cursal.symtab, cursal.line);
+ tui_update_source_windows_with_line (cursal);
tui_update_locator_fullname (cursal.symtab);
}