[Dwarf-Discuss] DW_TAG_enumeration with DW_AT_type and DW_AT_byte_size

Mark Wielaard mjw@redhat.com
Wed Mar 26 11:53:31 GMT 2014


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.



More information about the Dwarf-discuss mailing list