From: Joel Brobecker <brobecker@adacore.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] dwarf2_physname FINAL
Date: Mon, 08 Mar 2010 06:18:00 -0000 [thread overview]
Message-ID: <20100308061748.GC3081@adacore.com> (raw)
In-Reply-To: <4B903926.7070303@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1802 bytes --]
> 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, [...]; <mention canonicalization here?>
. For other languages, this is just the DIE name.
The result is allocated on the objfile_obstack. */
--
Joel
[-- Attachment #2: physname-ada.diff --]
[-- Type: text/x-diff, Size: 1016 bytes --]
commit 0a992b13eb758bf26c172a67240022a9d1e1226f
Author: Joel Brobecker <brobecker@adacore.com>
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;
}
next prev parent reply other threads:[~2010-03-08 6:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 22:52 Keith Seitz
2010-03-05 21:54 ` Tom Tromey
2010-03-05 22:12 ` Keith Seitz
2010-03-08 6:18 ` Joel Brobecker [this message]
2010-03-09 18:10 ` Keith Seitz
2010-03-10 8:11 ` [commit/dwarf2/Ada] Adjust handling of Ada DIEs after dwarf2_physname patch Joel Brobecker
2010-03-23 20:25 ` [RFA] dwarf2_physname FINAL 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=20100308061748.GC3081@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
/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