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 CallChain getNextCallChainBetween(SootMethod start, SootMethod goal, List previouslyFound) { // callChains.add(new LinkedList()); // Represents the one way to get from goal to goal (which is to already be there) // Is this worthwhile? Fast? Slow? Broken? Applicable inside the recursive method? // If method is unreachable, don't bother trying to make chains // CACHEABLE? ReachableMethods rm = null; if (rmCache.containsKey(start)) { rm = rmCache.get(start); } else { List<MethodOrMethodContext> entryPoints = new ArrayList<MethodOrMethodContext>(); entryPoints.add(start); rm = new ReachableMethods(cg, entryPoints); rm.update(); rmCache.put(start, rm); } if (rm.contains(goal)) { // Set methodsInAnyChain = new HashSet(); // methodsInAnyChain.add(goal); return getNextCallChainBetween(rm, start, goal, null, null, previouslyFound); } return null; // new ArrayList(); }
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; }
while (scopeMethodsIt.hasNext()) { SootMethod scopeMethod = (SootMethod) scopeMethodsIt.next(); if (rm.contains(scopeMethod)) { scopeMethods.add(scopeMethod); while (scMethodsIt.hasNext()) { SootMethod scMethod = (SootMethod) scMethodsIt.next(); if (rm.contains(scMethod)) { scopeMethods.add(scMethod);
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); } }
reachable = rm.contains(tn.method); if (mhp != null) { mhpself = mhp.mayHappenInParallel(tn.method, tn.method);
if (!sc.getReachableMethods().contains(method)) { continue;
if (Scene.v().getReachableMethods().contains(tn.method)) { logger.debug( "[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" style=\"setlinewidth(3)\"];"); printedHeading = true; if (Scene.v().getReachableMethods().contains(tn.method)) { logger.debug( "[transaction-graph] " + tn.name + " [name=\"" + tn.method.toString() + "\" style=\"setlinewidth(3)\"];");
continue; if (!Scene.v().getReachableMethods().contains(sm)) { continue;
if (!rm.contains(end)) {
while (methodsIt.hasNext()) { SootMethod method = (SootMethod) methodsIt.next(); if (method.isConcrete() && rm.contains(method)) { Body b = method.retrieveActiveBody(); Iterator unitsIt = b.getUnits().iterator();
SootMethod sm = (SootMethod) methsIt.next(); if (!Scene.v().getReachableMethods().contains(sm)) { continue;
continue; if (!Scene.v().getReachableMethods().contains(sm)) { continue;
protected void handleClass(SootClass c) { boolean incedClasses = false; if (c.isConcrete()) { for (SootMethod m : c.getMethods()) { if (!m.isConcrete() && !m.isNative()) { continue; } totalMethods++; if (reachables.contains(m)) { MethodPAG mpag = MethodPAG.v(pag, m); mpag.build(); mpag.addToPAG(null); analyzedMethods++; if (!incedClasses) { incedClasses = true; classes++; } } } } }
SootMethod method = b.getMethod(); if (reachableMethods.contains(method)) { return;
public CallChain getNextCallChainBetween(SootMethod start, SootMethod goal, List previouslyFound) { // callChains.add(new LinkedList()); // Represents the one way to get from goal to goal (which is to already be there) // Is this worthwhile? Fast? Slow? Broken? Applicable inside the recursive method? // If method is unreachable, don't bother trying to make chains // CACHEABLE? ReachableMethods rm = null; if(rmCache.containsKey(start)) rm = rmCache.get(start); else { List<MethodOrMethodContext> entryPoints = new ArrayList<MethodOrMethodContext>(); entryPoints.add(start); rm = new ReachableMethods(cg, entryPoints); rm.update(); rmCache.put(start, rm); } if(rm.contains(goal)) { // Set methodsInAnyChain = new HashSet(); // methodsInAnyChain.add(goal); return getNextCallChainBetween(rm, start, goal, null, null, previouslyFound); } return null; // new ArrayList(); }
public CallChain getNextCallChainBetween(SootMethod start, SootMethod goal, List previouslyFound) { // callChains.add(new LinkedList()); // Represents the one way to get from goal to goal (which is to already be there) // Is this worthwhile? Fast? Slow? Broken? Applicable inside the recursive method? // If method is unreachable, don't bother trying to make chains // CACHEABLE? ReachableMethods rm = null; if(rmCache.containsKey(start)) rm = rmCache.get(start); else { List<MethodOrMethodContext> entryPoints = new ArrayList<MethodOrMethodContext>(); entryPoints.add(start); rm = new ReachableMethods(cg, entryPoints); rm.update(); rmCache.put(start, rm); } if(rm.contains(goal)) { // Set methodsInAnyChain = new HashSet(); // methodsInAnyChain.add(goal); return getNextCallChainBetween(rm, start, goal, null, null, previouslyFound); } return null; // new ArrayList(); }
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); } }
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); } }