This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: enum pretty-printing support
Jan> There is the obvious question this may work automatically if all
Jan> the values of enum type are in the form 2^n and fall back to the
Jan> GDB default way otherwise.
Tom> Yeah, that might be nicer.
Tom> I will look into it.
I think the basic code is pretty easy to write.
I have it written, but I can't test it until tomorrow.
I do wonder whether we still want the Python code.
My C implementation works by checking whether the enum values are
disjoint. However, it is not uncommon to see things like:
enum flags {
ONE = 1,
TWO = 2,
HIGHEST = TWO
};
or
enum flags {
ONE = 1,
TWO = 2,
ALL = ONE | TWO
};
... but the Python code would acceptably handle both of these. This was
ok for the Python approach because registration is explicit, not
implicit; I think the C code has to be a bit more careful because it
cannot readily be turned off.
One idea is to have both.
Tom