protected void testChain() { System.out.println("******** chain of pegcallgraph********"); Iterator it = chain.iterator(); while (it.hasNext()) { SootMethod sm = (SootMethod) it.next(); System.out.println(sm); // System.out.println("name: "+sm.getName()); } }
private int getDeltaStackHeightFromTo(Unit aFrom, Unit aTo) { Iterator<Unit> it = mUnits.iterator(aFrom, aTo); int h = 0; while (it.hasNext()) { h += ((Inst) it.next()).getNetCount(); } return h; }
private void go() { Iterator it = chain.iterator(); while (it.hasNext()) { Object node = it.next(); dfsVisit(node); } }
/** * Returns the list of SootClasses that have been resolved at least to the level specified. */ public List<SootClass> getClasses(int desiredLevel) { List<SootClass> ret = new ArrayList<SootClass>(); for (Iterator<SootClass> clIt = getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); if (cl.resolvingLevel() >= desiredLevel) { ret.add(cl); } } return ret; }
private boolean hasArrayLocals(Body body) { Iterator localIt = body.getLocals().iterator(); while (localIt.hasNext()) { Local local = (Local) localIt.next(); if (local.getType() instanceof ArrayType) { return true; } } return false; }
public static boolean isExceptionCaughtAt(Chain<Unit> units, Unit u, Iterator<Trap> trapsIt) { while (trapsIt.hasNext()) { Trap t = trapsIt.next(); Iterator<Unit> it = units.iterator(t.getBeginUnit(), units.getPredOf(t.getEndUnit())); while (it.hasNext()) { if (u.equals(it.next())) { return true; } } } return false; }
/** Returns a list of all constructors taking no arguments. */ public List<SootMethod> inits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); addMethod(ret, cl, sigInit); } return ret; }
/** Returns a list of all static initializers. */ public List<SootMethod> clinits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); addMethod(ret, cl, sigClinit); } return ret; }
protected void buildSimpleExceptionalEdges(Map unitToSuccs, Map unitToPreds) { for (Iterator<Trap> trapIt = body.getTraps().iterator(); trapIt.hasNext();) { Trap trap = trapIt.next(); Unit handler = trap.getHandlerUnit(); for (Iterator predIt = ((List) unitToPreds.get(trap.getBeginUnit())).iterator(); predIt.hasNext();) { Unit pred = (Unit) predIt.next(); addEdge(unitToSuccs, unitToPreds, pred, handler); } } } }
private static RefType isHandlerUnit(Chain<Trap> traps, Unit h) { Iterator<Trap> it = traps.iterator(); while (it.hasNext()) { Trap t = (Trap) it.next(); if (t.getHandlerUnit() == h) { return t.getException().getType(); } } return null; }
/** Returns a list of all constructors. */ public List<SootMethod> allInits() { List<SootMethod> ret = new ArrayList<SootMethod>(); for (Iterator<SootClass> clIt = Scene.v().getClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); for (SootMethod m : cl.getMethods()) { if (m.getName().equals("<init>")) { ret.add(m); } } } return ret; }
/** Returns a set of units which lie inside the range of any trap. */ public static Set<Unit> getTrappedUnitsOf(Body b) { Set<Unit> trapsSet = new HashSet<Unit>(); Chain<Unit> units = b.getUnits(); for (Trap t : b.getTraps()) { Iterator<Unit> it = units.iterator(t.getBeginUnit(), units.getPredOf(t.getEndUnit())); while (it.hasNext()) { trapsSet.add(it.next()); } } return trapsSet; }
/** Returns the list of traps caught at Unit u in Body b. */ public static List<Trap> getTrapsAt(Unit unit, Body b) { List<Trap> trapsList = new ArrayList<Trap>(); Chain<Unit> units = b.getUnits(); for (Trap t : b.getTraps()) { Iterator<Unit> it = units.iterator(t.getBeginUnit(), units.getPredOf(t.getEndUnit())); while (it.hasNext()) { if (unit.equals(it.next())) { trapsList.add(t); } } } return trapsList; }
public boolean checkTraps(Unit u, Body b) { Iterator<Trap> it = b.getTraps().iterator(); while (it.hasNext()) { Trap t = it.next(); if (t.getBeginUnit() == u || t.getEndUnit() == u || t.getHandlerUnit() == u) { return true; } } return false; }
DfsForBackEdge(Chain chain, DirectedGraph peg) { domFinder = new DominatorsFinder(chain, peg); Iterator it = chain.iterator(); dfs(it, peg); testBackEdge(); }
private static boolean isExceptionCaught(Unit unit, Chain<Unit> units, Chain<Trap> traps) { for (Trap trap : traps) { final Unit end = trap.getEndUnit(); if (end.equals(unit)) { return true; } final Iterator<Unit> unitsInTryIterator = units.iterator(trap.getBeginUnit(), units.getPredOf(end)); if (Iterators.contains(unitsInTryIterator, unit)) { return true; } } return false; }
protected void internalTransform(String phaseName, Map<String, String> options) { lastClass = null; for (Iterator<SootClass> clIt = Scene.v().getApplicationClasses().iterator(); clIt.hasNext();) { final SootClass cl = clIt.next(); currentClass = cl; handleClass(cl); for (Iterator<SootMethod> it = cl.methodIterator(); it.hasNext();) { handleMethod(it.next()); } } Scene.v().setCallGraph(Scene.v().internalMakeCallGraph()); }
private Iterator getScopedFields() { // get the fields for this class and store them SootClass sootClass = methodNode.getDavaBody().getMethod().getDeclaringClass(); fields = sootClass.getFields(); return fields.iterator(); }
private void assign_types_3() throws TypeException { for (Iterator<Local> localIt = stmtBody.getLocals().iterator(); localIt.hasNext();) { final Local local = localIt.next(); TypeVariable var = typeVariable(local); if (var == null || var.approx() == null || var.approx().type() == null) { local.setType(RefType.v("java.lang.Object")); } else { local.setType(var.approx().type()); } } }
private void assign_types_3() throws TypeException { for (Iterator<Local> localIt = stmtBody.getLocals().iterator(); localIt.hasNext();) { final Local local = localIt.next(); TypeVariableBV var = typeVariable(local); if (var == null || var.approx() == null || var.approx().type() == null) { local.setType(RefType.v("java.lang.Object")); } else { local.setType(var.approx().type()); } } }