I've been trying to do instrumentation using JVMTI nad ASM. What I've been doing is getting the classes via a ClassFileLoad hook, and then piping the bytes to a separate process that uses ASM to modify the class, and sends the modified class back over a pipe, since java_crw_demo is not really flexible enough to do what I want. However, since I'm still modifying classes that are used while the VM boots, I need to duplicate some of what java_crw_demo does to handle "system classes" in my ASM program. I seem to be having some trouble doing it correctly though (I some how get null pointer exceptions while the VM is still booting). Does any one have some (non-null) pointers?
Is there anything in jvmti_crw_demo other than skip_method that discriminates as far as what methods are transformed?
I see where skip_method skips init, clinit, currentThread, in skip_method. But what does it mean for the length of these methods to be 1, and why is that a special case?
Hmm, unfortunately ASM seems to provide no way for me to check the code length (at least not that I can find) but since those methods are empty, I think ASM will skip them (since it should never visit any bytecodes if there aren't any there). But do you have an example of a class with a method that has length 1 so that I could run it through my instrumenting code and see what, if any thing, it does? I suppose if you do not know one off the top of your head I could just make java_crw_demo report to me the name of one.