• Home
  • Raw
  • Download

Lines Matching refs:jvmti

74 static AgentInfo* GetAgentInfo(jvmtiEnv* jvmti) {  in GetAgentInfo()  argument
76 CHECK_EQ(jvmti->GetEnvironmentLocalStorage(reinterpret_cast<void**>(&ai)), JVMTI_ERROR_NONE); in GetAgentInfo()
83 explicit JvmtiAllocator(jvmtiEnv* jvmti) : jvmti_(jvmti) {} in JvmtiAllocator() argument
136 static void CbClassFileLoadHook(jvmtiEnv* jvmti, in CbClassFileLoadHook() argument
148 AgentInfo* ai = GetAgentInfo(jvmti); in CbClassFileLoadHook()
155 LOG(INFO) << "Got CFLH for " << name << " on env " << static_cast<void*>(jvmti); in CbClassFileLoadHook()
156 JvmtiAllocator allocator(jvmti); in CbClassFileLoadHook()
168 static jclass FindClass(jvmtiEnv* jvmti, JNIEnv* env, const std::string& name) { in FindClass() argument
180 if (jvmti->GetLoadedClasses(&cnt, &klasses) != JVMTI_ERROR_NONE) { in FindClass()
186 if (jvmti->GetClassSignature(klasses[i], &sig, nullptr) != JVMTI_ERROR_NONE) { in FindClass()
194 jvmti->Deallocate(reinterpret_cast<unsigned char*>(klasses)); in FindClass()
203 static void RedefineClass(jvmtiEnv* jvmti, JNIEnv* env, const std::string& klass_name) { in RedefineClass() argument
205 if ((klass = FindClass(jvmti, env, klass_name)) == nullptr) { in RedefineClass()
211 jvmti->RetransformClasses(1, &klass); in RedefineClass()
215 static void AgentMain(jvmtiEnv* jvmti, JNIEnv* jni, void* arg ATTRIBUTE_UNUSED) { in AgentMain() argument
216 AgentInfo* ai = GetAgentInfo(jvmti); in AgentMain()
218 jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); in AgentMain()
221 LOG(INFO) << "Redefining class " << klass_name << " with " << static_cast<void*>(jvmti); in AgentMain()
226 RedefineClass(jvmti, jni, klass_name); in AgentMain()
230 static void CbVmInit(jvmtiEnv* jvmti, JNIEnv* env, jthread thr ATTRIBUTE_UNUSED) { in CbVmInit() argument
260 jvmti->RunAgentThread(thread.get(), AgentMain, nullptr, JVMTI_THREAD_MIN_PRIORITY); in CbVmInit()
267 jvmtiEnv* jvmti = nullptr; in AgentStart() local
269 if (vm->GetEnv(reinterpret_cast<void**>(&jvmti), JVMTI_VERSION_1_1) != JNI_OK || in AgentStart()
270 jvmti == nullptr) { in AgentStart()
285 if (jvmti->AddCapabilities(&caps) != JVMTI_ERROR_NONE) { in AgentStart()
293 jvmti->SetEventCallbacks(&cb, sizeof(cb)); in AgentStart()
294 jvmti->SetEnvironmentLocalStorage(reinterpret_cast<void*>(ai)); in AgentStart()
296 jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); in AgentStart()
301 jvmti->GetCurrentThread(&thr); in AgentStart()
302 CbVmInit(jvmti, jni, thr); in AgentStart()