Demangling of method names and addr2line/c++filt

Ranjit Mathew
Sat Feb 15 01:55:00 GMT 2003

>  > The final logic then simply looks like:
>  >
>  >   if ( usingAddr2Line && (USER_LABEL_PREFIX[0]=='_'))
>  >     /* Explicitly pass "-n" to c++filt */
>  >
>  > IMHO, this looks like the safest approach.
>  >
>  > If this is OK, I can work towards a patch for this.
> Excellent.

I spoke too soon...

First off, USER_LABEL_PREFIX is not easily made available to libgcj
and I could not see an easy way to get GCC's config.h (which includes
target-specific headers that really define USER_LABEL_PREFIX, that
too guarded by an "IN_GCC" definition) included in, say,

More seriously though, the c++filt process is created only once in for an entire stack of addresses which could potentially
come from various sources (addr2line, addr2name.awk, interpreter and dladdr).

Either we can spawn c++filt individually for each address (totally gross!),
or we can prefix USER_LABEL_PREFIX to symbols given by addr2line before
passing it to c++filt (somewhat less gross).

It looks gross either way to me and not worth the effort - your reflection
data based scheme is much more reliable and would work even if the binary
is stripped. Except of course that Win32 would be using SJLJ and wouldn't
benefit from it until somehow DWARF2 is brought back in... :-(

I could just distribute a MinGW-specific binary with "-n" passed to c++filt
as default...


Ranjit Mathew        Email: rmathew AT hotmail DOT com
INDIA.               Web:

More information about the Java mailing list