Re: Breakpoint commands in MI mode and "backtrace"

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
> From: Simon Marchi <[email protected]>
> 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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.