#include "inferior.h"
#include "infrun.h"
#include "top.h"
+#include "source.h"
+#include "objfiles.h"
+#include "source-cache.h"
\f
/* Prototypes for local functions. */
&& (!breakpoints_invalid_emitted
|| current_ui->prompt_state != PROMPT_BLOCKED))
{
- /* If the inferior owns the terminal (e.g., we're resuming),
- make sure to leave with the inferior still owning it. */
- int was_inferior = target_terminal::is_inferior ();
-
+ target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
printf_unfiltered (("\n\032\032breakpoints-invalid\n"));
-
- if (was_inferior)
- target_terminal::inferior ();
-
breakpoints_invalid_emitted = 1;
}
}
&& (!frames_invalid_emitted
|| current_ui->prompt_state != PROMPT_BLOCKED))
{
- /* If the inferior owns the terminal (e.g., we're resuming),
- make sure to leave with the inferior still owning it. */
- int was_inferior = target_terminal::is_inferior ();
-
+ target_terminal::scoped_restore_terminal_state term_state;
target_terminal::ours_for_output ();
printf_unfiltered (("\n\032\032frames-invalid\n"));
-
- if (was_inferior)
- target_terminal::inferior ();
-
frames_invalid_emitted = 1;
}
}
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)
{
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)
{