Clean up source file error reporting
print_source_lines_base reopens the source file every time that a
source line is to be printed. However, there's no need to do this so
frequently -- it's enough to do it when switching source files, and
otherwise rely on the cache.
The code seems to try to avoid these multiple opens; at a guess I'd
say something just got confused along the way.
This patch fixes the problem by reorganizing the code both to make it
more clear, and to ensure that reopens only occur when the "last
source visited" changes.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source.c (last_source_error): Now bool.
(print_source_lines_base): Make "noprint" bool. Only open
source file when last_source_visited changes.