[PR49366] emit loc exprs for C++ non-virtual pmf template value parms
commit9a478fab453a7cb0435a065d389983a90f894e8b
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Aug 2016 07:11:23 +0000 (12 07:11 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Aug 2016 07:11:23 +0000 (12 07:11 +0000)
tree737d04532927f66a28ff5e733a2d7ca27a390589
parent9f6a465f631f8ed4866427c50a89f58298f6f2bc
[PR49366] emit loc exprs for C++ non-virtual pmf template value parms

We used to emit, in debug information, the values bound to pointer to
member function template parameters only when they were NULL or
virtual member functions, because those can be represented with
DW_AT_const_value.

In order to represent the symbolic pointer to member function
constants for non-virtual member functions, we'd need to be able to
emit relocations for part of DW_AT_const_value, which we don't.  The
more viable alternative is to use DW_AT_location to represent such
values, as slated for inclusion in DWARFv5, according to
<URL:http://www.dwarfstd.org/ShowIssue.php?issue=130412.1>.

With this patch, when we can't emit a DW_AT_const_value, we emit each
"member" of the pointer to member function "record" as a
DW_OP_stack_value DW_OP_piece, as long as the referenced member
function is output in the same translation unit, otherwise we'd get
relocations to external symbols, something to avoid in debug sections.

for  gcc/ChangeLog

PR debug/49366
* dwarf2out.c (loc_list_from_tree_1): Expand some CONSTRUCTORs
in DW_OP_pieces, just enough to handle pointers to member
functions.
(gen_remaining_tmpl_value_param_die_attribute): Use a location
expression on DWARFv5 if a constant value doesn't work.

for  gcc/testsuite/ChangeLog

PR debug/49366
* g++.dg/debug/dwarf2/template-params-12.H: New.
* g++.dg/debug/dwarf2/template-params-12f.C: New.
* g++.dg/debug/dwarf2/template-params-12g.C: New.
* g++.dg/debug/dwarf2/template-params-12n.C: New.
* g++.dg/debug/dwarf2/template-params-12s.C: New.
* g++.dg/debug/dwarf2/template-params-12u.C: New.
* g++.dg/debug/dwarf2/template-params-12v.C: New.
* g++.dg/debug/dwarf2/template-params-12w.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239401 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12.H [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12f.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12g.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12n.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12s.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12u.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12v.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/template-params-12w.C [new file with mode: 0644]