Re: [PATCH][gdb] Only force INTERP_CONSOLE ui_out for breakpoint commands in MI mode

Pedro Alves
2019-10-03T12:11:05Z

On 10/3/19 11:01 AM, Tom de Vries wrote:
> The problem is that the '#0 main () at test.c:19' ends up in the gdb output
> output rather than in gdb.txt. This is due to the fact that the redirect is
> setup for the current ui_out (which is tui->interp_ui_out ()), while the
> backtrace output is printed to the INTERP_CONSOLE ui_out.
>
> Fix this by limiting switching to INTERP_CONSOLE ui_out to when INTERP_MI is
> active.

> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -697,6 +697,9 @@ execute_control_command_1 (struct command_line *cmd, int from_tty)
> enum command_control_type
> execute_control_command (struct command_line *cmd, int from_tty)
> {
> + if (!current_interp_named_p (INTERP_MI))
> + return execute_control_command_1 (cmd, from_tty);

Wouldn't we need to handle INTERP_MI1/INTERP_MI2/INTERP_MI3 as well?

Would

if (current_uiout->is_mi_like_p ())

instead work?

Thanks,
Pedro Alves