This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: enum pretty-printing support
- From: Pedro Alves <alves dot ped at gmail dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 10 Jan 2012 20:26:25 +0000
- Subject: Re: RFC: enum pretty-printing support
- References: <m3r4z7gwow.fsf@fleche.redhat.com>
On 01/10/2012 07:54 PM, Tom Tromey wrote:
> I'd appreciate comments on this patch.
>
> This adds a new helper class to gdb.printing to handle printing of enum
> values which are or'd together. E.g.:
>
> print (enum flag_enum) (FLAG_1 | FLAG_3)
> $8 = 0x5 [FLAG_1 | FLAG_3]
I think this is great.
On 01/10/2012 07:54 PM, Tom Tromey wrote:
> +@item EnumerationPrinter (@var{name})
> +A pretty-printer which handles printing of @code{enum} values. Unlike
> +@value{GDBN}'s built-in @code{enum} printing, this printer handles the
> +case where enumerators are or'd together to create a value.
> +@var{name} is the name of the printer and also the name of the
> +@code{enum} type to look up.
Is the intention to have this printer do more than work
with flag enums? Otherwise, I'd suggest naming it FlagEnumerationPrinter
(or some such).
--
Pedro Alves