[Soot-list] using reachingObjects in Spark

Mayur Naik mhn at cs.stanford.edu
Wed Mar 30 08:39:47 EST 2005


I get the following error when I use Spark to compute the PointsToSet of 
x.f where x is a Local and f is a SootField:

Exception in thread "main" java.lang.NullPointerException
         at soot.jimple.spark.pag.PAG$1.visit(PAG.java:173)
         at 
soot.jimple.spark.sets.HybridPointsToSet.forall(HybridPointsToSet.java:148)
         at 
soot.jimple.spark.sets.DoublePointsToSet.forall(DoublePointsToSet.java:62)
         at soot.jimple.spark.pag.PAG.reachingObjectsInternal(PAG.java:171)
         at soot.jimple.spark.pag.PAG.reachingObjects(PAG.java:148)
         at soot.jimple.spark.pag.PAG.reachingObjects(PAG.java:385)
         at Checker.internalTransform(Checker.java:31)
         at soot.SceneTransformer.transform(SceneTransformer.java:39)
         at soot.Transform.apply(Transform.java:89)
         at soot.ScenePack.internalApply(ScenePack.java:44)
         at soot.Pack.apply(Pack.java:110)
         at soot.PackManager.runWholeProgramPacks(PackManager.java:352)
         at soot.PackManager.runPacks(PackManager.java:300)
         at soot.Main.run(Main.java:179)
         at soot.Main.main(Main.java:153)
         at Main.main(Main.java:10)

I use "-w -p cg.cha off -p cg.spark on" and get the points-to results 
using pa = Scene.v().getPointsToAnalysis().  I then use 
pa.reachingObjects(x, f) to get the PointsToSet of x.f, which throws the 
above exception.  The input program is:

public class Crash {
     int f;
     public void main() {
         Crash x = new Crash();
         x.f = 1;
     }
}

The problem seems to be that the AllocNode::fields instance variable of 
the AllocNode object created for the allocation site in 'main' above is 
null (no AllocDotField is ever added to it), as a result of which the 
AllocNode::dot method returns null when it searches for field 'f'.  This 
null return value is deferenced on line 173 in PAG.java (in method 
reachingObjectsInternal).  Am I using the analysis incorrectly?

Thanks,
-- Mayur






More information about the Soot-list mailing list