From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12109 invoked by alias); 17 Dec 2003 17:22:00 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 12082 invoked from network); 17 Dec 2003 17:21:58 -0000 Received: from unknown (HELO yosemite.airs.com) (209.128.65.135) by sources.redhat.com with SMTP; 17 Dec 2003 17:21:58 -0000 Received: (qmail 15742 invoked by uid 10); 17 Dec 2003 17:21:57 -0000 Received: (qmail 13394 invoked by uid 500); 17 Dec 2003 17:21:51 -0000 From: Ian Lance Taylor To: tromey@redhat.com Cc: mec.gnu@mindspring.com (Michael Elizabeth Chastain), gdb@sources.redhat.com Subject: Re: demangler, java, clinit, $E References: <20031217002907.3CA854B375@berman.michael-chastain.com> <874qvzmnu4.fsf@fleche.redhat.com> Date: Wed, 17 Dec 2003 17:22:00 -0000 In-Reply-To: <874qvzmnu4.fsf@fleche.redhat.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-12/txt/msg00242.txt.bz2 Tom Tromey writes: > >>>>> "Ian" == Ian Lance Taylor writes: > > Ian> For some reason the Java mangler emits a '$' character after a member > Ian> name, if the name happens to be a C++ keyword with optional trailing > Ian> '$' characters. I don't know why it bothers to do this. > > It's a weird quoting scheme to achieve some kind of CNI compatibility. > When generating a C++ header from a .class file, we might see a method > or field with the same name as a C++ keyword. So we add a "$". But > then this is ambiguous, so if we see keyword + sequence of "$", we add > one more "$". This scheme doesn't work for static fields or > methods... some parts of CNI are still half-baked. I suppose it's far too late to change this now, but in my opinion it would have been better to include the newly added '$' in the character count which precedes the name. That is, now we see strings like "6sizeof$" which I think would be more cleanly represented as "7sizeof$". That would follow the C++ mangling ABI. (Actually, the fact that the '$' is not included in the character count means that you don't need to add a '$' to a name which happens to be a keyword with a trailing '$'. You can't get a mangling conflict anyhow, because the C++ compiler will always have a character count which includes the '$'.) Ian