Another idea worth considering is completely moving the instrumenting class loader out of the slave VM. The Java VM Tool Interface (JVMTI) has a
ClassFileLoadHook that provides the raw byte array just before the class is loaded. This should yield the best mapping between original and instrumented classes, just as good as offline instrumentation since the slave VM doesn’t do anything it doesn’t do with the original files.
The only problem right now is that this hook is only available in JVMTI, which is a native C language interface. It’s not available in JDI. There is a new addition to the Java 5.0 API,
java.lang.instrument which may be able to do the same, but I haven’t looked at it yet and I don’t know how it influences the VM it’s running in.