[Soot-list] Using Soot as a library / PhaseOptions
Matthew Hague
Matthew.Hague at comlab.ox.ac.uk
Wed Nov 26 12:48:59 EST 2008
Hi,
I am attempting to use Soot as a library, as in this example from the mailing
list:
http://www.sable.mcgill.ca/pipermail/soot-list/2008-July/001862.html
> public static void main(String[] args) {
>
> if (args.length == 0) {
> System.out.println("Usage: java RunLiveAnalysis
> class_to_analyse");
> System.exit(0);
> }
>
> SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
>
> sClass.setApplicationClass();
>
> Iterator methodIt = sClass.getMethods().iterator();
> while (methodIt.hasNext()) {
> SootMethod m = (SootMethod)methodIt.next();
> Body b = m.retrieveActiveBody();
> ....
I would like to make use of the various optimisations and analyses provided
by Soot, and be able to add some of my own.
If i add a line:
PhaseOptions.v().setPhaseOption("jb.lp", "on");
towards the top of the main method, then the local variable packer is
(automatically) run on the Jimple retrieved from m.retrieveActiveBody().
However, when i try,
PhaseOptions.v().setPhaseOption("jap.npc", "on");
I do not get null pointer tags as expected. I have also tried enabling "jap"
explicitly, and using Options.v().parse(<options>) to set command line
options (instead of using ParseOptions directly), all to no avail.
Does anyone know what i might be missing?
I can call NullPointerTagger.v().transform(body) each time a body is
retrieved, if necessary, but this does not seem like the neatest solution.
Thanks,
Matthew Hague
More information about the Soot-list
mailing list