Example #1
0
 public CallGraph buildCallGraph(Collection<JavaCriticalSection> validSyncs)
     throws NoMatchingSootMethodException {
   CallGraphBuilder cgb = new CallGraphBuilder(DumbPointerAnalysis.v());
   cgb.build();
   CallGraph cg = Scene.v().getCallGraph();
   for (JavaCriticalSection cs : results) {
     String clsname = cs.getClassName();
     String regex = "\\$\\d";
     Pattern pattern = Pattern.compile(regex);
     Matcher matcher = pattern.matcher(clsname);
     if (matcher.find()) {
       continue;
     }
     validSyncs.add(cs);
     cs.bindToSoot();
     syncsEnclosingMethods.add(cs.getSootMethod());
   }
   Scene.v().setCallGraph(cg);
   return cg;
 }
Example #2
0
 public OnFlyCallGraph(PAG pag) {
   this.pag = pag;
   CGOptions options = new CGOptions(PhaseOptions.v().getPhaseOptions("cg"));
   if (options.all_reachable()) {
     List entryPoints = new ArrayList();
     entryPoints.addAll(EntryPoints.v().all());
     entryPoints.addAll(EntryPoints.v().methodsOfApplicationClasses());
     Scene.v().setEntryPoints(entryPoints);
   }
   callGraph = new CallGraph();
   Scene.v().setCallGraph(callGraph);
   ContextManager cm = CallGraphBuilder.makeContextManager(callGraph);
   reachableMethods = Scene.v().getReachableMethods();
   ofcgb = new OnFlyCallGraphBuilder(cm, reachableMethods);
   reachablesReader = reachableMethods.listener();
   callEdges = cm.callGraph().listener();
 }