-
Notifications
You must be signed in to change notification settings - Fork 0
Instrumenter
Instrumenter
is a singleton class designed to facilitate the addition of log statements to SootMethods, which is part of the AndroSpecter library.
Instrumenter
helps in adding log statements at specific points within methods or across multiple methods within an application. This allows tracking the flow and behavior of the application.
Accesses the singleton instance of the Instrumenter
class.
Usage:
Instrumenter instrumenter = Instrumenter.v();
Adds log statements to all methods of application classes.
addLogStatement(Chain<Unit> units, Unit insertionPoint, String tagToLog, String messageToLog, Body b)
Inserts a log statement at a specified location within the body of a method.
Modifies all method calls within a body to include a log statement that logs the signatures of the calling and called methods.
Inserts a log statement right after all identity statements in the given method.
Instrumenter instrumenter = Instrumenter.v();
Transform transform = instrumenter.addLogToAllMethodCalls("DEBUG_TAG", "jbop");
PackManager.v().getPack("jbop").add(transform);
Instrumenter instrumenter = Instrumenter.v();
SootMethod method = ...; // Obtain a SootMethod reference
instrumenter.addLogToMethod(method, "INFO_TAG", "Method called");
Instrumenter instrumenter = Instrumenter.v();
Chain<Unit> units = ...; // Obtain the chain of units
Unit insertionPoint = ...; // Obtain the insertion point
String tagToLog = "DEBUG";
String messageToLog = "Log Message";
Body body = ...; // Obtain the body
instrumenter.addLogStatement(units, insertionPoint, tagToLog, messageToLog, body);
These examples showcase how to use Instrumenter
to insert customized log statements within methods of an Android application.