[Soot-list] How do I implement my requirement?

Quentin Sabah quentin.sabah at inria.fr
Fri Jun 1 04:56:18 EDT 2012


Hi Marc-Andre,

First of all, you are right there is a lot of cool stuff, but it took me 
months to masterize Soot. The documentation helped me a lot, and of 
course I had to read some source code.
I advise you to look at the code of the transformations included in Soot.

> 1- I have a wrapper main class around soot.Main that creates the right
> parsing option:
> String[] myArgs = new String[]{"-v", "-src-prec", "java", "-f",
> "jimple",  "-process-dir", ...
> The problem I have is that it doesn't find some of the class definitions
> deeper in the folder hierarchy. How do I make soot crawl the directory
> structure?

Use --soot-classpath to set the classpath where soot will look for 
classes. It is different from the classpath you give to the JVM.

> 2- I guess I would have to implement a new transformer class. But I am
> not sure how to make it executed though.

Soot executes in stages (Packs), the description can be found here 
http://www.bodden.de/2008/11/26/soot-packs/ . You need to add your 
transformer to the right pack, depending on what your transformer do and 
what kind of analysis it depends on. Each pack contains a sequence of 
phases, each corresponding to a transformer.

You can find the actual phases of each pack in Transform.java: 
http://www.massapi.com/class/soot/Transform.java.html

For intraprocedural transformation of the representation, add your 
transformer to the "jtp" pack. And for interprocedural transformation, 
add it to the "wjtp" pack.

> 3- Is that the -w flag? Which interprocedural analysis does it perform?

This flag enables the optional wjtp/wjop/wjap packs. Refer to 
http://www.sable.mcgill.ca/soot/tutorial/phase/phase.html for the list 
of analysis they perform.

 > 4- Same as #2 I guess

Your work starts here I guess, based on the callgraph 
(Scene.getCallGraph) you can explore any edge from any Unit: 
http://www.sable.mcgill.ca/soot/doc/soot/jimple/toolkits/callgraph/CallGraph.html


-- 
Quentin Sabah, CIFRE Ph.D. student
Grenoble University
INRIA-SARDES                   | STMicroelectronics/AST
Montbonnot, France             | Grenoble, France
mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
phone: +33 476 61 52 42        | phone: +33 476 58 44 14


More information about the Soot-list mailing list