Class InstrumentationFactory
- java.lang.Object
-
- com.tonic.analysis.instrumentation.factory.InstrumentationFactory
-
public class InstrumentationFactory extends Object
Factory for creating instrumentation IR instructions.
-
-
Constructor Summary
Constructors Constructor Description InstrumentationFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<IRInstruction>createArrayLoadHook(ArrayLoadHook hook, ArrayAccessInstruction arrayAccess)Creates instructions to invoke an array load hook.List<IRInstruction>createArrayStoreHook(ArrayStoreHook hook, ArrayAccessInstruction arrayAccess)Creates instructions to invoke an array store hook.List<IRInstruction>createExceptionHook(ExceptionHook hook, SSAValue exceptionValue, String className, String methodName)Creates instructions to invoke an exception hook.List<IRInstruction>createFieldReadHook(FieldReadHook hook, FieldAccessInstruction fieldAccess)Creates instructions to invoke a field read hook.List<IRInstruction>createFieldWriteHook(FieldWriteHook hook, FieldAccessInstruction fieldAccess)Creates instructions to invoke a field write hook.List<IRInstruction>createMethodCallHook(MethodCallHook hook, InvokeInstruction invoke, boolean isBefore)Creates instructions to invoke a method call hook.List<IRInstruction>createMethodEntryHook(MethodEntryHook hook, IRMethod irMethod, MethodEntry sourceMethod, String className)Creates instructions to invoke a method entry hook.List<IRInstruction>createMethodExitHook(MethodExitHook hook, IRMethod irMethod, ReturnInstruction returnInstr, MethodEntry sourceMethod, String className)Creates instructions to invoke a method exit hook.
-
-
-
Method Detail
-
createMethodEntryHook
public List<IRInstruction> createMethodEntryHook(MethodEntryHook hook, IRMethod irMethod, MethodEntry sourceMethod, String className)
Creates instructions to invoke a method entry hook.- Parameters:
hook- the method entry hook configurationirMethod- the IR method being instrumentedsourceMethod- the source method entryclassName- the class name (internal format)- Returns:
- list of IR instructions to insert
-
createMethodExitHook
public List<IRInstruction> createMethodExitHook(MethodExitHook hook, IRMethod irMethod, ReturnInstruction returnInstr, MethodEntry sourceMethod, String className)
Creates instructions to invoke a method exit hook.- Parameters:
hook- the method exit hook configurationirMethod- the IR method being instrumentedreturnInstr- the return instruction being hookedsourceMethod- the source method entryclassName- the class name (internal format)- Returns:
- list of IR instructions to insert
-
createFieldWriteHook
public List<IRInstruction> createFieldWriteHook(FieldWriteHook hook, FieldAccessInstruction fieldAccess)
Creates instructions to invoke a field write hook.- Parameters:
hook- the field write hook configurationfieldAccess- the field store instruction being hooked- Returns:
- list of IR instructions to insert
-
createArrayStoreHook
public List<IRInstruction> createArrayStoreHook(ArrayStoreHook hook, ArrayAccessInstruction arrayAccess)
Creates instructions to invoke an array store hook.- Parameters:
hook- the array store hook configurationarrayAccess- the array store instruction being hooked- Returns:
- list of IR instructions to insert
-
createFieldReadHook
public List<IRInstruction> createFieldReadHook(FieldReadHook hook, FieldAccessInstruction fieldAccess)
Creates instructions to invoke a field read hook.- Parameters:
hook- the field read hook configurationfieldAccess- the field load instruction being hooked- Returns:
- list of IR instructions to insert
-
createArrayLoadHook
public List<IRInstruction> createArrayLoadHook(ArrayLoadHook hook, ArrayAccessInstruction arrayAccess)
Creates instructions to invoke an array load hook.- Parameters:
hook- the array load hook configurationarrayAccess- the array load instruction being hooked- Returns:
- list of IR instructions to insert
-
createMethodCallHook
public List<IRInstruction> createMethodCallHook(MethodCallHook hook, InvokeInstruction invoke, boolean isBefore)
Creates instructions to invoke a method call hook.- Parameters:
hook- the method call hook configurationinvoke- the invoke instruction being hookedisBefore- true if this is a before-call hook- Returns:
- list of IR instructions to insert
-
createExceptionHook
public List<IRInstruction> createExceptionHook(ExceptionHook hook, SSAValue exceptionValue, String className, String methodName)
Creates instructions to invoke an exception hook.- Parameters:
hook- the exception hook configurationexceptionValue- the exception valueclassName- the class namemethodName- the method name- Returns:
- list of IR instructions to insert
-
-