stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Protect interpreter-specific code with #ifdef INTERPRETER.
2005-03-15 Andreas Tobler <a.tobler@schweiz.ch> * stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Protect interpreter-specific code with #ifdef INTERPRETER. (_Jv_StackTrace::getLineNumberForFrame): Likewise. (_Jv_StackTrace::FillInFrameInfo): Likewise. (_Jv_StackTrace::non_system_trace_fn): Likewise. * include/java-stack.h (struct _Jv_InterpFrameInfo): Protect with #ifdef INTERPRETER. Also protect declarations that use it. * java/lang/Class.h: Move _Jv_StackTrace friend declaration outside #ifdef INTERPRETER block. From-SVN: r96571
This commit is contained in:
parent
ab1bc4e816
commit
455d8f0605
4 changed files with 25 additions and 1 deletions
|
@ -1,3 +1,15 @@
|
|||
2005-03-15 Andreas Tobler <a.tobler@schweiz.ch>
|
||||
|
||||
* stacktrace.cc (_Jv_StackTrace::UnwindTraceFn): Protect
|
||||
interpreter-specific code with #ifdef INTERPRETER.
|
||||
(_Jv_StackTrace::getLineNumberForFrame): Likewise.
|
||||
(_Jv_StackTrace::FillInFrameInfo): Likewise.
|
||||
(_Jv_StackTrace::non_system_trace_fn): Likewise.
|
||||
* include/java-stack.h (struct _Jv_InterpFrameInfo): Protect with
|
||||
#ifdef INTERPRETER. Also protect declarations that use it.
|
||||
* java/lang/Class.h: Move _Jv_StackTrace friend declaration outside
|
||||
#ifdef INTERPRETER block.
|
||||
|
||||
2005-03-15 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR libgcj/20251
|
||||
|
|
|
@ -71,7 +71,9 @@ struct _Jv_UnwindState
|
|||
jint length; // length of FRAMES
|
||||
jint pos; // current position in FRAMES
|
||||
_Jv_StackFrame *frames; // array of stack frame data to be filled.
|
||||
#ifdef INTERPRETER
|
||||
_Jv_InterpFrame *interp_frame; // current frame in the interpreter stack.
|
||||
#endif
|
||||
_Jv_TraceFn trace_function; // function to call back after each frame
|
||||
// is enumerated. May be NULL.
|
||||
void *trace_data; // additional state data for trace_function.
|
||||
|
@ -84,8 +86,10 @@ struct _Jv_UnwindState
|
|||
Thread *thread = Thread::currentThread();
|
||||
// Check for NULL currentThread(), in case an exception is created
|
||||
// very early during the runtime startup.
|
||||
#ifdef INTERPRETER
|
||||
if (thread)
|
||||
interp_frame = (_Jv_InterpFrame *) thread->interp_frame;
|
||||
#endif
|
||||
trace_function = NULL;
|
||||
trace_data = NULL;
|
||||
}
|
||||
|
|
|
@ -472,8 +472,8 @@ private:
|
|||
friend class ::_Jv_ClassReader;
|
||||
friend class ::_Jv_InterpClass;
|
||||
friend class ::_Jv_InterpMethod;
|
||||
friend class ::_Jv_StackTrace;
|
||||
#endif
|
||||
friend class ::_Jv_StackTrace;
|
||||
|
||||
#ifdef JV_MARKOBJ_DECL
|
||||
friend JV_MARKOBJ_DECL;
|
||||
|
|
|
@ -120,6 +120,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
|
|||
// the java code and not the interpreter itself. This assumes a 1:1
|
||||
// correspondance between call frames in the interpreted stack and occurances
|
||||
// of _Jv_InterpMethod::run() on the native stack.
|
||||
#ifdef INTERPRETER
|
||||
if (func_addr == (_Unwind_Ptr) &_Jv_InterpMethod::run)
|
||||
{
|
||||
state->frames[pos].type = frame_interpreter;
|
||||
|
@ -128,6 +129,7 @@ _Jv_StackTrace::UnwindTraceFn (struct _Unwind_Context *context, void *state_ptr)
|
|||
state->interp_frame = state->interp_frame->next;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
state->frames[pos].type = frame_native;
|
||||
state->frames[pos].ip = (void *) _Unwind_GetIP (context);
|
||||
|
@ -174,6 +176,7 @@ void
|
|||
_Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
|
||||
jstring *sourceFileName, jint *lineNum)
|
||||
{
|
||||
#ifdef INTERPRETER
|
||||
if (frame->type == frame_interpreter)
|
||||
{
|
||||
_Jv_InterpMethod *interp_meth = frame->interp.meth;
|
||||
|
@ -183,6 +186,7 @@ _Jv_StackTrace::getLineNumberForFrame(_Jv_StackFrame *frame, NameFinder *finder,
|
|||
*lineNum = interp_meth->get_source_line(frame->interp.pc);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
// Use dladdr() to determine in which binary the address IP resides.
|
||||
#if defined (HAVE_DLFCN_H) && defined (HAVE_DLADDR)
|
||||
extern char **_Jv_argv;
|
||||
|
@ -245,12 +249,14 @@ _Jv_StackTrace::FillInFrameInfo (_Jv_StackFrame *frame)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef INTERPRETER
|
||||
else if (frame->type == frame_interpreter)
|
||||
{
|
||||
_Jv_InterpMethod *interp_meth = frame->interp.meth;
|
||||
klass = interp_meth->defining_class;
|
||||
meth = interp_meth->self;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
JvFail ("Unknown frame type");
|
||||
|
||||
|
@ -495,11 +501,13 @@ _Jv_StackTrace::non_system_trace_fn (_Jv_UnwindState *state)
|
|||
if (frame->klass)
|
||||
{
|
||||
classLoader = frame->klass->getClassLoaderInternal();
|
||||
#ifdef INTERPRETER
|
||||
if (classLoader != NULL && classLoader != ClassLoader::systemClassLoader)
|
||||
{
|
||||
state->trace_data = (void *) classLoader;
|
||||
return _URC_NORMAL_STOP;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return _URC_NO_REASON;
|
||||
|
|
Loading…
Add table
Reference in a new issue