Demangling of method names and addr2line/c++filt
Ranjit Mathew
rmathew4lists@hotmail.com
Thu Feb 13 09:43:00 GMT 2003
> Addr2line is broken -- it should do whatever is appropriate to the
> default naming convention on the platform. So, if gcc doesn't need a
> special flag to make it add underscores, addr2line should be able to
> demangle without needing a special flag either.
AFAICT, addr2line *is* automatically stripping an underscore
without needing a flag - C function "foo( )" gets emitted as symbol
"_foo" by GCC and gets shown back as "foo" by addr2line.
So it's not "broken" that way...
It does *not* seem to work properly w.r.t. demangling C++/Java symbols
though - both the "-C" and "--demangle=java" flags to addr2line
produce the wrong output for me (MinGW addr2line version 2.13.90 20021005).
"c++filt -s java" however does seem to work properly if I feed it
directly the output of "nm" - but not addr2line, as the latter strips
out the underscore.
Since we feed the output of addr2line to c++filt, we need to tell c++filt
to refrain from stripping the leading underscore if appropriate for
the target.
(To complicate matters for me, I have found c++filt in *both* GCC and
binutils and the GCC c++filt works best, at least with respect to Java.
Weird.)
Ranjit.
More information about the Java
mailing list