This is the mail archive of the gdb-patches@sources.redhat.com 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/types: Clean up use of field bitsize


On Sun, Sep 29, 2002 at 09:05:15PM -0400, Daniel Jacobowitz wrote:
> Right now, we have this really disturbing comment:
> 
>      /* Size of this field, in bits, or zero if not packed.
>         For an unpacked field, the field's type's length
>         says how many bytes the field occupies.
>         A value of -1 or -2 indicates a static field;  -1 means the location
>         is specified by the label loc.physname;  -2 means that loc.physaddr
>         specifies the actual address. */
> 
> Think about this for a moment.  While in practice a static member is never
> going to be packed, and in at least C++ can not be a bit-field, that's not
> logically obvious for other languages.  I don't know Ada but I wouldn't be
> surprised if there were some construct which violated this assumption.
> 
> Worse, all sorts of places don't check for negative bitsize at all.  It may
> be that they're all safe - I didn't spend a lot of time working out problem
> cases - but I have my doubts.
> 
> So, since I needed to gain a new field here anyway, and since I have no
> compunctions about shrinking this field a little (packed bitfields of size
> greater than a couple of words are allowed in some languages IIRC (including
> GNU C maybe?  Although they are not allowed in ISO C99), but they're
> definitely dodgy), and since signed bitfields are not portable, I cleaned up
> the construct.  It turned out to be painless except for making sure symbol
> readers initialized it, which was a little tedious.
> 
> This patch:
>   Moves 'artificial' out from 'loc' and makes it a bitfield
>   Creates a 'static_kind' bitfield
>   Makes 'bitsize' into a bitfield
> 
> The goal is to allow more kinds of fields to be marked artificial -
> particularly data members.  After this patch I'll submit the followup to
> mark DW_AT_artificial members as artificial types.
> 
> OK?

It's in.  Now to do the followon for artificial members; this will let
us hide _vptr members in type output if requested.  And probably a set
option to toggle the artificial behavior...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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