From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21785 invoked by alias); 26 May 2011 20:03:54 -0000 Received: (qmail 21776 invoked by uid 22791); 26 May 2011 20:03:53 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from seketeli.net (HELO ms.seketeli.net) (91.121.166.71) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 May 2011 20:03:35 +0000 Received: from localhost (torimasen.com [82.237.12.13]) by ms.seketeli.net (Postfix) with ESMTP id 7E1FAEA04B; Thu, 26 May 2011 22:02:59 +0200 (CEST) Received: by localhost (Postfix, from userid 500) id 324618E604B; Thu, 26 May 2011 22:03:33 +0200 (CEST) From: Dodji Seketeli To: Jason Merrill Cc: GCC Patches , Tom Tromey Subject: Re: [PATCH] PR debug/49047 (linkage name missing for cdtors) References: <4DDE6F74.1030509@redhat.com> X-URL: http://www.seketeli.net/~dodji Mail-Followup-To: Jason Merrill , GCC Patches , Tom Tromey Date: Thu, 26 May 2011 22:02:00 -0000 In-Reply-To: <4DDE6F74.1030509@redhat.com> (Jason Merrill's message of "Thu, 26 May 2011 11:19:16 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg02102.txt.bz2 Jason Merrill a =C3=A9crit: > Why not just call add_linkage_name after add_abstract_origin_attribute? That is what I first did and it worked for this case. But then I wasn't sure if there could be cases where a function DIE would have the DW_AT_abstract_origin set, but won't have any actual code? For instance if the function has DECL_EXTERNAL set. That's why I wanted to call add_linkage_name only if the function has DW_AT_{low,high}_pc so that I am sure it contains actual code. If my concern is not justified then I guess the patch below should be enough then. gcc/ * dwarf2out.c (gen_subprogram_die): Emit linkage name attribute for functions containing actual code for public cloned abstract functions. gcc/testsuite/ * g++.dg/debug/dwarf2/cdtor-1.C: New test. --- gcc/dwarf2out.c | 7 +++++++ gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 gcc/testsuite/g++.dg/debug/dwarf2/cdtor-1.C diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 55453a3..0cf782f 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19636,6 +19636,13 @@ gen_subprogram_die (tree decl, dw_die_ref context_= die) =20 subr_die =3D new_die (DW_TAG_subprogram, context_die, decl); add_abstract_origin_attribute (subr_die, origin); + if (TREE_PUBLIC (origin)) + /* So this is where the actual code for a publicly accessible + 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/g++.dg/debug/dwarf2/cdtor-1.C b/gcc/testsuite/g+= +.dg/debug/dwarf2/cdtor-1.C new file mode 100644 index 0000000..6d39e54 --- /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= } } --=20 1.7.3.4 --=20 Dodji