[Soot-list] Using Soot as a library / PhaseOptions
Matthew Hague
Matthew.Hague at comlab.ox.ac.uk
Wed Nov 26 17:23:37 EST 2008
Hi,
Thanks for the reply.
The problem seems to be that the jap pack is not being run at all. If i use:
PhaseOptions.v().setPhaseOption("jb.lp", "on");
then the local packer runs as expected (and does not run if i don't enable
it). But, if i use:
PhaseOptions.v().setPhaseOption("jap.npc", "on");
there are no null pointer tags (similarly for other jap tools). I can use:
PackManager.v().runPacks(); // (or runBodyPacks())
after loading a class. However, since the jb.lp option does not require the
extra step (which causes further problems for me at the moment...), i suspect
i'm missing something else.
Although i plan to add my own annotation tool, my immediate concern is
getting the null pointer annotator to run.
Thanks,
Matt
On Wed, Nov 26, 2008 at 01:06:46PM -0500, Eric Bodden wrote:
> 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