This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: backtrace() vs. _Unwind_Backtrace()


>>>>> On Fri, 5 Dec 2003 10:46:47 +0000, Andrew Haley <aph@redhat.com> said:

  Andrew> David Mosberger writes:
  >> While debugging another problem, I noticed that libjava currently
  >> attempts to use libc's backtrace() function to create a stack
  >> trace (libjava/gnu/gcj/runtime/natStackTrace.cc).  Recently,
  >> libgcc got an _Unwind_Backtrace() function, which I think should
  >> do exactly what's needed there (in combination with
  >> _Unwind_GetIP()), so I think it would make sense to switch to
  >> _Unwind_Backtrace() instead.

  Andrew> Java uses backtrace() a lot, and _Unwind_Backtrace() is
  Andrew> inefficient.  I see no good reason to switch unless
  Andrew> backtrace() doesn't work on a given target.

But in that case, HAVE_BACKTRACE should be turned on for ia64 Linux.
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().
(And the libunwind-based _Unwind_Backtrace() is probably about as efficient
as it gets.)

	--david


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]