1 Reply Latest reply on Apr 19, 2006 3:43 AM by Sannie Kwakman

    Using Java 1.5 JVM Tool Interface for Bytecode Instrumentati

    Martin Burger Newbie


      Java 1.5's JVM Tool Interface provides several interesting ways to insert instrumented byte code (http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#bci):

      * Static Instrumentation: The class file is instrumented before it is loaded into the VM - for example, by creating a duplicate directory of *.class files which have been modified to add the instrumentation. This method is extremely awkward and, in general, an agent cannot know the origin of the class files which will be loaded.
      * Load-Time Instrumentation: When a class file is loaded by the VM, the raw bytes of the class file are sent for instrumentation to the agent. The ClassFileLoadHook event provides this functionality. This mechanism provides efficient and complete access to one-time instrumentation.
      * Dynamic Instrumentation: A class which is already loaded (and possibly even running) is modified. This optional feature is provided by the RedefineClasses function. Classes can be modified multiple times and can be returned to their original state. The mechanism allows instrumentation which changes during the course of execution.

      Are there any plans to support that tool interface?