//__CUSTOM_METHODS__ bool FloatMatrix4::predraw(string& message) { glUniformMatrix4fv(m_UniformLocation, 1, true, m_Value); CHECK_ERROR_AND_RETURN(message); return true; }
static jint tagThreads(ThreadModule * threadModule, jvmtiEnv * jvmti, jlong beginTag) { jthread * threads; jvmtiError err; int i; err = (*jvmti)->GetAllThreads(jvmti, &threadModule->threadCount, &threads); CHECK_ERROR_AND_RETURN(jvmti, err, "get all thread error", JNI_ERR); threadModule->threadInfos = calloc(threadModule->threadCount, sizeof(ThreadInfo)); for (i = 0; i < threadModule->threadCount; i++) { jvmtiThreadInfo aInfo; int tag = beginTag + i; err = (*jvmti)->GetThreadInfo(jvmti, threads[i], &aInfo); print_if_error(jvmti, err, "get thread info error"); if (err == JVMTI_ERROR_NONE) { (*jvmti)->SetTag(jvmti, threads[i], tag); threadModule->threadInfos[i].name = strdup(aInfo.name); #ifdef DEBUG ulog("tag thread: %s to %d\n", threadModule->threadInfos[i].name, tag); #endif deallocate(jvmti, aInfo.name); } } deallocate(jvmti, threads); return JNI_OK; }
JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *options, void *reserved) { jint rc; jvmtiEnv *jvmti; JNIEnv *jniEnv; jvmtiError err; char * optionType; char * otherOption = NULL; /* Get JVMTI environment */ jvmti = NULL; rc = (*vm)->GetEnv(vm, (void **) &jvmti, JVMTI_VERSION); if (rc != JNI_OK) { ulog("ERROR: Unable to create jvmtiEnv, error=%d\n", rc); return JNI_ERR; } if (jvmti == NULL) { ulog("ERROR: No jvmtiEnv* returned from GetEnv\n"); return JNI_ERR; } /////////////jni///////////// rc = (*vm)->GetEnv(vm, (void **) &jniEnv, JNI_VERSION_1_2); if (rc != JNI_OK) { ulog("ERROR: Unable to create jnienv, error=%d\n", rc); return JNI_ERR; } if (jvmti == NULL) { ulog("ERROR: No jnienv* returned from GetEnv\n"); return JNI_ERR; } //////////////////////////// #ifdef DEBUG ulog("options: %s\n", options); #endif parseOption(options, &optionType, &otherOption); #ifdef DEBUG ulog("optionType:%s, otherOption: %s\n", optionType, otherOption==NULL?"":otherOption); #endif if (strcmp(optionType, DUMP_REFER) == 0) { rc = printReferAction(jvmti, jniEnv, otherOption); } else if (strcmp(optionType, DUMP_ROOT) == 0) { rc = printRootReferAction(jvmti, otherOption); } else { rc = JNI_ERR; ulog("ERROR: invalid options\n"); } err = (*jvmti)->DisposeEnvironment(jvmti); CHECK_ERROR_AND_RETURN(jvmti, err, "DisposeEnvironment error", JNI_ERR); return rc; }