c++filt and addr2line [was Re: c++filt causing flashing console windows]

Andrew Haley aph@redhat.com
Mon Sep 8 12:14:00 GMT 2003


Ranjit Mathew writes:
 > Øyvind Harboe wrote:
 > > Is there a way I can turn off the invocation of "c++filt"
 > > from my compiled app?
 > 
 > See:
 > 
 > http://gcc.gnu.org/onlinedocs/gcj/libgcj-Runtime-Properties.html
 > 
 > and the *.NameFinder.* properties. In particular,
 > "gnu.gcj.runtime.NameFinder.demangle" and
 > "gnu.gcj.runtime.NameFinder.use_addr2line".
 > 
 > I seem to remember that libiberty has the demangler
 > functions and perhaps we can directly use that instead
 > of invoking c++filt. 

addr2line can now do its own demangling, so we could dispense with
c++filt in some cases.  However, symbols in shared objects are
retrieved by dlsym(), so we still need to demangle that.

 > Ditto for using libbfd v/s invoking addr2line,

This idea seems to come up once or twice a year.

The problem is not technical: it is legal.  We cannot do this unless
the licences of libbfd and libiberty are changed.  libiberty is LGPL,
which might be OK in some cases, but it is not the same as
GPL+exception.  We can't license libgcj under two licences.

BFD is, unless someone changed it recently, GPL.

We do not need to use external programs at all.  We can change the
stack dumper so that it uses reflection data to generate its output.
I would have made such a change a long time ago, but we would lose
line number information.  Many people want to keep this.  Line numbers
are the only remaining reason for all this machinery.

Andrew.



More information about the Java mailing list