diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index 4fc9c70259c..c8a837bf0f5 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -699,9 +699,14 @@ execute_control_command (struct command_line *cmd, int from_tty) { /* Make sure we use the console uiout. It's possible that we are executing breakpoint commands while running the MI interpreter. */ - interp *console = interp_lookup (current_ui, INTERP_CONSOLE); - scoped_restore save_uiout - = make_scoped_restore (¤t_uiout, console->interp_ui_out ()); + if (current_interp_named_p (INTERP_MI)) + { + interp *console = interp_lookup (current_ui, INTERP_CONSOLE); + scoped_restore save_uiout + = make_scoped_restore (¤t_uiout, console->interp_ui_out ()); + + return execute_control_command_1 (cmd, from_tty); + } return execute_control_command_1 (cmd, from_tty); }