With the following code I can get the jimple
representation of a java .class
file:
soot.Main.main(args);
SootClass mainClass = Scene.v().getMainClass();
String methodSignature = "void main(java.lang.String[])";
SootMethod mainMethod = mainClass.getMethod(methodSignature);
Body jimpleBody = mainMethod.retrieveActiveBody();
However, I need to know the map from .class
to jimple
. In detail, For a certain line of code in the .class
file, I want to know its corresponding jimple
representation. Since one line of code can be converted into multiple jimple
codes, this map can be one-to-many. Does there exist any API or method that can solve this problem?
I find the solution here. In detail, for a
Unit
you can use