I want to write a simple java agent which can print the name of a method called by the java program instrumented.
For example, my java program I want to instrument is:
public class TestInstr {
public static void sayHello() {
System.out.println("Hello !");
}
public static void main(String args[]) {
sayHello();
sayHello();
sayHello();
}
}
I would like to display something like this :
method sayHello has been called
Hello !
method sayHello has been called
Hello !
method sayHello has been called
Hello !
Thanks for your help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…