backtrace() vs. _Unwind_Backtrace()
Andrew Haley
aph@redhat.com
Fri Dec 5 17:41:00 GMT 2003
David Daney writes:
> Andrew Haley wrote:
>
> > >
> > > But in that case, HAVE_BACKTRACE should be turned on for ia64 Linux.
> >
> >Good.
> >
> > > Older versions of libc have a broken backtrace() on that platform,
> > > but even that can be worked around by doing:
> > >
> > > LD_PRELOAD=/usr/lib/libunwind-ia64.so.1
> > >
> > > and with newer versions of libc, backtrace() will use _Unwind_Backtrace().
> >
> >But we need to build a version of libgcj for ia64 Linux that works
> >without needing a special LD_PRELOAD.
> The approach for the MIPS port of libgcj is to include a backtrace()
> replacement that calls _Unwind_Backtrace(). This works because
> backtrace() is a weak symbol in glibc. It sounds like this is
> essentially what you are suggesting.
If libc's backtrace starts to work on all systems we can deprecate
calling _Unwind_Backtrace() directly. But in the meantime, with
broken backtrace() on several targets, we have to do whatever
workarounds are necessary.
The nice thing about _Unwind_Backtrace() is that it works on a wide
range of targets. Unfortunately, it doesn't work on all targets, so
we'll need to maintain a mechanism for using either backtrace() or
_Unwind_Backtrace().
Given that we have to maintain such a mechanism, we should default to
the fastest working backtrace on each system.
In the case of the ia64, the fastest working backtrace is
_Unwind_Backtrace().
Andrew.
More information about the Java
mailing list