fix handling of native methods in stack walking code

This commit is contained in:
Joel Dice 2008-08-14 12:13:05 -06:00
parent 0974c36008
commit 78e48996b5

View File

@ -215,10 +215,8 @@ class MyStackWalker: public Processor::StackWalker {
if (trace and trace->nativeMethod) { if (trace and trace->nativeMethod) {
method_ = trace->nativeMethod; method_ = trace->nativeMethod;
state = NativeMethod; state = NativeMethod;
} else if (ip_) {
state = Next;
} else { } else {
state = Finish; state = Next;
} }
break; break;
@ -228,16 +226,14 @@ class MyStackWalker: public Processor::StackWalker {
if (method_) { if (method_) {
state = Method; state = Method;
} else if (trace) { } else if (trace) {
base = trace->base;
stack = static_cast<void**>(trace->stack); stack = static_cast<void**>(trace->stack);
ip_ = (stack ? *static_cast<void**>(stack) : 0); ip_ = (stack ? *static_cast<void**>(stack) : 0);
base = trace->base;
trace = trace->next;
if (trace->nativeMethod) { if (trace and trace->nativeMethod) {
method_ = trace->nativeMethod; method_ = trace->nativeMethod;
state = NativeMethod; state = NativeMethod;
} else {
trace = trace->next;
state = Next;
} }
} else { } else {
state = Finish; state = Finish;
@ -266,30 +262,23 @@ class MyStackWalker: public Processor::StackWalker {
stack = static_cast<void**>(base) + 1; stack = static_cast<void**>(base) + 1;
ip_ = (stack ? *static_cast<void**>(stack) : 0); ip_ = (stack ? *static_cast<void**>(stack) : 0);
base = *static_cast<void**>(base); base = *static_cast<void**>(base);
state = Next;
break; break;
case NativeMethod: case NativeMethod:
trace = trace->next;
state = Next;
break; break;
default: default:
abort(t); abort(t);
} }
state = Next;
} }
virtual object method() { virtual object method() {
switch (state) { // fprintf(stderr, "method %s.%s\n", &byteArrayBody
case Method: // (t, className(t, methodClass(t, method_)), 0),
return method_; // &byteArrayBody(t, methodName(t, method_), 0));
return method_;
case NativeMethod:
return trace->nativeMethod;
default:
abort(t);
}
} }
virtual int ip() { virtual int ip() {