[Dwarf-discuss] Proposal: Add support for "property" with getter/setter (based on Pascal properties)

Todd Allen Todd.Allen@concurrent-rt.com
Thu Oct 10 16:31:14 GMT 2024


On 9/30/24 11:30, Adrian Prantl via Dwarf-discuss wrote:
> ## Proposed Changes
>
> ### Table 2.1
> add `DW_TAG_property`.
>
> ### 5.7.6 add the following normative text
>
> #### `DW_TAG_property`
>
> Non-normative: Many object-oriented languages like Pascal and Objective-C have properties, which are member functions that syntactically behave like data members of an object. Pascal can also have global properties.
>
> A property is represented by a debugging information entry with the
> tag `DW_TAG_property`. At property entry has a `DW_AT_name` string
> attribute whose value is the property name. A property entry has a
> `DW_AT_type` attribute to denote the type of that property.
>
> A property may have `DW_AT_Accessibility`, `DW_AT_external`, `DW_AT_virtuality`, `DW_AT_start_scope`, `DW_AT_decl_column`, `DW_AT_decl_file` and `DW_AT_decl_line` attributes with the respective semantics described for these attributes for `DW_TAG_member` (see chaper 5.7.6).
>
> A property may have one or several of `DW_TAG_property_getter`, `DW_TAG_property_setter`, or `DW_TAG_property_stored` children to represent the getter and setter (member) functions, or the Pascal-style `stored` accessor for this property. Each of these tags have a `DW_AT_specification` attribute to point to a (member) function declaration. They may also have `DW_TAG_formal_parameter` children that can have `DW_AT_default_value` attributes to declare additional default arguments for when these functions are used as property accessors.
> Some languages can automatically derive accessors for properties from a field in the object. In such cases the `DW_AT_specification` attribute of the accessor entry may point to the `DW_TAG_member` entry of the field that holds the properties underlying storage.

Adrian,

This usage of DW_AT_specification seems very different from other uses 
of DW_AT_specification, where it's indicating that the current DIE is a 
completion of a forward declaration at the referenced DIE.  This usage 
is a bit closer to a "renames", but it isn't even quite that.  I suggest 
not attempting to use DW_AT_specification for this case, and just 
inventing a new attribute.

Todd


More information about the Dwarf-discuss mailing list