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

Tom de Vries tdevries@suse.de
Thu Oct 3 13:51:00 GMT 2019


On 03-10-19 14:10, Pedro Alves wrote:
> 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?

Yep, that works as well. Patch updated accordingly and re-tested.

OK for trunk?

Thanks,
- Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-gdb-Only-force-INTERP_CONSOLE-ui_out-for-breakpoint-commands-in-MI-mode.patch
Type: text/x-patch
Size: 5451 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20191003/36983867/attachment.bin>


More information about the Gdb-patches mailing list