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

Spark Pointer analysis



 
hi,
 
heres what i intend to do. I need a points to analysis graph at every program point and based on that i do a data flow analysis.
 
Now, when i generate the PAG as shown below, i get around  4757 alloc nodes which i understand are created from the standard class library.
 
Now, for a particular jimple statement i want to know
 
a. the nodes in the statement and
b. the nodes pointed to by these nodes.
 
for part a. i tried doing this :
 
If its an assignment statement, 
 
Value lval = assignStmt.getLeftOp();
Value rval = assignStmt.getRightOp();
VarNode vLeftNode = findVarNode(lval);
VarNode vRightNode = findVarNode(rval);
System.out.println("VarNode (Right): ",+vRightNode.toString());
System.out.println("VarNode (Left): ",+vLeftNode.toString());
 
However, this gives me a null pointer exception. Am I doing something wrong here ??? and if that gets solved how do i solve part b.
 
Please help.
 
Regards,
 
Nikhil
PS: the code for construction of PAG
 
SootClass c = Scene.v().loadClassAndSupport("hello");
  c.setApplicationClass();
  Scene.v().setMainClass(c);
  
  Iterator itClasses=Scene.v().getClasses().iterator();
  while(itClasses.hasNext()){
      SootClass sc=(SootClass)itClasses.next();
      String scName=sc.getName();
   sc.setApplicationClass();
  }
  System.out.print("*** Constructing the PAG...");
  HashMap map = new HashMap();
  System.out.println("*** Reading default options ");
  String defaultOptions = SparkOptions.getDefaultOptions();
  StringTokenizer decoupe = new StringTokenizer(defaultOptions, " ");
  while(decoupe.hasMoreElements()){
   String option = decoupe.nextToken();
   StringTokenizer decoupeOption = new StringTokenizer(option, ":");
   String key = decoupeOption.nextToken();
   String value = decoupeOption.nextToken();
   map.put(key, value);
   System.out.println("Option "+key+"   * Set "+value);
  }
  SparkOptions options = new SparkOptions(map);
  SparkTransformer.v().internalTransform("wjtp", map);
  PAG pag = (PAG)Scene.v().getActivePointsToAnalysis();
 


Do you Yahoo!?
Free online calendar with sync to Outlook(TM).