[Soot-list] How to have whole-program analysis run from non-main() methods
Eric Bodden
eric.bodden at ec-spride.de
Thu Dec 15 11:45:17 EST 2011
Hi Jiaqi.
On 15 December 2011 17:31, Jiaqi Tan <tanjiaqi at gmail.com> wrote:
> I'm also doing something that I'm not sure is entirely correct: I
> first ran Soot with whole-program mode disabled, and resolved the
> class whose methods I want to use as EntryPoints up to BODIES. This
> allowed me to get a SootClass with the fully populated SootMethod's
> which I then used to populate the List<Method> to set EntryPoints.
> Then, before I performed the whole-program analysis, I ran G.reset()
> before running the regular Soot setup and running the
I don't think this is unsound, but using the wjpp pack is a simpler
way to do this. This pack runs after class resolution but before the
cg pack:
PackManager.v().getPack("wjpp").add(new Transform("wjpp.foo",new
SceneTransformer() {
@SuppressWarnings("rawtypes")
protected void internalTransform(String phaseName, Map options) {
G.v().out.println("Using all concrete methods of all application
classes as entry points.");
List<SootMethod> entryPoints = new LinkedList<SootMethod>();
for(SootClass c: Scene.v().getApplicationClasses()) {
for(SootMethod m: c.getMethods()) {
if(m.isConcrete()) {
entryPoints.add(m);
}
}
}
G.v().out.println(entryPoints.size() + " entry points.");
Scene.v().setEntryPoints(entryPoints);
}
}));
Eric
More information about the Soot-list
mailing list