JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = {JVMTI_EVENT_VM_DEATH };
    cb_death;
    jvmtiEnv *jvmti;
    jvmtiError result;
    jvmtiCapabilities    curr_caps;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    result = jvmti->GetCapabilities(&curr_caps);
    fprintf(stderr, "\tnative: GetCapabilities result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: curr_caps ptr is %p\n", &curr_caps);
    fprintf(stderr, "\tnative: curr_caps.can_tag_objects is %d\n", curr_caps.can_tag_objects);
    fflush(stderr);
    if (result == JVMTI_ERROR_NONE)
    {
        print_capabilities( curr_caps, "current");
        test = true;
    }

    util = true;
    return res;
}
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_DEATH };
    cb_init;
    cb_death;
    jvmtiEnv *jvmti;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);
    return JNI_OK;
}
Beispiel #3
0
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = {JVMTI_EVENT_VM_DEATH };
    cb_death;
    jvmtiEnv *jvmti;
    jvmtiError result;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    jint count_test = 0;
    char* name;

    for (int i = 0; i <= 116; i++ )
    {
        jvmtiError result = jvmti->GetErrorName((jvmtiError)i, &name);
        fprintf(stderr, "\tnative: GetErrorName result = %d (must be zero or 103) \n", result);
        fprintf(stderr, "\tnative: error number i = %d has name %s \n", i ,name);
        fflush(stderr);

        if (result == JVMTI_ERROR_NONE)
        {
            if (strcmp(name, errorNames[(int)i]) == 0)
                count_test++;
            else
                break;
        }
        else
        {
            if (result == JVMTI_ERROR_ILLEGAL_ARGUMENT)
            {
                if (!strcmp(errorNames[(int)i],"Illegal Error Number"))
                    count_test++;
                else
                    break;
            }
            jvmti->Deallocate((unsigned char*)name);
        }
        name = NULL;
    }

    if ( count_test == 117 ) test = true;
    return JNI_OK;
}
Beispiel #4
0
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = {JVMTI_EVENT_VM_DEATH };
    cb_death;
    jvmtiEnv *jvmti;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    jint count_test = 0;

    jvmtiError result = jvmti->GetErrorName((jvmtiError)10, NULL);
    fprintf(stderr, "\tnative: GetErrorName result = %d (must be JVMTI_ERROR_NULL_POINTER (100)) \n", result);
    if (result == JVMTI_ERROR_NULL_POINTER) test = true;

    return JNI_OK;
}
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = {JVMTI_EVENT_VM_DEATH };
    cb_death;
    jvmtiEnv *jvmti;
    jvmtiError result;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    result = jvmti->AddCapabilities(NULL);
    fprintf(stderr, "\tnative: AddCapabilities result = %d (must be JVMTI_ERROR_NULL_POINTER(100)) \n", result);
    fflush(stderr);
    if (result == JVMTI_ERROR_NULL_POINTER) test = true;

    util = true;
    return res;
}
Beispiel #6
0
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = {JVMTI_EVENT_VM_DEATH };
    cb_death;
    jvmtiEnv *jvmti;
    jvmtiError result;
    jint count_test = 0;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    util = true;

    jvmtiJlocationFormat format_ptr;

    result = jvmti->GetJLocationFormat(&format_ptr);
    fprintf(stderr, "\tnative: GetJLocationFormat result = %d (must be zero) \n", result);
    fprintf(stderr, "\tnative: format is %d \n", format_ptr);
    fflush(stderr);
    if (result == JVMTI_ERROR_NONE) test = true;
    return JNI_OK;
}
Beispiel #7
0
JNIEXPORT jint JNICALL Agent_OnLoad(prms_AGENT_ONLOAD)
{
    Callbacks CB;
    check_AGENT_ONLOAD;
    jvmtiEvent events[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_START, JVMTI_EVENT_VM_DEATH };
    cb_start;
    cb_init;
    cb_death;
    jvmtiEnv *jvmti;
    jvmtiError result;
    jint res = func_for_Agent_OnLoad_JVMTI(vm, options, reserved, &CB,
        events, sizeof(events)/4, test_case_name, DEBUG_OUT, &jvmti);

    err_phase_onload = jvmti->GetPhase(&phase_onload);
    fprintf(stderr, "\tnative: GetPhase (onload) result = %d (must be zero) \n", err_phase_onload);
    fprintf(stderr, "\tnative: phase_onload is %d \n", phase_onload);
    fflush(stderr);

    if ((err_phase_onload == JVMTI_ERROR_NONE) &&
            (phase_onload == JVMTI_PHASE_ONLOAD))
        test_phase_onload = true;

    return JNI_OK;
}