||DW_TAG_refine_type add additional attributes to type
Section 5 - TYPE ENTRIES, pg 104
Applicable to Section 5 - TYPE ENTRIES
(The next logical subsection is 5.16 - Type Refining Entries)
Adding DW_TAG_refine_type to provide additional attributes to a type without having its base
type characteristics duplicated.
Some languages, such as Fortran, provide types whose values may be dynamically allocated or
associated with a variable under explicit program control. Currently, these attributes, such
as DW_AT_allocated and DW_AT_associated are placed on the type DIE. This approach forces
creation of duplicate types for a single Fortran type.
Consider this Fortran example:
type :: dt (l)
integer, len :: l
integer :: arr(l)
integer :: n = 4
type (dt(n)) :: t1
type (dt(n)), pointer :: t2
type (dt(n)), allocatable :: t3
t1, t2 and t3 all share the same type 'dt'. The current DWARF spec places all
descriptor related attributes (DW_AT_data_location, DW_AT_associated and DW_AT_allocated)
on the DW_TAG_structure_type DIE for 'dt'. Doing so would mean we have to generate 3
different DW_TAG_structure_type DIEs to describe this program.
If we place the descriptor related attributes on the variable, then the descriptor
related attributes would have to be duplicated for each variable of the same type. i.e.
type (dt(n)), allocatable :: t3, t4
would result in both t3 and t4 having the same dynamic type attributes.
New subsection to Section 5, tentatively: 5.16 "Type Refining Entries"
Some type attributes are tied more closely to the variable than the type itself. For
example, Fortran dynamic type properties (i.e. DW_AT_allocated and DW_AT_associated)
can be different for each variable of the same type. In such cases, the dynamic type
properties can be attached to a type refining entry.
A type refining entry is represented by a debugging information entry with the tag
DW_TAG_refine_type. The type refining entry has a DW_AT_type attribute to describe
the type of object, whose additional attributes applies to. Any other attributes
and/or children debugging information entries on the type refining entry would
behave identically as if the attributes and/or children DIEs are attached to the
referencing type entry.
The new DWARF for the example program would look like:
$12: DW_TAG_member ...
$13: DW_TAG_refine_type ! plain version
DW_AT_associated (...) ! 'pointer'
DW_AT_allocated (...) ! 'allocatable'
This issue was withdrawn and replaced by 130318.1.