[Soot-list] Using Soot as a library / PhaseOptions
Eric Bodden
eric.bodden at mail.mcgill.ca
Wed Nov 26 13:06:46 EST 2008
Matthew, the "jap" pack is run after all other packs.
I recommend reading the PLDI tutorial
(http://www.sable.mcgill.ca/soot/tutorial/pldi03/tutorial.pdf) in
particular the diagram on page number 100.
To run your analysis after the jap pack has been applied, simply add
your transformer to the jap pack.
Eric
2008/11/26 Matthew Hague <Matthew.Hague at comlab.ox.ac.uk>:
>
> 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
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
--
Eric Bodden
Sable Research Group, McGill University, Montréal, Canada
Got an interesting job offer? http://www.bodden.de/hire-me/
More information about the Soot-list
mailing list