예제 #1
0
/*
 * Called once to build the initial prepared class hash table.
 */
void
classTrack_initialize()
{
    JNIEnv *env = getEnv();
    jint classCount;    
    jclass *classes = allLoadedClasses(&classCount);
    jint i;

    if (classes == NULL) {
        ALLOC_ERROR_EXIT();
    }
    table = jdwpClearedAlloc(HASH_SLOT_COUNT * sizeof(KlassNode *));
    if (table == NULL) {
        jdwpFree(classes);
        ALLOC_ERROR_EXIT();
    }
    for (i=0; i<classCount; i++) {
        jclass klass = classes[i];

        /* Filter out unprepared classes (arrays may or
         * may not be marked as prepared) */
        jboolean preped = (classStatus(klass) & JVMDI_CLASS_STATUS_PREPARED) != 0;
        if (preped || isArrayClass(klass)) {
            classTrack_addPreparedClass(env, klass);
        }
        (*env)->DeleteGlobalRef(env, klass);
    }
    jdwpFree(classes);
}    
예제 #2
0
static void 
writeClassEvent(JNIEnv *env, PacketOutputStream *out, EventInfo *evinfo)
{
    jbyte classTag;
    jint status;
    char *signature = NULL;
    jvmtiError error;

    classTag = referenceTypeTag(evinfo->clazz);
    error = classSignature(evinfo->clazz, &signature, NULL);
    if (error != JVMTI_ERROR_NONE) {
        EXIT_ERROR(error,"signature");
    }
    status = classStatus(evinfo->clazz);

    (void)outStream_writeObjectRef(env, out, evinfo->thread);
    (void)outStream_writeByte(out, classTag);
    (void)outStream_writeObjectRef(env, out, evinfo->clazz);
    (void)outStream_writeString(out, signature);
    (void)outStream_writeInt(out, map2jdwpClassStatus(status));
    jvmtiDeallocate(signature);
}