This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 0/6] Remove some uses of is_mi_like_p
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Mon, 30 Apr 2018 19:36:28 +0100
- Subject: Re: [RFA 0/6] Remove some uses of is_mi_like_p
- References: <20180430140732.21601-1-tom@tromey.com>
On 04/30/2018 03:07 PM, Tom Tromey wrote:
> I think in the long run it would be good to remove
> ui_out::is_mi_like_p. This series removes some unnecessary uses of
> it. This is a mild improvement because it means there will be less
> temptation for people to copy bad examples from the existing code.
The series looks fine to me.
> Relatedly, I had an idea for how to change cli_out so that most
> (perhaps not all -- there are some tricky cases) uses of is_mi_like_p
> could be removed, and also provide new features like user control over
> display and colorizing.
>
> The basic idea is first to realize that table names are fixed by the
> MI spec, and so can be relied on by cli_out. Then, whereever there is
> a sequence involving textual output mixed with ui_out field output,
> the whole sequence could be replaced with a format string that
> references the field names.
I'm not sure what you mean exactly, but I've wished before that
we could write ui-out field output mixed in with plain text with
something like:
ui_out->field_fmt (_("Field 1 is 0x%pF, at 0x%pF\n"),
ui_field_int ("field1", var1),
ui_field_func ("func_name", var2));
That's allow proper i18n, and would allow things like colorizing.
I guess that this is something like what you mean, only you
probably have it more thought through.
Thanks,
Pedro Alves