Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
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	[thread overview]
Message-ID: <1268208619-31342-1-git-send-email-brobecker@adacore.com> (raw)
In-Reply-To: <4B968F03.3020600@redhat.com>

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


  reply	other threads:[~2010-03-10  8:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-04 22:52 [RFA] dwarf2_physname FINAL Keith Seitz
2010-03-05 21:54 ` Tom Tromey
2010-03-05 22:12   ` Keith Seitz
2010-03-08  6:18 ` Joel Brobecker
2010-03-09 18:10   ` Keith Seitz
2010-03-10  8:11     ` Joel Brobecker [this message]
2010-03-23 20:25 ` Ulrich Weigand
2010-03-24 20:24   ` Keith Seitz
2010-03-25 10:21     ` Ulrich Weigand
2010-03-25 18:31       ` [RFA] Java DWARF fixes (was Re: [RFA] dwarf2_physname FINAL) Keith Seitz
2010-03-25 20:05         ` [RFA] Java DWARF fixes Tom Tromey
2010-03-25 22:14           ` Keith Seitz
2010-03-26 16:48             ` Ulrich Weigand
2010-03-26 16:54               ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268208619-31342-1-git-send-email-brobecker@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox