Re: Breakpoint commands in MI mode and "backtrace"

Eli Zaretskii
2017-10-08T18:27:10Z

> Date: Sun, 8 Oct 2017 13:51:39 -0400
>
> It seems like even though we are executing CLI commands, the current interpreter
> and uiout are the MI ones. I'm always confused by all these data structures, but
> I managed to hack it to work with this:
>
> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index 0a93e8b54f..bc8e1047c5 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -482,7 +482,10 @@ execute_control_command (struct command_line *cmd)
> {
> /* A simple command, execute it and return. */
> std::string new_line = insert_user_defined_cmd_args (cmd->line);
> - execute_command (&new_line[0], 0);
> +
> + scoped_restore_interp restorer (INTERP_CONSOLE);
> + current_interpreter ()->exec (&new_line[0]);
> +
> ret = cmd->control_type;
> break;
> }
>
> Does that work for you? It might not be the right solution, but it's a start.

This doesn't compile when applied to GDB 8.0 code. Can the same be
done with the scoped_restore class instead?

In any case, there are more instances of calls to execute_command in
that function, and I guess they all need to be changed like that?

Thanks.