DWARF Standard


HOME
SPECIFICATIONS
FAQ
ISSUES



130402.1 Jason Merrill Use DW_AT_default_value to indicate C++ default template arguments Enhancement Accepted Jason Merrill


Section 3.3.7, 5.5.8, 5.15, pg 
The GDB team asked for a way to distinguish whether a particular template argument was explicitly 
provided by the user or gotten from a default template argument, as in

template <typename T, typename U = T*>
struct A;

A<int>* p;

Here, A<int> is equivalent to A<int,int*>, but the debugger would like to be able to display it
as A<int> based on the information that the U parameter was defaulted.

Since we already have an attribute named DW_AT_default_value, I propose to allow it as a flag
on DW_TAG_template_*_parameter.  That is different from its current use as a reference, but that 
seems reasonable given that the template parameter TAGs specify their own values.


Editorial changes:
-----------------

Section 5.5.8:

At the end of item 1, add 
  The entry may also have a DW_AT_default_value attribute, which is a flag indicating 
  that the type corresponds to the default argument for the template parameter.

In item 2, replace "Finally, the template value ... target architecture" with the following:
  In addition, the template value parameter entry has a DW_AT_const_value attribute, 
  whose value is the actual constant value of the value parameter for this instantiation 
  as represented on the target architecture.  The entry may also have a DW_AT_default_value 
  attribute, which is a flag indicating that the constant value corresponds to the default 
  argument for the template parameter.

Parallel changes to 3.3.7 and 5.15.

Add DW_AT_default_value to the possible attributes for DW_TAG_template_*_parameter in appendix A.

Add flag to the possible encodings of DW_AT_default_value in 7.5.4, figure 20.


---
7/23/2013 -- Accepted
Editorial changes added 8/20/13.


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.