static void
display_mi_prompt (struct mi_interp *mi)
{
+ struct ui *ui = current_ui;
+
fputs_unfiltered ("(gdb) \n", mi->raw_stdout);
gdb_flush (mi->raw_stdout);
+ ui->prompt_state = PROMPTED;
}
/* Returns the INTERP's data cast as mi_interp if INTERP is an MI, and
ui->call_readline = gdb_readline_no_editing_callback;
ui->input_handler = mi_execute_command_input_handler;
- /* 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
- asynchronous commands to leak through the commmand loop. The bug
- involves (but is not limited to) the fact that sync_execution was
- erroneously initialized to 0. Duplicate by initializing it thus
- here... */
- sync_execution = 0;
gdb_stdout = mi->out;
/* Route error and log output through the MI. */
mi_execute_command_input_handler (char *cmd)
{
struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
+ struct ui *ui = current_ui;
+
+ ui->prompt_state = PROMPT_NEEDED;
mi_execute_command_wrapper (cmd);
to go back to the event loop and will output the prompt in the
'synchronous_command_done' observer when the target next
stops. */
- if (!sync_execution)
+ if (ui->prompt_state == PROMPT_NEEDED)
display_mi_prompt (mi);
}
if (!running_result_record_printed && mi_proceeded)
{
running_result_record_printed = 1;
- /* This is what gdb used to do historically -- printing prompt even if
- it cannot actually accept any input. This will be surely removed
- 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_can_async_p () || sync_execution)
+ /* This is what gdb used to do historically -- printing prompt
+ even if it cannot actually accept any input. This will be
+ surely removed for MI3, and may be removed even earlier. */
+ if (current_ui->prompt_state == PROMPT_BLOCKED)
fputs_unfiltered ("(gdb) \n", mi->raw_stdout);
}
gdb_flush (mi->raw_stdout);