@Override protected void internalTransform(Body b, String phaseName, Map<String, String> options) { LocalCreation lc = new LocalCreation(b.getLocals(), "ex"); for (Iterator<Unit> unitIt = b.getUnits().snapshotIterator(); unitIt.hasNext();) { Unit u = unitIt.next(); // Check for a null exception if (u instanceof ThrowStmt) { ThrowStmt throwStmt = (ThrowStmt) u; if (throwStmt.getOp() == NullConstant.v() || throwStmt.getOp().equals(IntConstant.v(0)) || throwStmt.getOp().equals(LongConstant.v(0))) { createThrowStmt(b, throwStmt, lc); } } } }
/** * Insert a runtime exception before unit u of body b. Useful to analyze broken code (which make reference to inexisting * class for instance) exceptionType: e.g., "java.lang.RuntimeException" */ public static void addExceptionAfterUnit(Body b, String exceptionType, Unit u, String m) { LocalCreation lc = new LocalCreation(b.getLocals()); Local l = lc.newLocal(RefType.v(exceptionType)); List<Unit> newUnits = new ArrayList<Unit>(); Unit u1 = Jimple.v().newAssignStmt(l, Jimple.v().newNewExpr(RefType.v(exceptionType))); Unit u2 = Jimple.v() .newInvokeStmt(Jimple.v().newSpecialInvokeExpr(l, Scene.v().makeMethodRef(Scene.v().getSootClass(exceptionType), "<init>", Collections.singletonList((Type) RefType.v("java.lang.String")), VoidType.v(), false), StringConstant.v(m))); Unit u3 = Jimple.v().newThrowStmt(l); newUnits.add(u1); newUnits.add(u2); newUnits.add(u3); b.getUnits().insertBefore(newUnits, u); }
localCreation = new LocalCreation(body.getLocals(), "ret");
EarliestnessComputation earliest = new EarliestnessComputation(graph, upSafe, downSafe, sideEffect); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);
notIsolated = new NotIsolatedAnalysis(graph, latest, unitToEquivRhs, set); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);
protected void internalTransform(final Body body, String phaseName, Map<String, String> options) { final ExceptionalUnitGraph g = new ExceptionalUnitGraph(body, DalvikThrowAnalysis.v()); final LocalDefs defs = LocalDefs.Factory.newLocalDefs(g); final LocalCreation lc = new LocalCreation(body.getLocals(), "ex");
upSafe, downSafe, sideEffect ); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);
upSafe, downSafe, sideEffect ); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);
notIsolated = new NotIsolatedAnalysis(graph, latest, unitToEquivRhs, set); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);
notIsolated = new NotIsolatedAnalysis(graph, latest, unitToEquivRhs, set); LocalCreation localCreation = new LocalCreation(b.getLocals(), PREFIX);