Re: Breakpoint commands in MI mode and "backtrace"

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gdb.patches,gmane.comp.gdb.devel
Message-ID <[email protected]>
> Cc: [email protected]
> From: Simon Marchi <[email protected]>
> Date: Mon, 9 Oct 2017 08:02:24 -0400
> 
> Anyhow, can you try this patch here?  It changes the uiout manually instead of
> going through safe_execute_command.

Since this worked for me, in GDB 8.0, can something similar be put in
the current master, so the next GDB release will have this bug fixed?

Thanks.

> diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
> index f1db954a69..b08954132b 100644
> --- a/gdb/cli/cli-script.c
> +++ b/gdb/cli/cli-script.c
> @@ -472,6 +472,8 @@ print_command_trace (const char *cmd)
>    printf_filtered ("%s\n", cmd);
>  }
> 
> +static void restore_interp (void *arg);
> +
>  enum command_control_type
>  execute_control_command (struct command_line *cmd)
>  {
> @@ -491,8 +493,17 @@ 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);
> +
> +	struct interp *old_interp = interp_set_temp (INTERP_CONSOLE);
> +	struct cleanup *old_chain = make_cleanup (restore_interp, old_interp);
> +	scoped_restore save_uiout
> +	  = make_scoped_restore (&current_uiout,
> +		     current_interpreter ()->interp_ui_out ());
> +
>  	execute_command (&new_line[0], 0);
>  	ret = cmd->control_type;
> +
> +	do_cleanups (old_chain);
>  	break;
>        }
> 
> 
>
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.