private void emitTraps() { Chain<Trap> traps = body.getTraps(); SootClass throwable = Scene.v().getSootClass("java.lang.Throwable"); Map<LabelNode, Iterator<UnitBox>> handlers = new HashMap<LabelNode, Iterator<UnitBox>>(tryCatchBlocks.size()); for (TryCatchBlockNode tc : tryCatchBlocks) { UnitBox start = Jimple.v().newStmtBox(null); UnitBox end = Jimple.v().newStmtBox(null); Iterator<UnitBox> hitr = handlers.get(tc.handler); if (hitr == null) { hitr = trapHandlers.get(tc.handler).iterator(); handlers.put(tc.handler, hitr); } UnitBox handler = hitr.next(); SootClass cls = tc.type == null ? throwable : Scene.v().getSootClass(AsmUtil.toQualifiedName(tc.type)); Trap trap = Jimple.v().newTrap(cls, start, end, handler); traps.add(trap); labels.put(tc.start, start); labels.put(tc.end, end); } }
public Body addTrap(TypeDecl type, soot.jimple.Stmt firstStmt, soot.jimple.Stmt lastStmt, soot.jimple.Stmt handler) { body.getTraps().add(Jimple.v().newTrap(type.getSootClassDecl(), firstStmt, lastStmt, handler)); return this; }
int size = node.getCatchClause().size(); for (int i = 0; i < size; i++) { jBody.getTraps().addFirst((Trap) mProductions.removeLast());
listBody.getTraps().add(trap);
Iterator<Trap> trapIt = jBody.getTraps().iterator(); while (trapIt.hasNext()) { Trap oldTrap = trapIt.next();
for (Trap trap : jimpleBody.getTraps()) { getTraps().add(Baf.v().newTrap(trap.getException(), stmtToFirstInstruction.get(trap.getBeginUnit()), stmtToFirstInstruction.get(trap.getEndUnit()), stmtToFirstInstruction.get(trap.getHandlerUnit())));
jBody.getTraps().add(trap);
Iterator<Trap> trapsIt = exceptionTable.iterator(); while (trapsIt.hasNext()) { body.getTraps().add(trapsIt.next());
b.getTraps().addFirst(newTrap);
body.getTraps().add( Jimple.v().newTrap(Scene.v().getSootClass("java.lang.ClassNotFoundException"), asi, handlerStart, handlerStart));
afterEndStmt, newTarget); listBody.getTraps().add(trap);
afterEndStmt, newTarget); listBody.getTraps().add(trap);