1 package test; 2 3 import alt.jiapi.InstrumentationDescriptor; 4 import alt.jiapi.Instrumentor; 5 import alt.jiapi.InstrumentorChain; 6 import alt.jiapi.JiapiException; 7 import alt.jiapi.instrumentor.*; 8 9 13 public class MCITest extends InstrumentorTest { 14 public static void main(String [] args) throws Exception { 15 MCITest mci = new MCITest(); 16 mci.run(args); 17 } 18 19 public MCITest() throws JiapiException { 20 InstrumentorChain chain = new InstrumentorChain(); 21 22 Instrumentor dispatcher = new MethodDispatcherInstrumentor(); 23 Instrumentor si = new GrepInstrumentor(new MethodCallStrategy()); 24 TailInstrumentor after = new TailInstrumentor(); 25 MethodCallInstrumentor mci = new MethodCallInstrumentor(this); 26 27 chain.add(dispatcher); 28 chain.add(si); chain.add(after); chain.add(mci); 32 InstrumentationDescriptor id = new InstrumentationDescriptor(); 33 addInclusionRules(id, getInclusionRules()); 34 addExclusionRules(id, getExclusionRules()); 35 id.addChain(chain); 36 37 ctx.addInstrumentationDescriptor(id); 38 } 39 40 public void hookMethod(Object _this, String m) { 42 System.out.println("Just called " + m); 43 } 44 } 45 | Popular Tags |