Fix latent bug in source cache
The source cache was not returning the final \n of the requested range
of lines. This caused regressions with later patches in this series,
so this patch pre-emptively fixes the bug.
This adds a self-test of "extract_lines" to the source cache code. To
make it simpler to test, I changed extract_lines to be a static
function, and changed it's API a bit.
gdb/ChangeLog
2019-08-06 Tom Tromey <tromey@adacore.com>
* source-cache.c (extract_lines): No longer a method.
Changed type of parameter. Include final newline.
(selftests::extract_lines_test): New function.
(_initialize_source_cache): Likewise.
* source-cache.h (class source_cache)
<extract_lines>: Don't declare.