binutils-gdb/gdb/tui
Tom Tromey cb44333d99 Add file offsets to the source cache
Currently, gdb stores the number of lines and an array of file offsets
for the start of each line in struct symtab.  This patch moves this
information to the source cache.  This has two benefits.

First, it allows gdb to read a source file less frequently.
Currently, a source file may be read multiple times: once when
computing the file offsets, once when highlighting, and then pieces
may be read again while printing source lines.  With this change, the
file is read once for its source text and file offsets; and then
perhaps read again if it is evicted from the cache.

Second, if multiple symtabs cover the same source file, then this will
share the file offsets between them.  I'm not sure whether this
happens in practice.

gdb/ChangeLog
2019-08-06  Tom Tromey  <tromey@adacore.com>

	* annotate.c (annotate_source_line): Use g_source_cache.
	* source-cache.c (source_cache::get_plain_source_lines): Change
	parameters.  Populate m_offset_cache.
	(source_cache::ensure): New method.
	(source_cache::get_line_charpos): New method.
	(extract_lines): Move lower.  Change parameters.
	(source_cache::get_source_lines): Move lower.
	* source-cache.h (class source_cache): Update comment.
	<get_line_charpos>: New method.
	<get_source_lines>: Update comment.
	<clear>: Clear m_offset_cache.
	<get_plain_source_lines>: Change parameters.
	<ensure>: New method
	<m_offset_cache>: New member.
	* source.c (forget_cached_source_info_for_objfile): Update.
	(info_source_command): Use g_source_cache.
	(find_source_lines, open_source_file_with_line_charpos): Remove.
	(print_source_lines_base, search_command_helper): Use g_source_cache.
	* source.h (open_source_file_with_line_charpos): Don't declare.
	* symtab.h (struct symtab) <nlines, line_charpos>: Remove.
	* tui/tui-source.c (tui_source_window::do_scroll_vertical):
	Use g_source_cache.
2019-08-06 08:04:33 -06:00
..
ChangeLog-1998-2003
tui-command.c Move TUI command window code 2019-07-17 12:19:22 -06:00
tui-command.h Move TUI command window code 2019-07-17 12:19:22 -06:00
tui-data.c Move source window common to code to tui-winsource.[ch] 2019-07-17 12:19:25 -06:00
tui-data.h Move source window common to code to tui-winsource.[ch] 2019-07-17 12:19:25 -06:00
tui-disasm.c Remove unnecessary "return"s 2019-07-17 12:19:26 -06:00
tui-disasm.h Move source window common to code to tui-winsource.[ch] 2019-07-17 12:19:25 -06:00
tui-file.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
tui-file.h Normalize include guards in gdb 2019-02-07 03:27:23 -07:00
tui-hooks.c Rearrange TUI data window code 2019-07-17 12:19:21 -06:00
tui-hooks.h Normalize include guards in gdb 2019-02-07 03:27:23 -07:00
tui-interp.c Move interpreter_p declaration to main.h 2019-05-08 10:38:02 -06:00
tui-io.c Move tui_dispatch_ctrl_char to tui-io.c 2019-07-17 12:19:22 -06:00
tui-io.h Improve/fix the TUI's current source line highlight 2019-03-18 14:26:00 +00:00
tui-layout.c Move tui_source_window to tui-source.h 2019-07-17 12:19:24 -06:00
tui-layout.h Change tui_set_layout to return void 2019-07-17 12:19:15 -06:00
tui-out.c Rename field_int to field_signed 2019-07-17 10:34:05 -06:00
tui-out.h Rename field_int to field_signed 2019-07-17 10:34:05 -06:00
tui-regs.c Move TUI data item window to tui-regs.h 2019-07-17 12:19:23 -06:00
tui-regs.h Move TUI data item window to tui-regs.h 2019-07-17 12:19:23 -06:00
tui-source.c Add file offsets to the source cache 2019-08-06 08:04:33 -06:00
tui-source.h Move source window common to code to tui-winsource.[ch] 2019-07-17 12:19:25 -06:00
tui-stack.c Remove unused parameter from two TUI functions 2019-07-17 12:19:07 -06:00
tui-stack.h Normalize include guards in gdb 2019-02-07 03:27:23 -07:00
tui-win.c Remove self-assign from make_invisible_and_set_new_height 2019-07-22 08:34:25 -06:00
tui-win.h Introduce methods for scrolling 2019-06-25 07:48:28 -06:00
tui-wingeneral.c Remove unnecessary "return"s 2019-07-17 12:19:26 -06:00
tui-wingeneral.h Don't declare tui_copy_win or tui_box_win 2019-07-30 16:19:59 -06:00
tui-winsource.c Remove unnecessary "return"s 2019-07-17 12:19:26 -06:00
tui-winsource.h Move source window common to code to tui-winsource.[ch] 2019-07-17 12:19:25 -06:00
tui.c Remove unnecessary "return"s 2019-07-17 12:19:26 -06:00
tui.h Clean up tui_layout_command 2019-07-17 12:19:15 -06:00