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


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


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