[Dwarf-Discuss] DW_TAG_enumeration with DW_AT_type and DW_AT_byte_size

Mark Wielaard mjw at redhat.com
Thu Mar 27 04:02:38 PDT 2014


Hi,

Thanks for all the comments. Based on the discussion I think it is clear
that the intention is indeed that the size to hold the enumeration may
also be given by the underlying type if not given by an explicit
DW_AT_byte_size. But various consumers might not yet handle that
correctly at the moment. So I will not suggest dropping the
DW_AT_byte_size in GCC when there is an underlying type for the
enumeration with a size until GCC starts generating DWARF5 (and if the
clarification has been accepted).

I submitted the following clarification through
http://dwarfstd.org/Comment.php which doesn't have an issue number yet:

Subject:  Clarify DW_AT_byte_size usage with DW_TAG_enumeration
Name:  Mark Wielaard
Email:  mjw at redhat.com
Section:  5.7  Page:  96
Type:  Clarification

As discussed on the dwarf mailinglist in the "DW_TAG_enumeration with
DW_AT_type and DW_AT_byte_size" thread:
http://thread.gmane.org/gmane.comp.standards.dwarf/102 If the
DW_TAG_enumeration has a DW_AT_type to indicate the underlying base type
of this enumeration, and that type has a size itself, then the
DW_AT_byte_size is optional. This is not immediately clear from the text
of the standard and some consumers might not realize that they can get
the size of the enumeration from its underlying type if DW_AT_byte_size
isn't given. The following clarification is suggested: In 5.7
Enumeration Type Entries. Move the last sentence of the third paragraph
reading "This entry also has a DW_AT_byte_size attribute whose integer
constant value is the number of bytes required to hold an instance of
the enumeration." to the end of the next paragraph "The enumeration type
entry may have a DW_AT_type attribute which refers to the underlying
data type used to implement the enumeration." Rephrase it a little to
indicate it is optional. And add a sentence that explains the size may
also be gotten from the underlying type. So that the fourth paragraph
would read: "The enumeration type entry may have a DW_AT_type attribute
which refers to the underlying data type used to implement the
enumeration. The entry also may have a DW_AT_byte_size attribute whose
integer constant value is the number of bytes required to hold an
instance of the enumeration. If no DW_AT_byte_size attribute is given
the size for holding an instance of the enumeration is given by the size
of the DW_AT_type underlying data type."

Cheers,

Mark




More information about the Dwarf-Discuss mailing list