jvmtiError interpreter_ti_getLocalCommon( jvmtiEnv*, VM_thread *thread, jint depth, jint slot, StackFrame **framePtr) { StackFrame *frame = getLastStackFrame(thread); while(depth && frame != 0) { depth--; frame = frame->prev; } // check error condition: JVMTI_ERROR_NO_MORE_FRAMES if (depth != 0) { return JVMTI_ERROR_NO_MORE_FRAMES; } // check error condition: JVMTI_ERROR_OPAQUE_FRAME if (frame->ip == 0) { return JVMTI_ERROR_OPAQUE_FRAME; } unsigned uslot = slot; // check error condition: JVMTI_ERROR_INVALID_SLOT if (uslot >= frame->locals.getLocalsNumber()) { return JVMTI_ERROR_INVALID_SLOT; } *framePtr = frame; return JVMTI_ERROR_NONE; }
jvmtiError interpreter_ti_get_frame_count(jvmtiEnv*, VM_thread *thread, jint* count_ptr) { StackFrame *frame = getLastStackFrame(thread); *count_ptr = 0; while(frame != 0) { (*count_ptr)++; frame = frame->prev; } (*count_ptr) -= skip_old_frames(thread); return JVMTI_ERROR_NONE; }
static jint skip_old_frames(VM_thread *thread) { if (NULL == getLastStackFrame(thread)) return 0; StackFrame* first_frame = (StackFrame*)(thread->firstFrame); if (first_frame) { Class *clss = method_get_class(first_frame->method); assert(clss); if (strcmp(method_get_name(first_frame->method), "runImpl") == 0 && strcmp(class_get_name(clss), "java/lang/Thread") == 0) { return 1; } } return 0; }
ObjectHandle handle = (ObjectHandle) value; frame->locals(slot).ref = COMPRESS_INTERP(handle->object); return JVMTI_ERROR_NONE; } jvmtiError interpreter_ti_getStackTrace( jvmtiEnv * UNREF env, VM_thread *thread, jint start_depth, jint max_frame_count, jvmtiFrameInfo *frame_buffer, jint *count_ptr) { jint start; StackFrame *frame = getLastStackFrame(thread); jint depth; interpreter_ti_get_frame_count(env, thread, &depth); if (start_depth < 0) { start = depth + start_depth; if (start < 0) return JVMTI_ERROR_ILLEGAL_ARGUMENT; } else start = start_depth; // skip start_depth of frames while (start) {
static inline StackIterator_interp* interp_si_create_from_native(VM_thread *thread) { return getLastStackFrame(thread); }