Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Aleksandar Ristovski <aristovski@qnx.com>
Cc: gdb@sourceware.org
Subject: Re: Re: cp-name-parser.y
Date: Mon, 03 Mar 2008 17:22:00 -0000	[thread overview]
Message-ID: <20080303172217.GA4469@caradoc.them.org> (raw)
In-Reply-To: <47CC2F00.4000703@qnx.com>

On Mon, Mar 03, 2008 at 12:01:52PM -0500, Aleksandar Ristovski wrote:
> Daniel Jacobowitz wrote:
>> Yes, we could take the unique string from the mangled name and call it
>> (anonymous namespace _MESS_OF_GARBAGE)::foobar, and then recognize
>> that syntax when we parse expressions.
> I think _MESS_OF_GARBAGE is already sufficient, without combining it with  
> '(anonymous namespace)'. _MESS_OF_GARBAGE is used only if print demangle 
> is off. For MI interface, it should (almost always?) be the case.
>
> When '(anonymous namespace)' is used, since it could be any anonymous 
> namespace, it is not sufficient to uniquely identify a symbol and 
> therefore we can only use this form if there is a valid frame that will 
> give it a context.
>
> In either case, I see nothing wrong with the way it is printed out, I see 
> the problem with parsing either of the forms: _MESS_OF_GARBAGE and 
> '(anonymous namespace)'. The first can not be parsed due to '.' in it and 
> the latter due to '(anonymous namespace)'.

Sorry, that's not what I meant.  Any symbol is in one particular
anonymous namespace when we print it out.  So we could print out
which anonymous namespace it's in.

Given this:

namespace A
{
  int x;
  namespace
  {
    int y;
  }
}

using namespace A;
int foo()
{
  return x + y;
}

We get these:

drow@caradoc:~% c++filt _ZN1A1xE
A::x
drow@caradoc:~% c++filt _ZN1A19_GLOBAL__N__ZN1A1xE1yE
A::(anonymous namespace)::y

That mangling is actually "A::_GLOBAL__N__ZN1A1xE::y" according to the
ABI.  We could print out "A::(anonymous namespace A::x)::y".

But I see that this will not work with the latest GCC which just uses
_GLOBAL__N_1 on many platforms.

So the easiest solution may be to ignore "(anonymous namespace)::"
during symbol lookup.

A workaround you could try would be to use quoted symbol names.
Does this work?

-var-create - * "'(anonymous namespace)::foobar'"

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2008-03-03 17:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 18:39 cp-name-parser.y Aleksandar Ristovski
2008-02-29 19:09 ` cp-name-parser.y Daniel Jacobowitz
2008-02-29 19:32   ` cp-name-parser.y Aleksandar Ristovski
2008-02-29 19:49     ` cp-name-parser.y Daniel Jacobowitz
2008-02-29 20:15       ` cp-name-parser.y Aleksandar Ristovski
2008-02-29 21:49         ` cp-name-parser.y Daniel Jacobowitz
2008-03-03 17:02           ` cp-name-parser.y Aleksandar Ristovski
2008-03-03 17:22             ` Daniel Jacobowitz [this message]
2008-03-03 18:33               ` cp-name-parser.y Aleksandar Ristovski
2008-03-03 20:05                 ` cp-name-parser.y Daniel Jacobowitz

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=20080303172217.GA4469@caradoc.them.org \
    --to=drow@false.org \
    --cc=aristovski@qnx.com \
    --cc=gdb@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