From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22883 invoked by alias); 3 Mar 2008 17:22:41 -0000 Received: (qmail 22875 invoked by uid 22791); 3 Mar 2008 17:22:40 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 03 Mar 2008 17:22:20 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id B1B17983AC; Mon, 3 Mar 2008 17:22:18 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 8A1909802C; Mon, 3 Mar 2008 17:22:18 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JWEMj-0001NF-1o; Mon, 03 Mar 2008 12:22:17 -0500 Date: Mon, 03 Mar 2008 17:22:00 -0000 From: Daniel Jacobowitz To: Aleksandar Ristovski Cc: gdb@sourceware.org Subject: Re: Re: cp-name-parser.y Message-ID: <20080303172217.GA4469@caradoc.them.org> Mail-Followup-To: Aleksandar Ristovski , gdb@sourceware.org References: <20080229202918.GB7757@caradoc.them.org> <47CC2F00.4000703@qnx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47CC2F00.4000703@qnx.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00020.txt.bz2 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