Question
I'm trying to use the JVMTI in order to write a little Java debugger in C++.
I read here:
http://java.sun.com/developer/technicalArticles/Programming/jvmti/
that the JVM should call an exported method defined like
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved)
But I don't see this method called when I run my debugger even if I start my java target program.
Is this the correct way to start this JVMTI? Is it supposed to be called automatically when a java program is started?
Solution
The debug agent code is loaded when you supply "-agentlib" command-line argument while calling a Java program, like:
$java -agentlib:jvmti_debugger javaSampleClass
A little more recent article about it is located here.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow