ubsan: nds32: left shift cannot be represented in type 'int'
[deliverable/binutils-gdb.git] / gdb / annotate.c
index 84940ff031a7f001f089858406f9adc9f081e249..3011b26eb58109cd461dbce6279ac55939fb0257 100644 (file)
@@ -26,6 +26,9 @@
 #include "inferior.h"
 #include "infrun.h"
 #include "top.h"
+#include "source.h"
+#include "objfiles.h"
+#include "source-cache.h"
 \f
 
 /* Prototypes for local functions.  */
@@ -417,7 +420,7 @@ annotate_arg_end (void)
     printf_filtered (("\n\032\032arg-end\n"));
 }
 
-void
+static void
 annotate_source (const char *filename, int line, int character, int mid,
                 struct gdbarch *gdbarch, CORE_ADDR pc)
 {
@@ -430,6 +433,29 @@ annotate_source (const char *filename, int line, int character, int mid,
                   mid ? "middle" : "beg", paddress (gdbarch, pc));
 }
 
+/* See annotate.h.  */
+
+void
+annotate_source_line (struct symtab *s, int line, int mid_statement,
+                     CORE_ADDR pc)
+{
+  if (annotation_level > 0)
+    {
+      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 > offsets->size ())
+       return;
+
+      annotate_source (s->fullname, line, (int) (*offsets)[line - 1],
+                      mid_statement, get_objfile_arch (SYMTAB_OBJFILE (s)),
+                      pc);
+    }
+}
+
+
 void
 annotate_frame_begin (int level, struct gdbarch *gdbarch, CORE_ADDR pc)
 {
This page took 0.024458 seconds and 4 git commands to generate.