Exemple #1
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    jvmtiError result;
    jclass myclass = NULL;
    jfieldID myfield = NULL;

    /*
     * Function separate all other exceptions in all other method
     */
    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
                "special_method", DEBUG_OUT)) return;

    flag = true;
    util = true;

    if (!is_needed_field_found(jvmti_env, "SetFieldAccessWatch0102.java", "first_field", &myclass, &myfield, DEBUG_OUT))
        return;

    CAPABILITY_TURN_OFF_VOID(can_generate_field_access_events);

    result = jvmti_env->SetFieldAccessWatch(myclass, myfield);
    fprintf(stderr, "\tnative: SetFieldAccessWatch result = %d (must be JVMTI_ERROR_MUST_POSSESS_CAPABILITY (99)) \n", result);
    fflush(stderr);

    if (result == JVMTI_ERROR_MUST_POSSESS_CAPABILITY) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    jvmtiError result;
    jclass myclass = NULL;
    jfieldID myfield = NULL;

    /*
     * Function separate all other exceptions in all other method
     */
    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
                "special_method", DEBUG_OUT)) return;

    flag = true;
    util = true;

    if (!is_needed_field_found(jvmti_env, "SetFieldModificationWatch0105.java", "third_field", &myclass, &myfield, DEBUG_OUT))
        return;

    result = jvmti_env->SetFieldModificationWatch(myclass, NULL);
    fprintf(stderr, "\tnative: SetFieldModificationWatch result = %d (must be JVMTI_ERROR_INVALID_FIELDID (25)) \n", result);
    if (result == JVMTI_ERROR_INVALID_FIELDID) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    jvmtiError result;
    jclass myclass = NULL;
    jfieldID myfield = NULL;

    /*
     * Function separate all other exceptions in all other method
     */
    if (!check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
                "special_method", DEBUG_OUT)) return;

    flag = true;
    util = true;

    if (!is_needed_field_found(jvmti_env, "ClearFieldAccessWatch0101.java", "first_field", &myclass, &myfield, DEBUG_OUT))
        return;

    result = jvmti_env->SetFieldAccessWatch(myclass, myfield);
    fprintf(stderr, "\tnative: SetFieldAccessWatch result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: class is %p \n", myclass);
    fprintf(stderr, "\tnative: field is %p \n", myfield);
    fflush(stderr);
    if (result != JVMTI_ERROR_NONE) return;

    result = jvmti_env->ClearFieldAccessWatch(myclass, myfield);
    fprintf(stderr, "\tnative: ClearFieldAccessWatch result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: class is %p \n", myclass);
    fprintf(stderr, "\tnative: field is %p \n", myfield);
    fflush(stderr);
    if (result != JVMTI_ERROR_NONE) return;

    test = true;
}