private static List<Unit> searchIfStmts(Body b) { List<Unit> searchResult = new ArrayList<Unit>(); PatchingChain<Unit> statements = b.getUnits(); Iterator<Unit> unitIt = statements.iterator(); // iterate through the Units of the body while (unitIt.hasNext()) { Unit tempUnit = unitIt.next(); // if the unit is a "if statement" if (tempUnit instanceof soot.jimple.internal.JIfStmt) searchResult.add(tempUnit); } return searchResult; }
public static Stmt getFirstNonIdentityStmt(SootMethod sootMethod) { Stmt rtVal = null; Body b = sootMethod.retrieveActiveBody(); PatchingChain<Unit> units = b.getUnits(); for (Iterator<Unit> iter = units.iterator(); iter.hasNext(); ) { Stmt stmt = (Stmt) iter.next(); if (!(stmt instanceof IdentityStmt)) { rtVal = stmt; } } return rtVal; }