[Dwarf-Discuss] DW_TAG_enumeration with DW_AT_type and DW_AT_byte_size

John DelSignore John.DelSignore@roguewave.com
Wed Mar 26 13:21:17 GMT 2014


Hi Mark,

I looked at TotalView's DWARF reader, and omitting DW_AT_byte_size from DW_TAG_enumeration_type would require code changes. TotalView treats enums as self-contained types with a discrete byte length; in other words, enum types are not based on some other kind of type like "int" types. TotalView depends on the DW_AT_byte_size attribute to get the enum's byte length, and the DW_AT_encoding (if present) to determine the enum's signed-ness. It currently ignore any DW_AT_type attribute for enums.

Clearly, TotalView will need to change to accommodate DW_AT_type attributes in enum types, and I think we could also deal with a missing DW_AT_byte_size attribute *if* there is a DW_AT_type attribute that reference a valid type with a byte length.

Cheers, John D.


Mark Wielaard wrote:
> Hi,
> 
> I was adding the underlying type to an enumeration in a DWARF producer
> (GCC) and wanted to drop the DW_AT_byte_size in case we have such an
> underlying DW_AT_type. Since it looks redundant in that case. The
> DW_AT_byte_size of the DW_TAG_enumeration should be equal to the size of
> the underlying type if given. Or am I missing some subtle case were that
> isn't/cannot be so?
> 
> But the language of 5.7 Enumeration Type Entries isn't so clear that can
> be done. Although it says "may have a DW_AT_type attribute", it does
> imply that a DW_AT_byte_size must be given (by not saying "may"): "This
> entry also has a DW_AT_byte_size attribute".
> 
> Am I reading that too strictly? Or should I propose wording to make
> clear that the DW_AT_byte_size is optional if a DW_AT_type has been
> given (and only drop the redundant DW_AT_byte_size for DWARF5+ if such
> wording is accepted)?
> 
> I did check with at least one consumer (libabigail) that dropping the
> DW_AT_byte_size would require some code updates, but they were not
> opposed to just doing that.
> 
> Thanks,
> 
> Mark
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
> 




More information about the Dwarf-discuss mailing list