re PR debug/49047 (DW_AT_linkage_name missing for constructors and destructors)
authorDodji Seketeli <dodji@redhat.com>
Tue, 31 May 2011 12:17:21 +0000 (12:17 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Tue, 31 May 2011 12:17:21 +0000 (14:17 +0200)
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
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C [new file with mode: 0644]

index 192845576e84d2001c76c9a9816663654fac2355..e29a763cb0d087b5e636861e27e10eda8e96ccd6 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-31  Dodji Seketeli  <dodji@redhat.com>
+
+       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  <rguenther@suse.de>
 
        * tree-ssa-forwprop.c (forward_propagate_into_comparison): Rename
index 7ec1e931eed523dab0a53318d167b810a4ce83de..9a415e9a171c564921d695d5e1237f640e0e39b9 100644 (file)
@@ -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)
     {
index 3f7b52abf1899674dcea286fd8bf86ab3d0cdd3f..dfa323b06abaaba6a0d20cc2671227b8a28752e4 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-31  Dodji Seketeli  <dodji@redhat.com>
+
+       PR debug/49047
+       * g++.dg/debug/dwarf2/cdtor-1.C: New test.
+
 2011-05-31  Ira Rosen  <ira.rosen@linaro.org>
 
        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 (file)
index 0000000..6d39e54
--- /dev/null
@@ -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 } }