From: Keith Seitz <keiths@redhat.com>
To: drow@false.org
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] dwarf2_physname
Date: Tue, 01 Sep 2009 23:26:00 -0000 [thread overview]
Message-ID: <4A9DADB6.2090508@redhat.com> (raw)
In-Reply-To: <20090901221122.GA24658@caradoc.them.org>
On 09/01/2009 03:11 PM, Daniel Jacobowitz wrote:
> 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?
Yes, this is based on the patches you sent me a long, long time ago. The
goal is to generate a physname that is unique; it may match the output
of the demangler, but that is not a requirement. It is supposed to
construct valid, fully-qualified names, i.e, you won't see "std::string"
as a physname. It's really "std::basic_string<blah blah blah>".
The template cases I've looked at are checked-in on the
archer-keiths-realcpp-test branch. I've just committed the latest and
greatest version of realcpp.{exp,cc} here: http://tinyurl.com/lkaadh
(git.sourceware.org -- sorry for the tinyurl thing, git URL names are
loooooooong).
Unfortunately, I cannot speak to other compilers, only gcc.
> 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>();
> }
What do you want to do with this? Print it and break/list it?
On my archer-keiths-expr-cumulative branch (which does NOT use
linkage_name):
(gdb) info func f
All functions matching regular expression "f":
File a.cc:
int f<(char*)(&Bar)>();
int f<(char*)(&Foo)>();
Non-debugging symbols:
0x08048420 frame_dummy
0x08048490 __libc_csu_fini
0x0804852c _fini
(gdb) p f<(char*)(&Foo)>
$1 = {int (void)} 0x8048465 <f<(char*)(&Foo)>()>
(gdb) list 'f<(char*)(&Foo)>'
1 template<char *S> int f()
2 {
3 return S[0];
4 }
5
6 char Foo[3];
7 char Bar[3];
8
9 int main()
10 {
(gdb) b 'f<(char*)(&Foo)>'
Breakpoint 1 at 0x8048468: file a.cc, line 3.
(gdb) r
Starting program: /home/keiths/tmp/a
Breakpoint 1, f<(char*)(&Foo)> () at a.cc:3
3 return S[0];
(gdb) bt
#0 f<(char*)(&Foo)> () at a.cc:3
#1 0x08048453 in main () at a.cc:11
(gdb)
I know that "f<(char*)(&Foo)>" is ugly, but that is the name that gcc
gives us (DW_AT_name for this DIE), so we have to use it. [I am assuming
we could get this cleaned up/"fixed" in gcc.]
On FSF gdb HEAD, you can do something similar with "int f<&Foo>" (yes,
you *have* to add the return type) instead of "f<(char*)(&Foo)>"...
Keith
next prev parent reply other threads:[~2009-09-01 23:26 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
2009-09-01 23:37 ` Daniel Jacobowitz
2009-09-02 1:12 ` Michael Eager
2009-09-01 23:26 ` Keith Seitz [this message]
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=4A9DADB6.2090508@redhat.com \
--to=keiths@redhat.com \
--cc=drow@false.org \
--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