Ejemplo n.º 1
0
jint 
eventFilter_setStepFilter(HandlerNode *node, jint index, 
                          jthread thread, jint size, jint depth)
{
    jint error;
    JNIEnv *env = getEnv();
    StepFilter *filter = &FILTER(node, index).u.Step;
    if (index >= FILTER_COUNT(node)) {
        return JVMDI_ERROR_ILLEGAL_ARGUMENT;
    }
    if (KIND(node) != JVMDI_EVENT_SINGLE_STEP) { 
        return JVMDI_ERROR_ILLEGAL_ARGUMENT;
    }

    /* Create a thread ref that will live beyond */
    /* the end of this call */
    thread = (*env)->NewGlobalRef(env, thread);
    if (thread == NULL) {
        return JVMDI_ERROR_OUT_OF_MEMORY;
    }
    error = stepControl_beginStep(thread, size,depth, node);
    if (error != JVMDI_ERROR_NONE) {
        (*env)->DeleteGlobalRef(env, thread);
        return error;
    }
    FILTER(node, index).modifier = JDWP_REQUEST_MODIFIER(Step);
    filter->thread = thread;
    filter->depth = depth;
    filter->size = size;
    return JVMDI_ERROR_NONE;
}
Ejemplo n.º 2
0
jvmtiError
eventFilter_setStepFilter(HandlerNode *node, jint index,
                          jthread thread, jint size, jint depth)
{
    jvmtiError error;
    JNIEnv *env = getEnv();
    StepFilter *filter = &FILTER(node, index).u.Step;
    if (index >= FILTER_COUNT(node)) {
        return AGENT_ERROR_ILLEGAL_ARGUMENT;
    }
    if (NODE_EI(node) != EI_SINGLE_STEP) {
        return AGENT_ERROR_ILLEGAL_ARGUMENT;
    }

    /* Create a thread ref that will live beyond */
    /* the end of this call */
    saveGlobalRef(env, thread, &(filter->thread));
    error = stepControl_beginStep(env, filter->thread, size, depth, node);
    if (error != JVMTI_ERROR_NONE) {
        tossGlobalRef(env, &(filter->thread));
        return error;
    }
    FILTER(node, index).modifier = JDWP_REQUEST_MODIFIER(Step);
    filter->depth = depth;
    filter->size = size;
    return JVMTI_ERROR_NONE;
}