From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11595 invoked by alias); 29 Feb 2008 19:49:46 -0000 Received: (qmail 11586 invoked by uid 22791); 29 Feb 2008 19:49:45 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO qnxmail.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 29 Feb 2008 19:49:28 +0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.42.96.5]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id OAA27053; Fri, 29 Feb 2008 14:32:22 -0500 Received: from [10.42.100.129] (dhcp-100-129 [10.42.100.129]) by smtp.ott.qnx.com (8.8.8/8.6.12) with ESMTP id OAA17493; Fri, 29 Feb 2008 14:49:25 -0500 Message-ID: <47C861C5.4060907@qnx.com> Date: Fri, 29 Feb 2008 20:15:00 -0000 From: Aleksandar Ristovski User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb@sourceware.org Subject: Re: cp-name-parser.y References: <47C84D48.2020807@qnx.com> <20080229185513.GA2793@caradoc.them.org> <47C85859.2030403@qnx.com> <20080229193229.GA4226@caradoc.them.org> In-Reply-To: <20080229193229.GA4226@caradoc.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-02/txt/msg00265.txt.bz2 Daniel Jacobowitz wrote: > On Fri, Feb 29, 2008 at 02:09:13PM -0500, Aleksandar Ristovski wrote: >> I am looking at that since right now something like this: >> >> -var-create - * "(anonymous namespace)::foobar" >> >> will not work since c_parse doesn't know anything about '(anonymous >> namespace)'. I guess it wouldn't be too hard to hack around this >> particular case, but a proper solution would be preferable. > > I wonder what the right thing to do on a statement like that is. The > problem with anonymous namespaces is that we call them all "(anonymous > namespace)", but they're many different namespaces, one for each file > with anonymous namespaces. In that file, you would access the type > as just "foobar". Maybe we should give each anonymous namespace > a different name. I am not sure, but unique name should already be available in the form of mangled name (to me, at a first glance, creating unique names doesn't sound like a good idea). However, in the case I am talking about, it is known which anonymous namespace is relevant since we have the frame, so really the only thing that is missing is to recognize that '(anonymous namespace)' could, effectively, be removed from the type name and then using the 'bare' var name crawl up the blocks to find the matching visible var in the given context. But I am not 100% sure the solution is generic. > > Anyway, cp-name-parser.y isn't a replacement for c-exp.y. It's a name > parser; it accepts both names and types in cases where we don't know > which are which, and it does not support any expressions except when > they can appear inside a template argument. Once you've identified > something as a symbol name then you might hand it off to this parser > to find the canonical form of the name, before searching the symbol > table. ok. So we could, perhaps, use it if c_parse fails and the language is c++? > >> The issue is evident when using IDE (CDT). IDE will call >> ptype foobar >> which prints type (correctly) something like this: '(anonymous >> namespace)::FooBar' and then IDE uses this string as argument to >> -var-create, but unfortunately, this doesn't work. > > (Why are you creating a varobj for a type, anyway?) > In the example above 'foobar' is a variable defined in the anon. namespace, and 'FooBar' is class name, and my last comment is not precise; IDE uses the variable name correctly but I am not familiar with internals on what does it do to build that name. In any case, the '(anonymous namespace)' part comes from gdb.