xcoff slurp_armap bounds checking
[deliverable/binutils-gdb.git] / gdb / annotate.c
index 8d8a0196fb02d32f3021f780625ba7b317750c45..3011b26eb58109cd461dbce6279ac55939fb0257 100644 (file)
@@ -28,6 +28,7 @@
 #include "top.h"
 #include "source.h"
 #include "objfiles.h"
+#include "source-cache.h"
 \f
 
 /* 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);
     }
This page took 0.024906 seconds and 4 git commands to generate.