[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

spark newbie question



I'm using the SparkTransformer to create the callgraph using the PAG Points-to framework. I find that the resulting call-graph does not contain all the methods.

This is how I call the transformer :

SootClass c = Scene.v().loadClassAndSupport("SampleClass");
Scene.v().setEntryPoints(c.getMethods());
Map sparkOptions = new HashMap();
sparkOptions.put("enabled", "true");
sparkOptions.put("on-fly-cg", "true");
sparkOptions.put("set-impl", "hybrid");
sparkOptions.put("propagator", "worklist");
sparkOptions.put("verbose", "true");
SparkTransformer.v().transform("cg", sparkOptions);


Here are my input classes:


public class SampleClass {
   Object fld;

   void method1() {
       fld = "TEST STRING 1";
       SampleClass2 sc2 = new SampleClass2();
       sc2.testMethod();
       method2();
   }

   void method2() {
       fld = new java.util.ArrayList();
   }
}

public class SampleClass2{
   Object fld;

public SampleClass2() {}

   public void testMethod() {
       fld = "TESTMETHOD";
   }
}


The call graph that I get as output does not contain an edge from SampleClass.method1() to SampleClass.method2() although it does contain the edge from SampleClass.method1() to both SampleClass2.(testMethod() + <init>).


If I use the DumbPointerAnalysis (i.e. just Scene.v().getCallGraph()) I do actually get all the edges.

Given the extreme simplicity of this example I assume this is expected behavior from SPARK. Is there an explanation for why this is so?

Thanks in advance,
Nikhil