DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



140227.1 Paul Robinson References to entries within a type unit Enhancement Accepted Cary Coutant


Add the marked text below to Section 2.13.2:

2.13.2 Declarations Completing Non-Defining Declarations

A debugging information entry that represents a declaration that
completes another (earlier) non-defining declaration may have a
DW_AT_specification attribute whose value is a reference to the
debugging information entry representing the non-defining declaration.
A debugging information entry with a DW_AT_specification attribute
does not need to duplicate information provided by the debugging
information entry referenced by that specification attribute.

When the non-defining declaration is contained within a type that has
been placed in a separate type unit (see Section 3.1.4), the
DW_AT_specification attribute cannot refer directly to the entry in
the type unit. Instead, the current compile unit may contain a
"skeleton" declaration of the type, which contains only the relevant
declaration and its ancestors as necessary to provide the context
(including containing types and namespaces). The DW_AT_specification
attribute would then be a reference to the declaration entry within
the skeleton declaration tree. The debugging information entry for the
top-level type in the skeleton tree may contain a DW_AT_signature
attribute whose value is the type signature (see Section 5.7.1).

It is not the case that all attributes of the debugging information
entry referenced by a DW_AT_specification attribute apply to the
referring debugging information entry.

For example, DW_AT_sibling and DW_AT_declaration clearly cannot apply
to a referring entry.

...

Add this additional section to Appendix E, either before or after
E.2.2, "Type Signature Computation Grammar":

E.2.x Declarations Completing Non-Defining Declarations

Consider a compilation unit that contains a definition of the member
function N::A::v() from Figure E.9. A possible representation of the
debug information for this function in the compilation unit is shown
in Figure E.xx.

Figure E.xx: DWARF representation for a completing declaration of a
member of a type unit

  DW_TAG_namespace
      DW_AT_name : "N"
L1:
    DW_TAG_class_type
        DW_AT_name : "A"
        DW_AT_declaration : true
        DW_AT_signature : 0xd6d160f5 5589f6e9
L2:
      DW_TAG_subprogram
          DW_AT_external : 1
          DW_AT_name : "v"
          DW_AT_decl_file : 1
          DW_AT_decl_line : 13
          DW_AT_type : reference to L3
          DW_AT_declaration : 1
        DW_TAG_formal_parameter
            DW_AT_type : reference to L4
            DW_AT_artificial : 1
...
L3:
  DW_TAG_base_type
      DW_AT_byte_size : 4
      DW_AT_encoding : DW_ATE_signed
      DW_AT_name : "int"
...
L4:
  DW_TAG_pointer_type
      DW_AT_type : reference to L1
...
  DW_TAG_subprogram
      DW_AT_specification : reference to L2
      DW_AT_decl_file : 2
      DW_AT_decl_line : 25
      DW_AT_low_pc : ...
      DW_AT_high_pc : ...
    DW_TAG_lexical_block
    ...
...

---
5/8/2104 -- Revised.
5/14/2014 -- Accepted.


All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2017 by DWARF Standards Committee.