java - How to communicate with jvmti agent attached on a running JVM -
java - How to communicate with jvmti agent attached on a running JVM -
i wanted know how communicate jvmti agent attached on running jvm using attach api. when communicate ,here's meant : want phone call native functions located on jvmti agent , theses function homecoming me info (like field values) of running jvm "infected" before agent.
here's agent; did not add together native functions yet:
#include <jvmti.h> jniexport jint jnicall agent_onattach(javavm* vm, char* options, void* reserved); jvmtienv* create_jvmti_env(javavm* vm); jnienv* create_jni_env(javavm* vm); void init_jvmti_capabilities(jvmtienv* env); jniexport jint jnicall agent_onattach(javavm* vm, char* options, void* reserved) { jvmtienv* jvmti = create_jvmti_env(vm); init_jvmti_capabilities(jvmti); jnienv* jni = create_jni_env(vm); homecoming jni_ok; } jvmtienv* create_jvmti_env(javavm* vm) { jvmtienv* env; vm->getenv((void **) &env, jvmti_version_1_2); homecoming env; } jnienv* create_jni_env(javavm* vm) { jnienv* env; vm->getenv( (void **) &env, jni_version_1_8); homecoming env; } void init_jvmti_capabilities(jvmtienv* env) { jvmticapabilities capabilities; env->getpotentialcapabilities( &capabilities); env->addcapabilities( &capabilities); }
how communicate jvmti agent attached on running jvm using attach api.
if understand doing here correctly, exclusively how external application communicates agent, implement ... starting designing or choosing wire-protocol going use.
java jvmti
Comments
Post a Comment