Commit 1587e80b authored by Lubomir Bulej's avatar Lubomir Bulej

Add required static functions before cleaning up agent initialization

parent 29f2b468
......@@ -723,6 +723,35 @@ __get_jvmti (JavaVM * jvm) {
}
static void
__jvmti_add_capabilities (jvmtiEnv * jvmti, const jvmtiCapabilities * caps) {
jvmtiError error = (*jvmti)->AddCapabilities (jvmti, caps);
check_jvmti_error (jvmti, error, "failed to add JVMTI capabilities");
}
static void
__jvmti_register_callbacks (
jvmtiEnv * jvmti, const jvmtiEventCallbacks * callbacks, size_t size
) {
jvmtiError error = (*jvmti)->SetEventCallbacks (jvmti, callbacks, (jint) size);
check_jvmti_error (jvmti, error, "failed to register event callbacks");
}
static void
__jvmti_enable_events (jvmtiEnv * jvmti, jvmtiEvent * events, size_t count) {
for (unsigned int i = 0; i < count; i++) {
jvmtiEvent event = events [i];
jvmtiError error = (*jvmti)->SetEventNotificationMode (
jvmti, JVMTI_ENABLE, event, NULL
);
check_jvmti_error (jvmti, error, "failed to enable JVMTI event 0x%x", event);
}
}
JNIEXPORT jint JNICALL VISIBLE
Agent_OnLoad (JavaVM * jvm, char * options, void * reserved) {
jvmtiEnv * jvmti = __get_jvmti (jvm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment