* demangler, java, clinit, $E
@ 2003-12-17 0:29 Michael Elizabeth Chastain
2003-12-17 3:52 ` Ian Lance Taylor
2003-12-20 15:55 ` Ian Lance Taylor
0 siblings, 2 replies; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-17 0:29 UTC (permalink / raw)
To: gdb, ian; +Cc: tromey
I picked up 100,000 Java mangled names for the Eclipse project from Tom
Tromey. I compared them with old versus new demangler. This Eclipse is
x86, red hat linux 9, gcj 3.4 20031212.
There were 1052 differences. All of them were like this:
a-eclipse.list!460
_ZN3com6redhat7eclipse3rpm13import_export8Messages18__U3c_clinit__U3e_Ev
com::redhat::eclipse::rpm::import_export::Messages::<clinit>()
com::redhat::eclipse::rpm::import_export::Messages::__U3c_clinit__U3e_()
'__U3c' and '__U3e' are Unicode encoding for '<' and '>'.
A quick look inside the source shows me that it's supposed to be this
way.
The old demangler did unicode decoding for '__U' all the time, but the
new demangler does it only if DMGL_JAVA is turned on. So gdb will have
to be careful to turn on DMGL_JAVA when it needs to.
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.
Michael C
===
DW.ref._ZN3org7eclipse3jdt4core8compiler21InvalidInputException6class$E
DW.ref._ZN3org7eclipse3jdt8internal8compiler7problem11AbortMethod6class$E
DW.ref._ZN3org7eclipse3jdt8internal8compiler7problem16AbortCompilation6class$E
DW.ref._ZN3org7eclipse3jdt8internal8compiler7problem20AbortCompilationUnit6class$E
DW.ref._ZN3org7eclipse3jdt8internal8compiler7problem9AbortType6class$E
DW.ref._ZN3org7eclipse3jdt8internal8compiler8classfmt20ClassFormatException6class$E
DW.ref._ZN4java2io11IOException6class$E
DW.ref._ZN4java2io28UnsupportedEncodingException6class$E
DW.ref._ZN4java4lang11ThreadDeath6class$E
DW.ref._ZN4java4lang16RuntimeException6class$E
DW.ref._ZN4java4lang18ClassCastException6class$E
DW.ref._ZN4java4lang19ArithmeticException6class$E
DW.ref._ZN4java4lang19ArrayStoreException6class$E
DW.ref._ZN4java4lang20NullPointerException6class$E
DW.ref._ZN4java4lang21NoSuchMethodException6class$E
DW.ref._ZN4java4lang21NumberFormatException6class$E
DW.ref._ZN4java4lang22ClassNotFoundException6class$E
DW.ref._ZN4java4lang22IllegalAccessException6class$E
DW.ref._ZN4java4lang25IndexOutOfBoundsException6class$E
DW.ref._ZN4java4lang30ArrayIndexOutOfBoundsException6class$E
DW.ref._ZN4java4lang5Error6class$E
DW.ref._ZN4java4lang7reflect25InvocationTargetException6class$E
DW.ref._ZN4java4lang9Exception6class$E
DW.ref._ZN4java4lang9Throwable6class$E
DW.ref._ZN4java4util22NoSuchElementException6class$E
DW.ref._ZN4java4util24MissingResourceException6class$E
_ZN3org3xml3sax7helpers11NewInstance6class$$EPN4java4lang6StringE
_ZN3org3xml3sax7helpers16XMLReaderFactory6class$$EPN4java4lang6StringE
_ZN3org6apache3wml3dom15WMLDocumentImpl6class$$EPN4java4lang6StringE
_ZN3org6apache3xml9serialize20BaseMarkupSerializer6class$$EPN4java4lang6StringE
_ZN3org6apache3xml9serialize7HTMLdtd6class$$EPN4java4lang6StringE
_ZN3org6apache4html3dom16HTMLDocumentImpl6class$$EPN4java4lang6StringE
_ZN3org6apache6coyote6http1114Http11Protocol6class$$EPN4java4lang6StringE
_ZN3org6apache6coyote6http1115Http11Processor6class$$EPN4java4lang6StringE
_ZN3org6apache6jasper7runtime17JspRuntimeLibrary6class$$EPN4java4lang6StringE
_ZN3org6apache6lucene5index11IndexReader6delete$EPNS2_4TermE
_ZN3org6apache6lucene5index11IndexReader6delete$Ei
_ZN3org6apache6regexp18RECompiler$RERange6delete$Ei
_ZN3org6apache6xerces4dom337DOMImplementationRegistry$NewInstance6class$$EPN4java4lang6StringE
_ZN3org6apache6xerces4impl2dv3dtd28DatatypeValidatorFactoryImpl6class$$EPN4java4lang6StringE
_ZN3org6apache6xerces4impl3dtd6models10CMStateSet5union$EPS5_
_ZN3org6apache6xerces4util13ObjectFactory6class$$EPN4java4lang6StringE
_ZN3org6apache6xerces7parsers17AbstractDOMParser6class$$EPN4java4lang6StringE
_ZN3org7eclipse2ui7actions20DeleteResourceAction6delete$EP6JArrayIPNS0_4core9resources9IResourceEEPNS5_7runtime16IProgressMonitorE
_ZN3org7eclipse2ui7actions20DeleteResourceAction6delete$EPNS0_4core9resources9IResourceEPNS4_7runtime16IProgressMonitorE
_ZN3org7eclipse2ui7actions28CopyFilesAndFoldersOperation6delete$EPNS0_4core9resources9IResourceEPNS4_7runtime16IProgressMonitorE
_ZN3org7eclipse2ui8internal4misc9Stopwatch8register$Ev
_ZN3org7eclipse3cdt5debug2mi4core3cdi5model14VariableObject6sizeof$Ev
_ZN3org7eclipse3cdt5debug2mi4core6output12MIParser$FSB6delete$Eii
_ZN3org7eclipse3cdt5debug8internal4core11breakpoints11CBreakpoint8register$Eb
_ZN3org7eclipse3cdt5debug8internal4core5model23CVariable$ErrorVariable6sizeof$Ev
_ZN3org7eclipse3cdt5debug8internal4core5model26CVariable$InternalVariable6sizeof$Ev
_ZN3org7eclipse3cdt5debug8internal4core5model9CVariable6sizeof$Ev
_ZN3org7eclipse3cdt5utils3elf6parser13BinaryArchive6delete$EP6JArrayIPNS1_4core27IBinaryParser$IBinaryObjectEE
_ZN3org7eclipse3cdt8internal2ui11preferences22TemplatePreferencePage6export$EPNS2_6corext8template11TemplateSetE
_ZN3org7eclipse3cdt8internal2ui11preferences22TemplatePreferencePage6export$Ev
_ZN3org7eclipse3cdt8internal4core5model13BinaryElement6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3cdt8internal4core5model15TranslationUnit6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3cdt8internal4core5model18SourceManipulation6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3cdt8internal4core5model22SourceManipulationInfo6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3cdt8internal4core5model6CModel6delete$EP6JArrayIPNS1_4core5model9ICElementEEbPNS7_7runtime16IProgressMonitorE
_ZN3org7eclipse3cdt8internal4core5model6parser15PEBinaryArchive6delete$EP6JArrayIPNS1_4core27IBinaryParser$IBinaryObjectEE
_ZN3org7eclipse3cdt8internal4core5model6parser16ElfBinaryArchive6delete$EP6JArrayIPNS1_4core27IBinaryParser$IBinaryObjectEE
_ZN3org7eclipse3jdt4core21EcjJDTCompilerAdapter6class$$EPN4java4lang6StringE
_ZN3org7eclipse3jdt8internal4core15CompilationUnit6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal4core15PackageFragment6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal4core16SourceRefElement6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal4core19PackageFragmentRoot6delete$EiiPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal4core20ClassFileWorkingCopy6delete$EbPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal4core9JavaModel6delete$EP6JArrayIPNS1_4core12IJavaElementEEbPNS6_7runtime16IProgressMonitorE
_ZN3org7eclipse3jdt8internal5debug4core11breakpoints14JavaBreakpoint8register$Eb
_ZN3org7eclipse3jdt8internal8compiler3ast27OperatorExpression$1$Decode8operator$Ei
_ZN3org7eclipse3jdt8internal8compiler6parser6Parser6class$$EPN4java4lang6StringE
_ZN3org7eclipse4core8internal10localstore13DeleteVisitor6delete$EPNS2_9resources8ResourceEPN4java2io4FileE
_ZN3org7eclipse4core8internal10localstore13DeleteVisitor6delete$EPNS3_15UnifiedTreeNodeEbb
_ZN3org7eclipse4core8internal10localstore15FileSystemStore6delete$EPN4java2io4FileE
_ZN3org7eclipse4core8internal10localstore15FileSystemStore6delete$EPN4java2io4FileEPNS1_7runtime11MultiStatusE
_ZN3org7eclipse4core8internal10localstore15FileSystemStore6delete$EPN4java2io4FileEPNS5_4lang6StringEPNS1_7runtime11MultiStatusE
_ZN3org7eclipse4core8internal10localstore25FileSystemResourceManager6delete$EPNS1_9resources9IResourceEbbbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal10localstore9BlobStore6delete$EPN4java2io4FileE
_ZN3org7eclipse4core8internal4boot18PlatformURLHandler8register$EPN4java4lang6StringEPNS6_5ClassE
_ZN3org7eclipse4core8internal4boot25PlatformURLHandlerFactory8register$EPN4java4lang6StringEPNS5_3net23URLStreamHandlerFactoryE
_ZN3org7eclipse4core8internal8indexing11ObjectStore6delete$EPN4java4lang6StringE
_ZN3org7eclipse4core8internal8indexing12IndexedStore6delete$EPN4java4lang6StringE
_ZN3org7eclipse4core8internal8indexing3Log6delete$EPN4java4lang6StringE
_ZN3org7eclipse4core8internal8indexing9PageStore6delete$EPN4java4lang6StringE
_ZN3org7eclipse4core8internal9resources13LocalMetaArea6delete$EPNS1_9resources8IProjectE
_ZN3org7eclipse4core8internal9resources13WorkspaceRoot6delete$EbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources13WorkspaceRoot6delete$EbbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources6Marker6delete$Ev
_ZN3org7eclipse4core8internal9resources7Project6delete$EbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources7Project6delete$EbbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources8Resource6delete$EbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources8Resource6delete$EbbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources8Resource6delete$EiPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources9Workspace6delete$EP6JArrayIPNS1_9resources9IResourceEEbPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4core8internal9resources9Workspace6delete$EP6JArrayIPNS1_9resources9IResourceEEiPNS1_7runtime16IProgressMonitorE
_ZN3org7eclipse4help8internal20IndexToolApplication6delete$EPN4java2io4FileE
_ZN3org7eclipse4team8internal3ftp6target16FTPResourceState6delete$EPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse4team8internal3ftp6target23FTPRemoteTargetResource6delete$EPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse4team8internal4ccvs2ui4repo17RepositoryManager6delete$EP6JArrayIPNS0_4core9resources9IResourceEEPNS8_7runtime16IProgressMonitorE
_ZN3org7eclipse4team8internal4ccvs3ssh4Misc3xor$EP6JArrayIcEiS8_iS8_ii
_ZN3org7eclipse4team8internal4ccvs4core15CVSTeamProvider6delete$EP6JArrayIPNS0_4core9resources9IResourceEEPNS7_7runtime16IProgressMonitorE
_ZN3org7eclipse4team8internal4ccvs4core4util15FileNameMatcher8register$EP6JArrayIPN4java4lang6StringEE
_ZN3org7eclipse4team8internal4ccvs4core4util15FileNameMatcher8register$EPN4java4lang6StringESA_
_ZN3org7eclipse4team8internal4ccvs4core9resources11EclipseFile6delete$Ev
_ZN3org7eclipse4team8internal4ccvs4core9resources13EclipseFolder6delete$Ev
_ZN3org7eclipse4team8internal4ccvs4core9resources14RemoteResource6delete$Ev
_ZN3org7eclipse4team8internal4ccvs4core9resources15EclipseResource6delete$Ev
_ZN3org7eclipse4team8internal6webdav4core23DavRemoteTargetResource6delete$EPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse4team8internal6webdav4core8DavState6delete$EPNS0_4core7runtime16IProgressMonitorE
_ZN3org7eclipse5debug4core5model10Breakpoint6delete$Ev
_ZN3org7eclipse5debug8internal4core19LaunchConfiguration6delete$Ev
_ZN3org7eclipse5jface4text8Position6delete$Ev
_ZN3org7eclipse6update8internal2ui5views20SearchMonitorManager8register$EPNS3_6search12SearchObjectE
_ZN3org7eclipse6update8internal4core12SessionDelta6delete$Ev
_ZN3org7eclipse6update8internal4core16ErrorRecoveryLog6delete$Ev
_ZN3org7eclipse6update8internal4core19ConfigurationPolicy5union$EP6JArrayIPN4java4lang6StringEESB_
_ZN3org7eclipse6update8internal4core20InstallConfiguration6export$EPN4java2io4FileE
_ZN3org7eclipse6webdav6client14LocalDAVClient6delete$EPNS1_8ILocatorEPNS1_8IContextE
_ZN3org7eclipse6webdav6client15RemoteDAVClient6delete$EPNS1_8ILocatorEPNS1_8IContextE
_ZN3org7eclipse6webdav6client22AbstractResourceHandle6delete$Eb
_ZN3org7eclipse6webdav6client22AbstractResourceHandle6delete$Ev
_ZN3org7eclipse6webdav8internal6kernel15ConditionFactor3not$Ev
_ZN4java4lang12StringBuffer6delete$Eii
_ZN5javax3xml7parsers13FactoryFinder6class$$EPN4java4lang6StringE
_ZN5javax7servlet3jsp6tagext10TagSupport6class$$EPN4java4lang6StringE
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: demangler, java, clinit, $E
2003-12-17 0:29 demangler, java, clinit, $E Michael Elizabeth Chastain
@ 2003-12-17 3:52 ` Ian Lance Taylor
2003-12-17 16:17 ` Tom Tromey
2003-12-20 15:55 ` Ian Lance Taylor
1 sibling, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2003-12-17 3:52 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb, tromey
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. */
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: demangler, java, clinit, $E
2003-12-17 3:52 ` Ian Lance Taylor
@ 2003-12-17 16:17 ` Tom Tromey
2003-12-17 17:22 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2003-12-17 16:17 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: Michael Elizabeth Chastain, gdb
>>>>> "Ian" == Ian Lance Taylor <ian@wasabisystems.com> 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.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: demangler, java, clinit, $E
2003-12-17 16:17 ` Tom Tromey
@ 2003-12-17 17:22 ` Ian Lance Taylor
0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2003-12-17 17:22 UTC (permalink / raw)
To: tromey; +Cc: Michael Elizabeth Chastain, gdb
Tom Tromey <tromey@redhat.com> writes:
> >>>>> "Ian" == Ian Lance Taylor <ian@wasabisystems.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: demangler, java, clinit, $E
2003-12-17 0:29 demangler, java, clinit, $E Michael Elizabeth Chastain
2003-12-17 3:52 ` Ian Lance Taylor
@ 2003-12-20 15:55 ` Ian Lance Taylor
1 sibling, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2003-12-20 15:55 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb, tromey
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.
...
> _ZN3org3xml3sax7helpers11NewInstance6class$$EPN4java4lang6StringE
I checked a patch into the gcc repository to demangle this sort of
name, in which the Java mangler inserted a '$' which is not counted in
the identifier length.
As I said in my message to gcc-patches:
As a side note, my guess is that adding the '$' is intended to make it
possible for Java routines to be implemented in C++. The C++ code
would simply append a '$' to the keyword, in order to be able to use
it in C++. Unfortunately, this won't work, because the C++ mangler
will count the '$' in the identifier length, unlike the Java mangler.
So if my guess about the intention is correct, then this is actually a
bug in the Java mangler. If the Java mangler is fixed to count the
'$' in the identifier length, then the patch below will only be needed
for older code. It will do no harm for newer code, except that in
extremely unusual situations it will demangle a symbol name which is
not actually a mangled name.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-12-20 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-17 0:29 demangler, java, clinit, $E Michael Elizabeth Chastain
2003-12-17 3:52 ` Ian Lance Taylor
2003-12-17 16:17 ` Tom Tromey
2003-12-17 17:22 ` Ian Lance Taylor
2003-12-20 15:55 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox