static void mi_new_thread (struct thread_info *t);
static void mi_thread_exit (struct thread_info *t, int silent);
-static void mi_record_changed (struct inferior*, int);
+static void mi_record_changed (struct inferior*, int, const char *,
+ const char *);
static void mi_inferior_added (struct inferior *inf);
static void mi_inferior_appeared (struct inferior *inf);
static void mi_inferior_exit (struct inferior *inf);
mi_interpreter_resume (void *data)
{
struct mi_interp *mi = (struct mi_interp *) data;
+ struct ui *ui = current_ui;
/* As per hack note in mi_interpreter_init, swap in the output
channels... */
/* These overwrite some of the initialization done in
_intialize_event_loop. */
- call_readline = gdb_readline_no_editing_callback;
- input_handler = mi_execute_command_input_handler;
+ ui->call_readline = gdb_readline_no_editing_callback;
+ ui->input_handler = mi_execute_command_input_handler;
async_command_editing_p = 0;
/* FIXME: This is a total hack for now. PB's use of the MI
implicitly relies on a bug in the async support which allows
error (_("-interpreter-exec: "
"Usage: -interpreter-exec interp command"));
- interp_to_use = interp_lookup (argv[0]);
+ interp_to_use = interp_lookup (current_ui, argv[0]);
if (interp_to_use == NULL)
error (_("-interpreter-exec: could not find interpreter \"%s\""),
argv[0]);
/* Emit notification on changing the state of record. */
static void
-mi_record_changed (struct inferior *inferior, int started)
+mi_record_changed (struct inferior *inferior, int started, const char *method,
+ const char *format)
{
struct mi_interp *mi = (struct mi_interp *) top_level_interpreter_data ();
struct cleanup *old_chain;
old_chain = make_cleanup_restore_target_terminal ();
target_terminal_ours_for_output ();
- fprintf_unfiltered (mi->event_channel, "record-%s,thread-group=\"i%d\"",
- started ? "started" : "stopped", inferior->num);
+ if (started)
+ {
+ if (format != NULL)
+ {
+ fprintf_unfiltered (
+ mi->event_channel,
+ "record-started,thread-group=\"i%d\",method=\"%s\",format=\"%s\"",
+ inferior->num, method, format);
+ }
+ else
+ {
+ fprintf_unfiltered (
+ mi->event_channel,
+ "record-started,thread-group=\"i%d\",method=\"%s\"",
+ inferior->num, method);
+ }
+ }
+ else
+ {
+ fprintf_unfiltered (mi->event_channel,
+ "record-stopped,thread-group=\"i%d\"", inferior->num);
+ }
+
gdb_flush (mi->event_channel);
for MI3, and may be removed even earlier. SYNC_EXECUTION is
checked here because we only need to emit a prompt if a
synchronous command was issued when the target is async. */
- if (!target_is_async_p () || sync_execution)
+ if (!target_can_async_p () || sync_execution)
fputs_unfiltered ("(gdb) \n", raw_stdout);
}
gdb_flush (raw_stdout);
return 1;
}
+/* The MI interpreter's vtable. */
+
+static const struct interp_procs mi_interp_procs =
+{
+ mi_interpreter_init, /* init_proc */
+ mi_interpreter_resume, /* resume_proc */
+ mi_interpreter_suspend, /* suspend_proc */
+ mi_interpreter_exec, /* exec_proc */
+ mi_ui_out, /* ui_out_proc */
+ mi_set_logging, /* set_logging_proc */
+ mi_command_loop /* command_loop_proc */
+};
+
+/* Factory for MI interpreters. */
+
+static struct interp *
+mi_interp_factory (const char *name)
+{
+ return interp_new (name, &mi_interp_procs, NULL);
+}
+
extern initialize_file_ftype _initialize_mi_interp; /* -Wmissing-prototypes */
void
_initialize_mi_interp (void)
{
- static const struct interp_procs procs =
- {
- mi_interpreter_init, /* init_proc */
- mi_interpreter_resume, /* resume_proc */
- mi_interpreter_suspend, /* suspend_proc */
- mi_interpreter_exec, /* exec_proc */
- mi_ui_out, /* ui_out_proc */
- mi_set_logging, /* set_logging_proc */
- mi_command_loop /* command_loop_proc */
- };
-
/* The various interpreter levels. */
- interp_add (interp_new (INTERP_MI1, &procs));
- interp_add (interp_new (INTERP_MI2, &procs));
- interp_add (interp_new (INTERP_MI3, &procs));
- interp_add (interp_new (INTERP_MI, &procs));
+ interp_factory_register (INTERP_MI1, mi_interp_factory);
+ interp_factory_register (INTERP_MI2, mi_interp_factory);
+ interp_factory_register (INTERP_MI3, mi_interp_factory);
+ interp_factory_register (INTERP_MI, mi_interp_factory);
}