summaryrefslogtreecommitdiff
path: root/gdb/source-cache.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-07-23 08:22:50 -0600
committerTom Tromey <tromey@adacore.com>2019-08-06 08:04:33 -0600
commit269249d9406096dd59aecd8845e960fdddb1ebfe (patch)
tree8a74c5a0650640b8a702853502b3bda2be844f55 /gdb/source-cache.h
parentc0e8dcd87101119806c5bbca4c7b649c1b8c0996 (diff)
downloadbinutils-gdb-269249d9406096dd59aecd8845e960fdddb1ebfe.tar.gz
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.
Diffstat (limited to 'gdb/source-cache.h')
-rw-r--r--gdb/source-cache.h6
1 files changed, 0 insertions, 6 deletions
diff --git a/gdb/source-cache.h b/gdb/source-cache.h
index e2e25a170fd..a00efbf3fba 100644
--- a/gdb/source-cache.h
+++ b/gdb/source-cache.h
@@ -63,12 +63,6 @@ private:
are as for get_source_lines. */
bool get_plain_source_lines (struct symtab *s, int first_line,
int last_line, std::string *lines_out);
- /* A helper function for get_plain_source_lines that extracts the
- desired source lines from TEXT, putting them into LINES_OUT. The
- arguments are as for get_source_lines. The return value is the
- desired lines. */
- std::string extract_lines (const struct source_text &text, int first_line,
- int last_line);
/* The contents of the cache. */
std::vector<source_text> m_source_map;