From 8d8a3bda40b0fa5aeb801287f0e2e79affe26c54 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Tue, 31 May 2011 12:17:21 +0000 Subject: [PATCH] re PR debug/49047 (DW_AT_linkage_name missing for constructors and destructors) Fix PR debug/49047 gcc/ * dwarf2out.c (gen_subprogram_die): Emit linkage name attribute for concrete functions containing the code of cloned functions. gcc/testsuite/ * g++.dg/debug/dwarf2/cdtor-1.C: New test. From-SVN: r174474 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C | 17 +++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 192845576e8..e29a763cb0d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-31 Dodji Seketeli + + PR debug/49047 + * dwarf2out.c (gen_subprogram_die): Emit linkage name attribute + for concrete functions containing the code of cloned functions. + 2011-05-31 Richard Guenther * tree-ssa-forwprop.c (forward_propagate_into_comparison): Rename diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7ec1e931eed..9a415e9a171 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19636,6 +19636,12 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) subr_die = new_die (DW_TAG_subprogram, context_die, decl); add_abstract_origin_attribute (subr_die, origin); + /* This is where the actual code for a cloned function is. + Let's emit linkage name attribute for it. This helps + debuggers to e.g, set breakpoints into + constructors/destructors when the user asks "break + K::K". */ + add_linkage_name (subr_die, decl); } else if (old_die) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f7b52abf18..dfa323b06ab 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-31 Dodji Seketeli + + PR debug/49047 + * g++.dg/debug/dwarf2/cdtor-1.C: New test. + 2011-05-31 Ira Rosen PR testsuite/49239 diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C new file mode 100644 index 00000000000..6d39e54ae08 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C @@ -0,0 +1,17 @@ +// origin PR debug/49047 +// { dg-options "-g -dA" } +// { dg-do compile } + +struct K +{ + K () { } + ~K () { } +}; + +int +main() +{ + K k; +} + +// { dg-final {scan-assembler-times "\[^\n\r\]*DW_AT_MIPS_linkage_name:" 2 } } -- 2.30.2