Re: [PATCH] Fix GDB build when using --disable-gdbmi

Simon Marchi
2019-05-10T18:57:40Z

On 2019-05-10 2:47 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
>
> Simon> To fix it, I added a config.h macro, HAVE_GDBMI, defined if we build
> Simon> with GDB/MI support. We can then use it in breakpoint.c to
> Simon> conditionally use mi_multi_location_breakpoint_output_fixed. If
> Simon> building without GDB/MI, the value of use_fixed_output is not really
> Simon> important, as it is only used to fix an issue when printing breakpoints
> Simon> in MI.
>
> I'm not sure if it's better or not, but ui_out has a "flags" feature
> that could be applied to this. This would mean not having to have a #if.

I don't think this will work (or I don't understand what you suggest).

If we do

bool use_fixed_output = ui_out->test_flags(ui_out_flag::fixed_breakpoint_output);

That would require the mi_ui_out object to be created with that flag. However,
this option can be toggled on after the mi_ui_out object has been created (through
the MI command -fix-multi-location-breakpoint-output).

One way to make it work would be, when the -fix-multi-location-breakpoint-output
command is issued, we go through all existing ui_out objects and set that flag.
But I don't think there's an easy way of going through all existing ui_out objects.

If you have any ideas for a more elegant way to make it work, I would be up for it,
because it's true that sprinkling #ifdefs is not the best idea.

Simon