Demangling of method names and addr2line/c++filt

Andrew Haley aph@redhat.com
Thu Feb 13 10:02:00 GMT 2003


Mark Wielaard writes:
 > Hi,
 > 
 > On Thu, 2003-02-13 at 10:09, Andrew Haley wrote:
 > > 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.
 > 
 > But we currently don't use addr2line to demangle (since it cannot
 > demangele java method names on all platforms)

In which case, surely we fix addr2line's demangling of java method
names on the platforms in question -- going after the actual bug
instead of trying to kludge around it.

 > so we use the output of addr2line as input for c++filt (or we give
 > it the result of dladdr). It seems that both addr2line and c++filt
 > are stripping leading underscore on some architectures.

 > So the questions seem to be:
 > - Does addr2line (or addr2name) and dladdr always strip the leading
 > underscore on platforms that need it stripped?
 > If yes, then it seems save to always give a "-n" argument to c++filt.

Surely the question is should c++filt work when passed the output of
addr2line?

 > This would all be a bit simpler if we did the symbol lookup and
 > demangling inside libgcj itself.

Well, yes.  I want to do that, but there are a couple of problems to
do with the fact that a) There doesn't seem to be any reasonably easy
way to get line numbers, and b) DOS can't support DWARF demangling
info because it useds sjsj because of callbacks.  

One idea -- perhaps we could insert some rudimentary DWARF info
anyway, even on platforms where we use sjlj.  That would work.  Then
we could do the stack trace ourselves, although we'd lose line numbers
until someone figures out how to decode the line number info in
libgcj.

Andrew.



More information about the Java mailing list