public UseFinder() { classToExtFieldAccesses = new HashMap<SootClass, List>(); classToIntFieldAccesses = new HashMap<SootClass, ArrayList>(); classToExtCalls = new HashMap<SootClass, List>(); classToIntCalls = new HashMap<SootClass, ArrayList>(); rm = Scene.v().getReachableMethods(); doAnalysis(); }
protected void internalTransform(String phaseName, Map options) { int numAppMethods = 0; for (Iterator mIt = Scene.v().getReachableMethods().listener(); mIt.hasNext();) { final SootMethod m = (SootMethod) mIt.next(); if (isAppMethod(m)) { // System.out.println(m); // assert OnFlyCallGraphBuilder.processedMethods.contains(m) : m // + " not processed!!"; numAppMethods++; } } logger.debug("Number of reachable methods in application: " + numAppMethods); }
protected void initializeUnitToOwner() { for (Iterator<MethodOrMethodContext> iter = Scene.v().getReachableMethods().listener(); iter.hasNext();) { SootMethod m = iter.next().method(); initializeUnitToOwner(m); } }
boolean mhpself = false; ReachableMethods rm = Scene.v().getReachableMethods(); reachable = rm.contains(tn.method); if (mhp != null) {
protected void internalTransform(String phaseName, Map options) { // make list of all unreachable methods ArrayList<SootMethod> methodList = new ArrayList<SootMethod>(); Iterator getClassesIt = Scene.v().getApplicationClasses().iterator(); while (getClassesIt.hasNext()) { SootClass appClass = (SootClass) getClassesIt.next(); Iterator getMethodsIt = appClass.getMethods().iterator(); while (getMethodsIt.hasNext()) { SootMethod method = (SootMethod) getMethodsIt.next(); // System.out.println("adding method: "+method); if (!Scene.v().getReachableMethods().contains(method)) { methodList.add(method); } } } // tag unused methods Iterator<SootMethod> unusedIt = methodList.iterator(); while (unusedIt.hasNext()) { SootMethod unusedMethod = unusedIt.next(); unusedMethod.addTag(new StringTag("Method " + unusedMethod.getName() + " is not reachable!", "Unreachable Methods")); unusedMethod.addTag(new ColorTag(255, 0, 0, true, "Unreachable Methods")); // System.out.println("tagged method: "+unusedMethod); } }
public boolean mayHappenInParallel(CriticalSection tn1, CriticalSection tn2) { if (mhp == null) { if (optionLeaveOriginalLocks) { return true; } ReachableMethods rm = Scene.v().getReachableMethods(); if (!rm.contains(tn1.method) || !rm.contains(tn2.method)) { return false; } return true; } return mhp.mayHappenInParallel(tn1.method, tn2.method); } }
public static List<SootMethod> getAllReachableMethods(SootClass sc) { ReachableMethods rm = Scene.v().getReachableMethods(); // Get list of reachable methods declared in this class List<SootMethod> allMethods = new ArrayList<SootMethod>(); Iterator methodsIt = sc.methodIterator(); while (methodsIt.hasNext()) { SootMethod method = (SootMethod) methodsIt.next(); if (rm.contains(method)) { allMethods.add(method); } } // Add reachable methods declared in superclasses SootClass superclass = sc; if (superclass.hasSuperclass()) { superclass = superclass.getSuperclass(); } while (superclass.hasSuperclass()) // we don't want to process Object { Iterator scMethodsIt = superclass.methodIterator(); while (scMethodsIt.hasNext()) { SootMethod scMethod = (SootMethod) scMethodsIt.next(); if (rm.contains(scMethod)) { allMethods.add(scMethod); } } superclass = superclass.getSuperclass(); } return allMethods; }
public List<SootMethod> getAllMethodsForClass(SootClass sootClass) { ReachableMethods rm = Scene.v().getReachableMethods();
continue; if (!Scene.v().getReachableMethods().contains(sm)) { continue;
protected void internalTransform(String phaseName, Map<String, String> opts) { CHAOptions options = new CHAOptions(opts); CallGraphBuilder cg = options.apponly() ? new CallGraphBuilder() : new CallGraphBuilder(DumbPointerAnalysis.v()); cg.build(); if (options.verbose()) { logger.debug("" + "Number of reachable methods: " + Scene.v().getReachableMethods().size()); } } }
/** * This constructor builds a complete call graph using the given PointsToAnalysis to resolve virtual calls. */ public CallGraphBuilder(PointsToAnalysis pa) { this.pa = pa; cg = Scene.v().internalMakeCallGraph(); Scene.v().setCallGraph(cg); reachables = Scene.v().getReachableMethods(); ContextManager cm = makeContextManager(cg); ofcgb = new OnFlyCallGraphBuilder(cm, reachables); }
SootMethod sm = (SootMethod) methsIt.next(); if (!Scene.v().getReachableMethods().contains(sm)) { continue;
continue; if (!Scene.v().getReachableMethods().contains(sm)) { continue;
methodToContexts = new MethodToContexts(Scene.v().getReachableMethods().listener());
methodToContexts = new MethodToContexts(Scene.v().getReachableMethods().listener());
public OnFlyCallGraph(PAG pag, boolean appOnly) { this.pag = pag; callGraph = Scene.v().internalMakeCallGraph(); Scene.v().setCallGraph(callGraph); ContextManager cm = CallGraphBuilder.makeContextManager(callGraph); reachableMethods = Scene.v().getReachableMethods(); ofcgb = new OnFlyCallGraphBuilder(cm, reachableMethods, appOnly); reachablesReader = reachableMethods.listener(); callEdges = cm.callGraph().listener(); }
/** * Update the reachable methods and SPARK points-to results. */ private void finalizeSootData() { // We remove the unreachable functions from Soot internal structures Scene.v().releaseReachableMethods(); // The we rebuild it from the updated Soot call graph Scene.v().getReachableMethods(); if (!opts.geom_trans()) { // We remove the SPARK points-to information for pointers that have geomPTA // results (willUpdate = true) // At querying time, the SPARK points-to container acts as a query cache for (IVarAbstraction pn : pointers) { // Keep only the points-to results for representatives if (pn != pn.getRepresentative()) { continue; } // Simplify if (pn.hasPTResult()) { pn.keepPointsToOnly(); Node vn = pn.getWrappedNode(); vn.discardP2Set(); } } } else { // Do we need to obtain the context insensitive points-to result? transformToCIResult(); } }
public void reset() { if (methodToContexts == null) { methodToContexts = new MethodToContexts(Scene.v().getReachableMethods().listener()); } if (Scene.v().hasCallGraph()) { SootClass sc = Scene.v().getMainClass(); SootMethod sm = getFirstMethod(sc); // logger.debug("got first method"); ArrayList<MethInfo> tgts = getTgtMethods(sm, true); // logger.debug("got tgt methods"); ArrayList<MethInfo> srcs = getSrcMethods(sm, true); // logger.debug("got src methods"); CallGraphInfo info = new CallGraphInfo(sm, tgts, srcs); // logger.debug("will handle new call graph"); InteractionHandler.v().handleCallGraphStart(info, this); } }
logger.debug("[Spark] Number of reachable methods: " + Scene.v().getReachableMethods().size());
protected void internalTransform(Body b, String phaseName, Map options) { ReachableMethods reachableMethods = Scene.v().getReachableMethods(); SootMethod method = b.getMethod();