From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29120 invoked by alias); 8 Mar 2010 06:18:10 -0000 Received: (qmail 29112 invoked by uid 22791); 8 Mar 2010 06:18:09 -0000 X-SWARE-Spam-Status: No, hits=-2.4 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; Mon, 08 Mar 2010 06:18:05 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id EDB912BAB4E; Mon, 8 Mar 2010 01:18:03 -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 zmbwyDuUsMd0; Mon, 8 Mar 2010 01:18:03 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 3851E2BAB25; Mon, 8 Mar 2010 01:18:03 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 00A21F5894; Mon, 8 Mar 2010 10:17:48 +0400 (RET) Date: Mon, 08 Mar 2010 06:18:00 -0000 From: Joel Brobecker To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] dwarf2_physname FINAL Message-ID: <20100308061748.GC3081@adacore.com> References: <4B903926.7070303@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline In-Reply-To: <4B903926.7070303@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00294.txt.bz2 --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1802 > One other issue that I uncovered: DW_AT_MIPS_linkage_name appears to > be necessary for Ada. That's correct. In the cases where the DW_AT_MIPS_linkage_name is used, it provides the exported name of our entity, whereas the DW_AT_name contains the name of the entity as it would have been encoded had the entity not been given a specific exported name. For instance, consider the following declaration: package Pck is procedure Do_Nothing; pragma Export (C, Do_Nothing, "__foo_bar"); end Pck; The associated DWARF looks like this: .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) .byte 0x1 # DW_AT_external .long .LASF3 # DW_AT_name: "pck__do_nothing" .long .LASF4 # DW_AT_MIPS_linkage_name: "__foo_bar" > I have a patch that I used to address this (for one of our internal > releases), but it is probably not complete. [In other words: it's now > just as broken as it was before.] I can submit this as a follow-up, if > so desired. Just to clarify a little bit, it's the compiler that is probably broken, generating incorrect debugging info. I keep pushing internally for us to improve the situation so that others can test Ada too, but we only have few engineers working on this area, and it's hard to get their attention on this :-(. Attached is a patch that fixes all regressions for Ada. Basically, it updates dwarf2_compute_name to handle Ada entities... The function comment will probably need to be updated - something like this: /* Compute the fully qualified name of DIE in CU: . For Ada, this is the DIE exported name; . For C++ and Java, [...]; . For other languages, this is just the DIE name. The result is allocated on the objfile_obstack. */ -- Joel --OgqxwSJOaUobr8KG Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="physname-ada.diff" Content-length: 1016 commit 0a992b13eb758bf26c172a67240022a9d1e1226f Author: Joel Brobecker Date: Mon Mar 8 09:56:21 2010 +0400 Compute the name of Ada entities using the MIPS_linkage_name first. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d8629e4..9e4334a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -3399,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; } --OgqxwSJOaUobr8KG--