diff options
Diffstat (limited to 'gdb/annotate.c')
-rw-r--r-- | gdb/annotate.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/annotate.c b/gdb/annotate.c index 8d8a019..3011b26 100644 --- a/gdb/annotate.c +++ b/gdb/annotate.c @@ -28,6 +28,7 @@ #include "top.h" #include "source.h" #include "objfiles.h" +#include "source-cache.h" /* Prototypes for local functions. */ @@ -440,15 +441,15 @@ annotate_source_line (struct symtab *s, int line, int mid_statement, { if (annotation_level > 0) { - if (s->line_charpos == nullptr) - open_source_file_with_line_charpos (s); - if (s->fullname == nullptr) + const std::vector<off_t> *offsets; + if (!g_source_cache.get_line_charpos (s, &offsets)) return; + /* Don't index off the end of the line_charpos array. */ - if (line > s->nlines) + if (line > offsets->size ()) return; - annotate_source (s->fullname, line, s->line_charpos[line - 1], + annotate_source (s->fullname, line, (int) (*offsets)[line - 1], mid_statement, get_objfile_arch (SYMTAB_OBJFILE (s)), pc); } |