This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: enum pretty-printing support


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]