public static void printUnits(PatchingChain<Unit> u, String msg) { int i = 0; HashMap<Unit, Integer> numbers = new HashMap<Unit, Integer>(); Iterator<Unit> it = u.snapshotIterator(); while (it.hasNext()) { numbers.put(it.next(), new Integer(i++)); Iterator<Unit> udit = u.snapshotIterator(); while (udit.hasNext()) { Unit unit = (Unit) udit.next();
private Unit findNonTrappedUnit(PatchingChain<Unit> units, Chain<Trap> traps) { int intrap = 0; ArrayList<Unit> untrapped = new ArrayList<Unit>(); Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = it.next();
sw.shouldThrow = false; Map<Unit, Integer> indexes = new HashMap<Unit, Integer>(); Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { indexes.put(it.next(), new Integer(count++)); it = units.snapshotIterator(); while (it.hasNext()) { String s = "";
Map<Unit, Integer> numbers = new HashMap<Unit, Integer>(); PatchingChain<Unit> u = b.getUnits(); Iterator<Unit> it = u.snapshotIterator(); while (it.hasNext()) { numbers.put(it.next(), new Integer(i++)); Iterator<Unit> udit = u.snapshotIterator(); while (udit.hasNext()) { Unit unit = (Unit) udit.next();
HashMap<TargetArgInst, Unit> ignoreJumps = new HashMap<TargetArgInst, Unit>(); PatchingChain<Unit> u = b.getUnits(); Iterator<Unit> it = u.snapshotIterator(); while (it.hasNext()) { Unit unit = it.next(); it = u.snapshotIterator(); ArrayList<Unit> processedLabels = new ArrayList<Unit>(); HashMap<Unit, JSRInst> builtJsrs = new HashMap<Unit, JSRInst>(); it = u.snapshotIterator(); while (it.hasNext()) { Unit unit = (Unit) it.next(); it = u.snapshotIterator(); while (it.hasNext()) { Unit unit = (Unit) it.next();
Unit prevprevprev = null, prevprev = null, prev = null; ExceptionalUnitGraph eug = new ExceptionalUnitGraph(b); Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = it.next();
protected void internalTransform(Body b, String phaseName, Map<String, String> options) { if (b.getMethod().getName().indexOf("<clinit>") >= 0) { return; } int weight = soot.jbco.Main.getWeight(phaseName, b.getMethod().getSignature()); if (weight == 0) { return; } PatchingChain<Unit> units = b.getUnits(); Iterator<Unit> iter = units.snapshotIterator(); while (iter.hasNext()) { Unit u = (Unit) iter.next(); if (u instanceof PushInst) { SootField f = CollectConstants.constantsToFields.get(((PushInst) u).getConstant()); if (f != null && Rand.getInt(10) <= weight) { Unit get = Baf.v().newStaticGetInst(f.makeRef()); units.insertBefore(get, u); BodyBuilder.updateTraps(get, u, b.getTraps()); units.remove(u); updated++; } } } } }
PatchingChain<Unit> units = b.getUnits(); GuaranteedDefs gd = new GuaranteedDefs(new soot.toolkits.graph.ExceptionalUnitGraph(b)); Iterator<Unit> unitIt = units.snapshotIterator(); Unit after = null; while (unitIt.hasNext()) {
Chain<Trap> traps = b.getTraps(); PatchingChain<Unit> units = b.getUnits(); Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = (Unit) it.next(); Iterator<Unit> uit = units.snapshotIterator(); while (uit.hasNext()) { Unit uthrow = (Unit) uit.next();
Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = (Unit) it.next();
Iterator<Unit> it = u.snapshotIterator(); while (it.hasNext()) { Unit unit = it.next();
Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit unit = (Unit) it.next();
Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = it.next();
Iterator<Unit> iter = units.snapshotIterator(); LocalGenerator localGen = new LocalGenerator(b);
Iterator<Unit> it = units.snapshotIterator(); while (it.hasNext()) { Unit u = it.next();
Iterator<Unit> it = units.snapshotIterator(); Unit prev = null; SpecialInvokeInst sii = null;
boolean change = false; PatchingChain<Unit> units = b.getUnits(); Iterator<Unit> uit = units.snapshotIterator(); while (uit.hasNext()) { Unit u = uit.next();
/** * Removes if statements that jump to the fall-through successor * @param body The body from which to remove unnecessary if statements */ private void eliminateFallthroughIfs(Body body) { boolean changed = false; do { changed = false; IfStmt ifs = null; Iterator<Unit> unitIt = body.getUnits().snapshotIterator(); while (unitIt.hasNext()) { Unit u = unitIt.next(); if (ifs != null && ifs.getTarget() == u) { body.getUnits().remove(ifs); changed = true; } ifs = null; if (u instanceof IfStmt) ifs = (IfStmt) u; } } while (changed); }
for (Iterator<Unit> iterU = units.snapshotIterator(); iterU.hasNext(); )
public void fieldSendingMessage(SootMethod fromSM) { SootClass fromC = fromSM.getDeclaringClass(); if (fromC.declaresField("message_for_ipc_static", RefType.v("android.os.Message"))) { return; } int m = Modifier.PUBLIC | Modifier.STATIC; SootField sf = Scene.v().makeSootField("message_for_ipc_static", RefType.v("android.os.Message"), m); fromC.addField(sf); for (SootMethod sm : fromC.getMethods()) { if (sm.isConcrete()) { Body body = sm.retrieveActiveBody(); PatchingChain<Unit> units = body.getUnits(); for (Iterator<Unit> iter = units.snapshotIterator(); iter.hasNext();) { Stmt stmt = (Stmt) iter.next(); if (stmt.containsInvokeExpr()) { SootMethod toBeCheckedMethod = stmt.getInvokeExpr().getMethod(); if (toBeCheckedMethod.getName().equals("send") && equalsOrSubclassOf(toBeCheckedMethod.getDeclaringClass(), Scene.v().getSootClass("android.os.Messenger"))) { Value arg0 = stmt.getInvokeExpr().getArg(0); Unit assignUnit = Jimple.v().newAssignStmt(Jimple.v().newStaticFieldRef(sf.makeRef()), arg0); units.insertBefore(assignUnit, stmt); } } } } } }