stacktrace.cc (_Jv_StackTrace::GetStackTrace): Unconditionally use _Unwind_Backtrace().

* stacktrace.cc (_Jv_StackTrace::GetStackTrace): Unconditionally use
	_Unwind_Backtrace().
	(_Jv_StackTrace::GetCallerInfo): Enable even for targets using SJLJ
	EH.
	(_Jv_StackTrace::GetClassContext): Unconditionally use
	_Unwind_Backtrace().
	(_Jv_StackTrace::GetFirstNonSystemClassLoader): Likewise.
	* sysdep/i386/backtrace.h (HAVE_FALLBACK_BACKTRACE): Do not define.
	(_Unwind_GetIPInfo): Define macro if SJLJ EH is in use.
	(_Unwind_GetRegionStart): Likewise.
	(_Unwind_Backtrace): Likewise.
	(fallback_backtrace): Accept additional unwind trace function
	argument.  Call it during unwinding.  Stop when any of _Jv_RunMain(),
	_Jv_ThreadStart() or main() is seen during unwinding.
	* sysdep/generic/backtrace.h (fallback_backtrace): Accept an
	additional unwind trace function argument.

From-SVN: r115449
This commit is contained in:
Ranjit Mathew 2006-07-14 17:14:55 +00:00
parent 47a4949a8e
commit 38b19a9247
4 changed files with 77 additions and 49 deletions

View file

@ -153,13 +153,7 @@ _Jv_StackTrace::GetStackTrace(void)
_Jv_UnwindState state (trace_size);
state.frames = (_Jv_StackFrame *) &frames;
#ifdef SJLJ_EXCEPTIONS
// The Unwind interface doesn't work with the SJLJ exception model.
// Fall back to a platform-specific unwinder.
fallback_backtrace (&state);
#else /* SJLJ_EXCEPTIONS */
_Unwind_Backtrace (UnwindTraceFn, &state);
#endif /* SJLJ_EXCEPTIONS */
// Copy the trace and return it.
int traceSize = sizeof (_Jv_StackTrace) +
@ -423,7 +417,6 @@ void
_Jv_StackTrace::GetCallerInfo (jclass checkClass, jclass *caller_class,
_Jv_Method **caller_meth)
{
#ifndef SJLJ_EXCEPTIONS
int trace_size = 20;
_Jv_StackFrame frames[trace_size];
_Jv_UnwindState state (trace_size);
@ -447,9 +440,6 @@ _Jv_StackTrace::GetCallerInfo (jclass checkClass, jclass *caller_class,
*caller_class = trace_data.foundClass;
if (caller_meth)
*caller_meth = trace_data.foundMeth;
#else
return;
#endif
}
// Return a java array containing the Java classes on the stack above CHECKCLASS.
@ -466,13 +456,7 @@ _Jv_StackTrace::GetClassContext (jclass checkClass)
//JvSynchronized (ncodeMap);
UpdateNCodeMap ();
#ifdef SJLJ_EXCEPTIONS
// The Unwind interface doesn't work with the SJLJ exception model.
// Fall back to a platform-specific unwinder.
fallback_backtrace (&state);
#else /* SJLJ_EXCEPTIONS */
_Unwind_Backtrace (UnwindTraceFn, &state);
#endif /* SJLJ_EXCEPTIONS */
// Count the number of Java frames on the stack.
int jframe_count = 0;
@ -543,13 +527,7 @@ _Jv_StackTrace::GetFirstNonSystemClassLoader ()
//JvSynchronized (ncodeMap);
UpdateNCodeMap ();
#ifdef SJLJ_EXCEPTIONS
// The Unwind interface doesn't work with the SJLJ exception model.
// Fall back to a platform-specific unwinder.
fallback_backtrace (&state);
#else /* SJLJ_EXCEPTIONS */
_Unwind_Backtrace (UnwindTraceFn, &state);
#endif /* SJLJ_EXCEPTIONS */
if (state.trace_data)
return (ClassLoader *) state.trace_data;