I) Introduction

G++ now emits DWARF representing template parameters and arguments.

To that end, it follows the DWARF3 specification, especially
chapters 3.3.7 (Function Template Instantiations) and 5.6.8 (Class Template

That document specifies how to generate debug information entries for three
kinds of template parameters and arguments: type, non-type and
constant parameters template parameters as well as their matching arguments.

II) Representation of template template parameters

There is however a fourth kind of template parameter that is not specified by
that document: template template parameters. A template template parameter is
a template parameter that is itself a template.

A GNU extension was therefore added to represent that last kind of template

Each template template parameter appearing in the template definition is
represented by a DIE with the tag DW_TAG_GNU_template_template_param. Each
such entry shall have a DW_AT_name attribute whose value is a null-terminated
string containing the name of the template template parameter as it appears in
the source program. The DIE shall also have a DW_AT_GNU_template_name attribute
whose value is a null-terminated string containing the name of the actual template
by which the template template parameter is replaced for this instantiation.

The DW_TAG_GNU_template_template_param tag is encoded into the hexadecimal
value 0x4106. The DW_AT_GNU_template_name attribute is encoded into the hexadecimal
value 0x2110.

III) Name of template parameter packs

When a variadic template is intantiated, its template parameter packs and
matching arguments are represented following the rules of the proposal at
http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates .

Since that proposal is not yet integrated in any DWARF standard, the relevant DIEs are
named DW_TAG_GNU_template_parameter_pack and DW_TAG_GNU_formal_parameter_pack, instead of
DW_TAG_template_parameter_pack and DW_TAG_formal_parameter_pack.

The hexadecimal encoding of the tags of those DIEs are the following:
 * DW_TAG_GNU_template_parameter_pack: 0x4107
 * DW_TAG_GNU_formal_parameter_pack: 0x4108

None: TemplateParmsDwarf (last edited 2011-12-13 18:57:02 by JasonMerrill)