[Dwarf-Discuss] [RFC] content of DW_AT_name for template instantiations

Dodji Seketeli dodji@redhat.com
Tue Oct 20 09:15:36 GMT 2009


Now that the current development version of G++ emits
DW_AT_template_*_parameter* DIEs there is work underway to make GDB consume
that debugging information.

It then appeared that the content of the DW_AT_name attribute of a template
instantiation could use some clarifications.

Consider this short c++ code snippet:

template<class T>
struct S {};

S<int> s;

In quite a number of implementations - including G++ - The DW_TAG_class_type
DIE representing S<int> has a DW_AT_name that is set to the template-id string
"S<int>" today.

But then if the DW_TAG_class_type DIE has a DW_TAG_template_type_parameter
child DIE, setting the DW_AT_name attribute of that DW_TAG_class_type DIE to
the template-id "S<int>" becomes redundant. It would strike me as more
orthogonal to just set that attribute to the template name string "S" as
the template parameters part can be synthesised by the debugger from the
DW_TAG_template_type_parameter DIE.

I believe the DWARF specification does not clearly states this.
In the DWARF 4 current draft, neither "2.3.7 Function Template Instantiation" nor
"4.6.8 Class Template Instantiation" precisely states what the DW_AT_name
attribute of the template instantiation should contain.

Thoughts ?


Dodji Seketeli
Red Hat

More information about the Dwarf-discuss mailing list