ubsan: alpha-coff: signed integer overflow
[deliverable/binutils-gdb.git] / gdb / annotate.c
index 84f8129b22d0f0fbc94e0eda05eac5aeb270d12b..28dd23196fd6014a4a546c0787ecf86b2813b781 100644 (file)
@@ -1,5 +1,5 @@
 /* Annotation routines for GDB.
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -28,6 +28,7 @@
 #include "top.h"
 #include "source.h"
 #include "objfiles.h"
+#include "source-cache.h"
 \f
 
 /* Prototypes for local functions.  */
@@ -434,26 +435,24 @@ annotate_source (const char *filename, int line, int character, int mid,
 
 /* See annotate.h.  */
 
-bool
+void
 annotate_source_line (struct symtab *s, int line, int mid_statement,
                      CORE_ADDR pc)
 {
   if (annotation_level > 0)
     {
-      if (s->line_charpos == nullptr)
-       open_source_file_with_line_charpos (s);
-      if (s->fullname == nullptr)
-       return false;
+      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)
-       return false;
+      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);
-      return true;
     }
-  return false;
 }
 
 
This page took 0.026737 seconds and 4 git commands to generate.