From: Michael Eager <eager@eagercon.com>
To: Keith Seitz <keiths@redhat.com>,
Daniel Jacobowitz <drow@false.org>,
gdb-patches@sourceware.org
Subject: Re: [RFA] dwarf2_physname
Date: Tue, 01 Sep 2009 23:18:00 -0000 [thread overview]
Message-ID: <4A9DABA4.3010402@eagercon.com> (raw)
In-Reply-To: <20090901221122.GA24658@caradoc.them.org>
Daniel Jacobowitz wrote:
> On Mon, Aug 31, 2009 at 04:19:02PM -0700, Keith Seitz wrote:
>> On 08/31/2009 03:55 PM, Michael Eager wrote:
>>
>>> Does this mean that (eventually) the DW_AT_MIPS_linkage_name attribute
>>> will not be needed by GDB?
>> That is exactly what it is intended to do. MIPS_linkage_name is not
>> needed in any case I've been able to invent on my
>> archer-keiths-expr-cumulative branch, and that branch has MUCH
>> tougher C++ tests than FSF gdb does.
>
> I assume this patch is a distant descendant of the one I sent you a
> while back. Is its goal to create a useful name for each symbol, or
> to match the one produced by some other source - probably the
> demangler? What sort of template cases have you looked at?
I'd be concerned about trying to embed name mangling into gdb.
Not all compilers (or versions) use the same scheme.
> As you know, I spent several some time trying to do without
> DW_AT_MIPS_linkage_name. My main goals were cleanliness and
> compatibility with a non-GCC compiler (ARM RealView). I came across a
> lot of cases where the output from neither GCC nor any other compiler
> I could get my hands on made sense without a linkage name in the debug
> info - and I couldn't find a way to get sensible representation in
> DWARF, either.
>
> Here's one case I remember having trouble with.
>
> template<char *S> int f()
> {
> return S[0];
> }
>
> char Foo[3];
> char Bar[3];
>
> int main()
> {
> return f<Foo>() + f<Bar>();
> }
>
> 0000000000000000 W int f<&Bar>()
> 0000000000000000 W int f<&Foo>()
>
> <1><31>: Abbrev Number: 2 (DW_TAG_subprogram)
> <32> DW_AT_external : 1
> <33> DW_AT_name : (indirect string, offset: 0x47): f<((char*)(& Foo))>
> <37> DW_AT_decl_file : 1
> <38> DW_AT_decl_line : 1
> <39> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x1f): _Z1fIXadL_Z3FooEEEiv
> <3d> DW_AT_type : <0x55>
> <41> DW_AT_low_pc : 0x0
> <49> DW_AT_high_pc : 0x10
> <51> DW_AT_frame_base : 0x0 (location list)
>
> You have to represent the name "Foo" in the debug info - the address
> isn't enough, there could be other symbols apparently at the same
> address. The name this older GCC emits is not useful. Most other
> compilers just punted. While hopefully Dodji has made HEAD GCC do
> something sensible now, we have to handle all those field compilers :-)
I think that this is a problem with how the template instantiation is
described.
From DWARF 3, Sec. 3.3.7:
1. Each formal parameterized type declaration appearing in the template
definition is represented by a debugging information entry with the tag
DW_TAG_template_type_parameter. Each such entry has a DW_AT_name attribute,
whose value is a null-terminated string containing the name of the formal
type parameter as it appears in the source program. The template type
parameter entry also has a DW_AT_type attribute describing the actual
type by which the formal is replaced for this instantiation. All template
type parameter entries should appear before the entries describing the
instantiated formal parameters to the function.
I think that there should be something like
DW_TAG_template_value_parameter
DW_AT_name : Foo
DW_AT_type : <int *>
as a child of of f<Foo>.
(I'm pretty rusty on how template functions are described, and, unfortunately,
the DWARF Standard doesn't have any examples.)
My feeling is that in this case, DW_AT_MIPS_linkage_name compensates
for the compiler not generating more complete DWARF. If it did generate
DW_TAG_template_value_parameter, there would be no need for DW_AT_MIPS_linkage_name.
--
Michael Eager eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
next prev parent reply other threads:[~2009-09-01 23:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-31 22:51 Keith Seitz
2009-08-31 23:10 ` Michael Eager
2009-08-31 23:23 ` Keith Seitz
2009-08-31 23:35 ` Michael Eager
2009-09-01 22:11 ` Daniel Jacobowitz
2009-09-01 22:27 ` Daniel Jacobowitz
2009-09-01 23:18 ` Michael Eager [this message]
2009-09-01 23:37 ` Daniel Jacobowitz
2009-09-02 1:12 ` Michael Eager
2009-09-01 23:26 ` Keith Seitz
2009-09-01 23:42 ` Daniel Jacobowitz
2009-09-14 18:39 ` Keith Seitz
2009-09-14 22:48 ` Daniel Jacobowitz
2009-09-14 23:56 ` Keith Seitz
2009-09-15 13:32 ` Daniel Jacobowitz
2009-09-15 15:53 ` Keith Seitz
2009-09-15 16:12 ` Daniel Jacobowitz
2009-09-16 20:27 ` Keith Seitz
2009-09-18 22:34 ` Tom Tromey
[not found] ` <m37hwjy2tl.fsf@fleche.redhat.com>
2009-09-01 0:06 ` Michael Eager
2009-09-01 21:27 ` Tom Tromey
2009-09-01 22:10 ` 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=4A9DABA4.3010402@eagercon.com \
--to=eager@eagercon.com \
--cc=drow@false.org \
--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