From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12387 invoked by alias); 10 Mar 2010 08:11:01 -0000 Received: (qmail 12364 invoked by uid 22791); 10 Mar 2010 08:11:00 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 10 Mar 2010 08:10:55 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 3C8752BAB7D for ; Wed, 10 Mar 2010 03:10:54 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 138zreTIYzpD for ; Wed, 10 Mar 2010 03:10:54 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B49602BAB2E for ; Wed, 10 Mar 2010 03:10:53 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 93116F5894; Wed, 10 Mar 2010 12:10:36 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [commit/dwarf2/Ada] Adjust handling of Ada DIEs after dwarf2_physname patch. Date: Wed, 10 Mar 2010 08:11:00 -0000 Message-Id: <1268208619-31342-1-git-send-email-brobecker@adacore.com> In-Reply-To: <4B968F03.3020600@redhat.com> References: <4B968F03.3020600@redhat.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00381.txt.bz2 Hello, This patch fixes some regressions introduced by the dwarf2_physname patch. For Ada, we prefer the DW_AT_MIPS_linkage_name if available for the name attribute. Eventually, we will want to be able to use both, so that users can reference an entity using either linkage name or natural name. But that's for another time... gdb/ChangeLog: Adjust handling of Ada DIEs after dwarf2_physname patch. * dwarf2read.c (dwarf2_compute_name): Add handling of Ada DIEs. Tested on x86_64-linux. No regression. Checked in. --- gdb/dwarf2read.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 1f25a45..fd75c74 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3324,6 +3324,9 @@ die_needs_namespace (struct die_info *die, struct dwarf2_cu *cu) compute the physname for the object, which include a method's formal parameters (C++/Java) and return type (Java). + For Ada, return the DIE's linkage name rather than the fully qualified + name. PHYSNAME is ignored.. + The result is allocated on the objfile_obstack and canonicalized. */ static const char * @@ -3396,6 +3399,19 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu, } } } + else if (cu->language == language_ada) + { + /* For Ada unit, we prefer the linkage name over the name, as + the former contains the exported name, which the user expects + to be able to reference. Ideally, we want the user to be able + to reference this entity using either natural or linkage name, + but we haven't started looking at this enhancement yet. */ + struct attribute *attr; + + attr = dwarf2_attr (die, DW_AT_MIPS_linkage_name, cu); + if (attr && DW_STRING (attr)) + name = DW_STRING (attr); + } return name; } -- 1.6.3.3