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: [RFA/doco] Fix gdb.Field attributes documentation for enum types.


> >  @table @code
> >  @item bitpos
> >  This attribute is not available for @code{enum} or @code{static}
> > -(as in C@t{++} or Java) fields.  The value is the bit position of
> > -the field.
> > +(as in C@t{++} or Java) fields.  The value is the position, counting
> > +in bits, from the start of the containing type.
> 
> Thanks, this is clear.

Thanks. I just pushed the commit.

> I'm curious: why are the bit units useful?  Field offsets are
> generally counted in bytes, not bits.

It's normally true that fields are byte-aligned. But the containing
structures can also be packed, in which case the fields no longer
start at byte offsets. You need bit-precision to determine their
location. Some example in the GDB code bases are, I think, struct
symbol, where some of the fields are packed together to fit within
the same word, without regard to byte boundaries (avoiding unused
"holes").

-- 
Joel


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