From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4383 invoked by alias); 17 Dec 2003 03:52:26 -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 4375 invoked from network); 17 Dec 2003 03:52:25 -0000 Received: from unknown (HELO yosemite.airs.com) (209.128.65.135) by sources.redhat.com with SMTP; 17 Dec 2003 03:52:25 -0000 Received: (qmail 8550 invoked by uid 10); 17 Dec 2003 03:52:25 -0000 Received: (qmail 9696 invoked by uid 500); 17 Dec 2003 03:52:18 -0000 From: Ian Lance Taylor To: mec.gnu@mindspring.com (Michael Elizabeth Chastain) Cc: gdb@sources.redhat.com, tromey@redhat.com Subject: Re: demangler, java, clinit, $E References: <20031217002907.3CA854B375@berman.michael-chastain.com> Date: Wed, 17 Dec 2003 03:52:00 -0000 In-Reply-To: <20031217002907.3CA854B375@berman.michael-chastain.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/msg00237.txt.bz2 mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes: > There are also 127 names which did not demangle at all, even with > "--format java". This happens with both old and new demangler. > These worry me. I have appended the list. > DW.ref._ZN3org7eclipse3jdt4core8compiler21InvalidInputException6class$E As far as I can tell, all the names which start with "DW.ref." are created for debugging purposes. I don't really know why. See dw2_force_const_mem() in gcc/dwarf2asm.c. My thinking right now is that these names should not be demangled. They are not properly mangled symbol names. > _ZN3org3xml3sax7helpers11NewInstance6class$$EPN4java4lang6StringE For some reason the Java mangler emits a '$' character after a member name, if the name happens to be a C++ keyword with optional trailing '$' characters. I don't know why it bothers to do this. I think this patch should lead to a correct demangling. Ian Index: cp-demangle.c =================================================================== RCS file: /cvs/src/src/libiberty/cp-demangle.c,v retrieving revision 1.40 diff -u -p -r1.40 cp-demangle.c --- cp-demangle.c 16 Dec 2003 00:58:42 -0000 1.40 +++ cp-demangle.c 17 Dec 2003 03:48:13 -0000 @@ -1334,6 +1343,12 @@ d_identifier (di, len) name = d_str (di); d_advance (di, len); + /* A Java mangled name may have a trailing '$' if it is a C++ + keyword. We just ignore the '$'. */ + if ((di->options & DMGL_JAVA) != 0 + && d_peek_char (di) == '$') + d_advance (di, 1); + /* Look for something which looks like a gcc encoding of an anonymous namespace, and replace it with a more user friendly name. */