OSDN Git Service

Fix PR debug/49047
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 May 2011 12:09:06 +0000 (12:09 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 May 2011 12:09:06 +0000 (12:09 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174472 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C [new file with mode: 0644]

index 1928455..9ec727b 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 7ec1e93..9a415e9 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 3f7b52a..dfa323b 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 } }