void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char* name;
    char* signature;
    char* generic;
    jint tcount;
    jthread* threads;
    jthread my_thread;
    jvmtiError result;
    jvmtiThreadInfo tinfo;

    /*
     * 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))
    {
        if (check_phase_and_method_debug(jvmti_env, method, SPP_LIVE_ONLY,
                    "sub_special", DEBUG_OUT)) test = false;
        return;
    }

    flag = true;
    util = true;

    result = jvmti_env->GetAllThreads(&tcount, &threads);
    fprintf(stderr, "\tnative: GetAllThreads result = %d (must be zero) \n", result);
    if (result != JVMTI_ERROR_NONE) return;

    for ( int i = 0; i < tcount; i++ )
        if (jvmti_env->GetThreadInfo(threads[i], &tinfo) == JVMTI_ERROR_NONE)
            if (!strcmp(tinfo.name, "agent"))
            {
                fprintf(stderr, "\tnative: tested thread was found\n");
                my_thread = threads[i];
                break;
            }

    result = jvmti_env->SuspendThread(my_thread);
    fprintf(stderr, "\tnative: SuspendThread result = %d (must be zero) \n", result);
    if (result != JVMTI_ERROR_NONE) return;

    result = jvmti_env->PopFrame(create_not_alive_thread(jni_env, jvmti_env));
    fprintf(stderr, "\tnative: PopFrame result = %d (must be JVMTI_ERROR_THREAD_NOT_ALIVE (15)) \n", result);
    fprintf(stderr, "\tnative: thread is %p (must be NON-zero) \n", thread);
    fflush(stderr);
    if (result == JVMTI_ERROR_THREAD_NOT_ALIVE) test = true;

    result = jvmti_env->ResumeThread(my_thread);
    fprintf(stderr, "\tnative: ResumeThread result = %d (must be zero) \n", result);
    if (result != JVMTI_ERROR_NONE) return;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    /*
     * 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;

    jlocation loc = 14;      /* Value was got as a result of experiment with
                              decoding ta_SetBreakpoint.class by jcf-dump */

    jvmtiError result = jvmti_env->SetBreakpoint(method, loc);
    fprintf(stderr, "\tnative: SetBreakpoint result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: methodID is %p \n", method);
    fprintf(stderr, "\tnative: breakpoint location is %lld \n", (long long)loc);

    CAPABILITY_TURN_OFF_VOID(can_generate_breakpoint_events);

    result = jvmti_env->ClearBreakpoint(method, loc);
    fprintf(stderr, "\tnative: ClearBreakpoint result = %d (must be JVMTI_ERROR_MUST_POSSESS_CAPABILITY (99)) \n", result);
    if (result != JVMTI_ERROR_MUST_POSSESS_CAPABILITY) return;
    test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char* name;
    char* signature;
    char* generic;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GenerateEvents(jvmtiEvent(-100));
    fprintf(stderr, "\tnative: GenerateEvents result = %d (must be JVMTI_ERROR_INVALID_EVENT_TYPE (102)) \n", result);

    if (result == JVMTI_ERROR_INVALID_EVENT_TYPE) test = true;
}
Exemplo n.º 4
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jboolean native = true;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->IsMethodNative(method, &native);
    fprintf(stderr, "\tnative: IsMethodNative result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fprintf(stderr, "\tnative: native is %d \n", native);
    fflush(stderr);

    if ((result == JVMTI_ERROR_NONE) && (!native)) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;

    jint depth = 0; /* I need current function only */
    jint varnum;
    jint slot = 0;
    jint value;
    jint modifiers = 0;
    jvmtiError result;
    jvmtiLocalVariableEntry* table;

    /*
     * 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;

    result = jvmti_env->GetMethodModifiers(method, NULL);
    fprintf(stderr, "\tnative: GetMethodModifiers result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fflush(stderr);
    if (result != JVMTI_ERROR_NULL_POINTER) return;
    test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jvmtiError result;
    jvmtiLineNumberEntry* table;
    jint count = 0;

    /*
     * 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;

    result = jvmti_env->GetLineNumberTable(method, NULL, &table);
    fprintf(stderr, "\tnative: GetLineNumberTable result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fprintf(stderr, "\tnative: table is %p \n", table);
    fflush(stderr);

    if (result == JVMTI_ERROR_NULL_POINTER) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;
    jvmtiError result;
    jobject fobject1 = 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;

    fobject1 = (jobject)exception;

    result = jvmti_env->GetObjectSize(fobject1, NULL);
    fprintf(stderr, "\tnative: GetObjectSize #1 result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    fprintf(stderr, "\tnative: fobject1 is %p \n", fobject1);

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

    if (flag) return;

    char* signature;
    char* generic;
    jint size;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetArgumentsSize(method, &size);
    fprintf(stderr, "\tnative: GetArgumentsSize result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fprintf(stderr, "\tnative: size is %d \n", size);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    if ( size == 8 ) test = true;
}
Exemplo n.º 9
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;

    char* name;
    char* signature;
    char* generic;
    jvmtiError result;

    /*
     * 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;

    jvmtiError result_1 =
        jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD);
    fprintf(stderr, "\tnative: GenerateEvents result = %d (must be zero) \n", result_1);
    fprintf(stderr, "\tnative: JVMTI_EVENT_COMPILED_METHOD_LOAD \n");

    jvmtiError result_2 =
        jvmti_env->GenerateEvents(JVMTI_EVENT_DYNAMIC_CODE_GENERATED);
    fprintf(stderr, "\tnative: GenerateEvents result = %d (must be zero) \n", result_2);
    fprintf(stderr, "\tnative: JVMTI_EVENT_DYNAMIC_CODE_GENERATED \n");

    if ( (result_1 == JVMTI_ERROR_NONE) && (result_2 == JVMTI_ERROR_NONE) )
        test = true;
}
Exemplo n.º 11
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jint count;
    unsigned char* bytecodes;
    jvmtiError result;

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

    flag = true;
    util = true;

    result = jvmti_env->GetBytecodes(method, &count, &bytecodes);
    fprintf(stderr, "\tnative: GetBytecodes result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fprintf(stderr, "\tnative: count is %d \n", count);
    fprintf(stderr, "\tnative: bytecodes is %p \n", bytecodes);
    fflush(stderr);
    if (result == JVMTI_ERROR_NONE)
    {
        if ((count > 0) && (bytecodes != NULL)) test = true;
    }
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    jvmtiError result;
    jvmtiTimerInfo info;

    /*
     * 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;

    result = jvmti_env->GetCurrentThreadCpuTimerInfo(&info);
    fprintf(stderr, "\tnative: GetCurrentThreadCpuTimerInfo result = %d (must be zero) \n", result);
    if (result != JVMTI_ERROR_NONE) return;
    fprintf(stderr, "\tnative: max_value is         %lld \n", (long long)info.max_value);
    fprintf(stderr, "\tnative: may_skip_forward is  %d \n", info.may_skip_forward);
    fprintf(stderr, "\tnative: may_skip_backward is %d \n", info.may_skip_backward);
    fprintf(stderr, "\tnative: kind              is %d \n", info.kind);

    test = true;


}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jlocation start = (jlocation)100;
    jlocation finis = (jlocation)-1;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetMethodLocation(method, &start, &finis);
    fprintf(stderr, "\tnative: GetMethodLocation result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p \n", method);
    fprintf(stderr, "\tnative: start location is %lld \n", start);
    fprintf(stderr, "\tnative: finish location is %lld \n", finis);
    fflush(stderr);

    if ((result == JVMTI_ERROR_NONE) && (start == 0) && (finis != 0)) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char *name;
    char *signature;
    char *generic;
    jniNativeInterface *function_table;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetJNIFunctionTable(&function_table);

    fprintf(stderr, "\tnative: GetJNIFunctionTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: function_table %p \n", function_table);

    if (result == JVMTI_ERROR_NONE)
        if (function_table != NULL) test = true;
}
Exemplo n.º 15
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char* name;
    char* signature;
    char* generic;
    jvmtiError result;

    /*
     * 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;


    CAPABILITY_TURN_OFF_VOID(can_generate_compiled_method_load_events);

    result = jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD);
    fprintf(stderr, "\tnative: GenerateEvents result = %d (must be JVMTI_ERROR_MUST_POSSESS_CAPABILITY (99)) \n", result);
    if (result == JVMTI_ERROR_MUST_POSSESS_CAPABILITY) test = true;
}
Exemplo n.º 16
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    jvmtiExtensionEventInfo* ext_events;
    jint counter;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetExtensionEvents(&counter, &ext_events);
    fprintf(stderr, "\tnative: GetExtensionEvents result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: counter is %d \n", counter);
    fprintf(stderr, "\tnative: ext_events ptr is %p \n", ext_events);
    fflush(stderr);
    if (result == JVMTI_ERROR_NONE) test = true;
}
Exemplo n.º 17
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    /*
     * 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;

    jlocation loc = 14;      /* Value was got as a result of experiment with
                                decoding ta_SetBreakpoint.class by jcf-dump */

    jvmtiError result = jvmti_env->SetBreakpoint(method, loc);
    fprintf(stderr, "\tnative: SetBreakpoint #1 result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: methodID is %p \n", method);
    fprintf(stderr, "\tnative: breakpoint location is %lld \n", (long long)loc);

    if (result != JVMTI_ERROR_NONE) return;

    result = jvmti_env->SetBreakpoint(method, loc);
    fprintf(stderr, "\tnative: SetLocalInt result = %d (must be JVMTI_ERROR_DUPLICATE (40)) \n", result);
    fprintf(stderr, "\tnative: methodID is %p \n", method);
    fprintf(stderr, "\tnative: breakpoint location is %lld \n", (long long)loc);
    if (result != JVMTI_ERROR_DUPLICATE) return;
    test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jboolean obsolete = true;
    jvmtiError result;

    /*
     * 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;

    CAPABILITY_TURN_OFF_VOID(can_redefine_classes);

    result = jvmti_env->IsMethodObsolete(method, &obsolete);
    fprintf(stderr, "\tnative: IsMethodObsolete 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;
    char* signature;
    char* generic;
    jint count;
    jvmtiLocalVariableEntry* table;
    jint loc_counter = 0;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetLocalVariableTable((jmethodID)jvmti_env, &count, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be JVMTI_ERROR_INVALID_METHODID (23)) \n", result);
    fflush(stderr);
    if (result == JVMTI_ERROR_INVALID_METHODID) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char* signature;
    char* generic;
    jint classes_count = 0;
    jclass* classes;
    jvmtiError result;
    jclass myclass;

    /*
     * 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;

    result = jvmti_env->GetLoadedClasses(&classes_count, &classes);
    fprintf(stderr, "\tnative: GetLoadedClasses result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: classes count is %d \n", classes_count);
    fprintf(stderr, "\tnative: classes ptr is %p \n", classes);
    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < classes_count; i++)
    {
        result = jvmti_env->GetClassSignature(classes[i], &signature, &generic);
        if (DEBUG_OUT)
        {
            fprintf(stderr, "\tnative: GetClassSignature result = %d (must be zero) \n", result);
            fprintf(stderr, "\tnative: classes ptr is %p \n", classes);
            fprintf(stderr, "\tnative: signature is %s \n", signature);
            fprintf(stderr, "\tnative: generic is %s \n", generic);
            fflush(stderr);
        }

        if (result != JVMTI_ERROR_NONE) continue;

        if (strncmp(signature, "[I", 2)) continue;
        fprintf(stderr, "\tnative: GetClassSignature result = %d (must be zero) \n", result);
        fprintf(stderr, "\tnative: classes ptr is %p \n", classes);
        fprintf(stderr, "\tnative: signature is %s \n", signature);
        fprintf(stderr, "\tnative: generic is %s \n", generic);
        fflush(stderr);
        myclass = classes[i];
        break;
    }

    result = jvmti_env->IsArrayClass( myclass, NULL );
    fprintf(stderr, "\tnative: IsInterface result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    fflush(stderr);

    if (result != JVMTI_ERROR_NULL_POINTER ) return;
    test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;

    jint depth = 0; /* I need current function only */
    jint varnum;
    jint slot = 0;
    jdouble value_1 = 55;
    jdouble value_2;
    jvmtiError result;
    jvmtiLocalVariableEntry* table;

    /*
     * 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;

    result = jvmti_env->GetLocalVariableTable(method, &varnum, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p (must be NON-zero) \n", method);
    fprintf(stderr, "\tnative: variables number is %d (must be 6) \n", varnum);
    fprintf(stderr, "\tnative: table is %p (must be NON-zero)\n", table);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < varnum; i++)
        if (!strcmp(table[i].name, "_DBL"))
            slot = table[i].slot;

    result = jvmti_env->SetLocalDouble(NULL, depth, slot, value_1);
    fprintf(stderr, "\tnative: SetLocalDouble result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: value for set is %lld (must be 55) \n", (long long)value_1);
    if (result != JVMTI_ERROR_NONE) return;

    result = jvmti_env->GetLocalDouble(NULL, depth, slot, &value_2);
    fprintf(stderr, "\tnative: GetLocalDouble result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: value after get %lld (must be 55) \n", (long long)value_2);
    if (result != JVMTI_ERROR_NONE) return;

    if (fabs(fabs(value_1) - fabs(value_2)) < 0.0001) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    char* signature;
    char* generic;
    jvmtiError result;
    jclass myclass;
    jint status = 0;
    long ethalon = JVMTI_CLASS_STATUS_VERIFIED | JVMTI_CLASS_STATUS_PREPARED | JVMTI_CLASS_STATUS_INITIALIZED;

    /*
     * 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;

    result = jvmti_env->GetMethodDeclaringClass(method, &myclass);
    if (DEBUG_OUT)
    {
        fprintf(stderr, "\tnative: GetMethodDeclaringClass result = %d (must be zero) \n", result);
        fprintf(stderr, "\tnative: method is %p \n", method);
        fprintf(stderr, "\tnative: myclass is %p \n", myclass);
    }
    if (result != JVMTI_ERROR_NONE) return;

    flag = true;
    util = true;

    result = jvmti_env->GetClassSignature(myclass, &signature, &generic);
    fprintf(stderr, "\tnative: GetClassSignature result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: classes ptr is %p \n", myclass);
    fprintf(stderr, "\tnative: signature is %s \n", signature);
    fprintf(stderr, "\tnative: generic is %s \n", generic);
    fflush(stderr);
    if (result != JVMTI_ERROR_NONE) return;

    if (strcmp(signature, "Lorg/apache/harmony/vts/test/vm/jvmti/GetClassStatus0102;")) return;

    result = jvmti_env->GetClassStatus((jclass)thread, &status);
    fprintf(stderr, "\tnative: GetClassStatus: result = %d (must be JVMTI_ERROR_INVALID_CLASS (21))\n", result);
    if (result != JVMTI_ERROR_INVALID_CLASS) return;
    test = true;
}
Exemplo n.º 24
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (flag) return;

    jvmtiError result;
    jclass myclass = NULL;
    char* signature;
    char* generic;

    /*
     * 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;

    result = jvmti_env->GetMethodDeclaringClass(method, &myclass);
    if (DEBUG_OUT)
    {
        fprintf(stderr, "\tnative: GetMethodDeclaringClass result = %d (must be zero) \n", result);
        fprintf(stderr, "\tnative: method is %p \n", method);
        fprintf(stderr, "\tnative: myclass is %p \n", myclass);
    }
    if (result != JVMTI_ERROR_NONE) return;

    flag = true;
    util = true;

    result = jvmti_env->GetClassSignature(myclass, &signature, &generic);
    fprintf(stderr, "\tnative: GetClassSignature result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: classes ptr is %p \n", myclass);
    fprintf(stderr, "\tnative: signature is %s \n", signature);
    fprintf(stderr, "\tnative: generic is %s \n", generic);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    if (!strcmp(signature, "Lorg/apache/harmony/vts/test/vm/jvmti/GetClassSignature0101;"))
    {
        test = true;
        fprintf(stderr, "\tnative: needed class was found %s \n", generic);
        fflush(stderr);
    }
}
Exemplo n.º 25
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    jvmtiError result;

    /*
     * 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;

    result = jvmti_env->GetTimerInfo(NULL);
    fprintf(stderr, "\tnative: GetTimerInfo result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    if (result == JVMTI_ERROR_NULL_POINTER) test = true;
}
Exemplo n.º 26
0
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;

    jint depth = 0; /* I need current function only */
    jint varnum;
    jint slot = 0;
    jobject value_1 = (jobject)thread;
    jvmtiError result;
    jvmtiLocalVariableEntry* table;

    /*
     * 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;

    result = jvmti_env->GetLocalVariableTable(method, &varnum, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p (must be NON-zero) \n", method);
    fprintf(stderr, "\tnative: variables number is %d (must be 6) \n", varnum);
    fprintf(stderr, "\tnative: table is %p (must be NON-zero)\n", table);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < varnum; i++)
        if (!strcmp(table[i].name, "_OBJ"))
            slot = table[i].slot;

    CAPABILITY_TURN_OFF_VOID(can_access_local_variables);

    result = jvmti_env->SetLocalObject(NULL, depth, slot, value_1);
    fprintf(stderr, "\tnative: SetLocalObject result = %d (must be JVMTI_ERROR_MUST_POSSESS_CAPABILITY (99)) \n", result);
    if (result != JVMTI_ERROR_MUST_POSSESS_CAPABILITY) return;
    test = true;
}
Exemplo n.º 27
0
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;

    jint depth = 0;
    jint varnum;
    jint slot = 0;
    jint value;
    jvmtiError result;
    jvmtiLocalVariableEntry* table;

    /*
     * 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;

    result = jvmti_env->GetLocalVariableTable(method, &varnum, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p (must be NON-zero) \n", method);
    fprintf(stderr, "\tnative: variables number is %d (must be 6) \n", varnum);
    fprintf(stderr, "\tnative: table is %p (must be NON-zero)\n", table);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < varnum; i++)
        if (!strcmp(table[i].name, "_INT"))
            slot = table[i].slot;

    result = jvmti_env->GetLocalInt(create_not_alive_thread(jni_env,
                jvmti_env), depth, slot, &value);

    fprintf(stderr, "\tnative: GetLocalInt result = %d (must be JVMTI_ERROR_THREAD_NOT_ALIVE (15)) \n", result);

    if (result == JVMTI_ERROR_THREAD_NOT_ALIVE) test = true;
}
void JNICALL callbackException(prms_EXCPT)
{
    if (flag) return;

    check_EXCPT;

    jint depth = 0; /* I need current function only */
    jint varnum;
    jint slot = 0;
    jlong value;
    jvmtiError result;
    jvmtiLocalVariableEntry* table;

    /*
     * 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;

    result = jvmti_env->GetLocalVariableTable(method, &varnum, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: method ID is %p (must be NON-zero) \n", method);
    fprintf(stderr, "\tnative: variables number is %d (must be 6) \n", varnum);
    fprintf(stderr, "\tnative: table is %p (must be NON-zero)\n", table);
    fflush(stderr);

    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < varnum; i++)
        if (!strcmp(table[i].name, "_FLT"))
            slot = table[i].slot;

    result = jvmti_env->GetLocalLong(NULL, depth, slot, &value);

    fprintf(stderr, "\tnative: GetLocalLong result = %d (must be JVMTI_ERROR_TYPE_MISMATCH (34)) \n", result);

    if (result == JVMTI_ERROR_TYPE_MISMATCH) test = true;
}
Exemplo n.º 29
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;

    if (!cont) return;
    if (flag) return;

    jint depth = 0;
    jint varnum;
    jint value;
    jint index = 0;
    jint slot = 0;
    jvmtiLocalVariableEntry* table;
    jvmtiError result;

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

    flag = true;
    util = true;

    result = jvmti_env->GetLocalVariableTable(method, &varnum, &table);
    fprintf(stderr, "\tnative: GetLocalVariableTable result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: varnum = %d (must be zero) \n", varnum);
    fprintf(stderr, "\tnative: table  = %p (must be zero) \n", table);
    if (result != JVMTI_ERROR_NONE) return;

    for (int i = 0; i < varnum; i++)
        if (!strcmp(table[i].name, "test")) index = i;

    result = jvmti_env->GetLocalInt(NULL, depth, slot, &value);
    fprintf(stderr, "\tnative: GetLocalInt result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: depth         is %d \n", depth);
    fprintf(stderr, "\tnative: table[i].slot is %d \n", table[index].slot);
    fprintf(stderr, "\tnative: value         is %p (must be 0xdeadbeef) \n", (void*)value);

    if ((result == JVMTI_ERROR_NONE) && (value == 0xdeadbeef)) test = true;
}
Exemplo n.º 30
0
void JNICALL callbackException(prms_EXCPT)
{
    check_EXCPT;
    if (flag) return;
    char* signature;
    char* generic;
    jvmtiError result;

    /*
     * 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;

    if (!stored_exception)
    {
        stored_exception = exception;
        fprintf(stderr, "\tnative: exception is %p \n", exception);
        util = true;
        return;
    }
}