void StepRequest::Init()

in modules/jpda/src/main/native/jdwp/common/agent/core/AgentEventRequest.cpp [230:274]


void StepRequest::Init(JNIEnv *jni, jthread thread, jint size, jint depth)
    throw(AgentException)
{
    m_thread = jni->NewGlobalRef(thread);
    if (m_thread == 0) {
        throw OutOfMemoryException();
    }
    m_size = size;
    m_depth = depth;

    if (m_depth != JDWP_STEP_INTO || m_size != JDWP_STEP_MIN) {
        jvmtiError err;
        JVMTI_TRACE(err, GetJvmtiEnv()->GetFrameCount(m_thread, &m_frameCount));
        if (err != JVMTI_ERROR_NONE) {
            m_frameCount = -1;
        }
        if (m_size == JDWP_STEP_LINE) {
            m_lineNumber = GetCurrentLine();
        }
    }

    if (m_depth == JDWP_STEP_INTO || m_frameCount > 0) {
        // add internal FramePop event request for the thread
        m_framePopRequest =
            new AgentEventRequest(JDWP_EVENT_FRAME_POP, JDWP_SUSPEND_NONE, 1);
        m_framePopRequest->AddModifier(new ThreadOnlyModifier(jni, thread), 0);
        GetRequestManager().AddInternalRequest(jni, m_framePopRequest);
        jvmtiError err;
        JVMTI_TRACE(err, GetJvmtiEnv()->NotifyFramePop(m_thread, 0));
        if (err == JVMTI_ERROR_OPAQUE_FRAME) {
            m_isNative = true;
        }
    }

    if (m_depth == JDWP_STEP_INTO ||
        (m_depth == JDWP_STEP_OUT && m_frameCount > 0 && m_isNative) ||
        (m_depth == JDWP_STEP_OVER && m_frameCount > 0 &&
         (m_size == JDWP_STEP_MIN || m_isNative || m_lineNumber != -1)))
    {
        ControlSingleStep(true);
    }

    JDWP_TRACE_EVENT("step start: size=" << m_size << ", depth=" << m_depth
        << ", frame=" << m_frameCount << ", line=" << m_lineNumber);
}