Re: [RFA] New bitflags type and eflags on i386/x86-64

Daniel Jacobowitz
2002-04-22T15:45:26Z

On Mon, Apr 22, 2002 at 05:15:34PM +0200, Michal Ludvig wrote:
> Hi all,
> I've created a new typecode TYPE_CODE_FLAGS with appropriate functions
> and used it in builtin_type_i386_eflags type. I did this to be able to
> print i386's and x86-64's FLAGS register in a symbolic form, instead of
> printing it in a hexadecimal and decimal notation.
>
> Now it looks like this:
> (gdb) info registers eflags
> eflags 0x747 [ DF IF TF ZF PF CF ]
>
> I've chosen quite a generic way for implementation, so that the others
> could use this for their types as well. For now I'm using this type
> only on x86-64, but using it on i386 should be possible without
> modifications. (BTW Should I do it or the maintainer will?)
>
> Any comments? Can I commit?

First of all, please include ChangeLog entries; it makes patches easier
to digest quickly.

Second, I see that you assume a TYPE_CODE_FLAGS type is the size of a
long. I'm not fond of that. I would prefer if you instead added
support to c-valprint.c for something like Pascal's TYPE_CODE_SET (see
p-valprint.c) and used that. It should be exactly what you're looking
for. Basically, you create an enum describing the bit position (not
mask) for each flag, and then call create_set_type with that type as
the domain_type.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer