This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: demangler, java, clinit, $E


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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]