[Dwarf-Discuss] DW_TAG_enumeration with DW_AT_type and DW_AT_byte_size

Ron Brender ron.brender at gmail.com
Wed Mar 26 06:41:24 PDT 2014


It is my recollection that in DWARF the size attributes on enumeration
types are intended to be optional in the presence of a type attribute which
itself has a size. That is, the "may" is deliberate.

Ada in particular defines enumeration types in a way such that they have,
in effect, a definite underlying base integer type. This affects some
details of type conversion between integer and enumeration types as well as
allocation in composite types.

Subtypes of an enumeration type (representable as subrange types in DWARF)
can be given yet a different size--but I think that goes beyond the
discussion here.

In any case, my involvement and practice of Ada is decades old so I hope I
am not confusing matters. But I do suggest soliciting the advise of a
current Ada person for better insight.

Ron Brender
(former Ada Distinguished Reviewer and standards committee member)



On Wed, Mar 26, 2014 at 9:21 AM, John DelSignore <
John.DelSignore at roguewave.com> wrote:

> 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
> >
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20140326/2817a857/attachment-0002.htm>


More information about the Dwarf-Discuss mailing list