This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Breakpoint commands in MI mode and "backtrace"
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Simon Marchi <simark at simark dot ca>
- Cc: gdb at sourceware dot org
- Date: Sun, 08 Oct 2017 21:26:53 +0300
- Subject: Re: Breakpoint commands in MI mode and "backtrace"
- Authentication-results: sourceware.org; auth=none
- References: <8360bqt0im.fsf@gnu.org> <8a3d7153-7486-032f-aabc-6c3453f96459@simark.ca>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Simon Marchi <simark@simark.ca>
> 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.