@Override @SuppressWarnings("rawtypes") public void internalTransform(Body body, String phaseName, Map options) { final SootMethod method = body.getMethod(); System.out.println(); System.out.println( method.getDeclaringClass().getName() + " :: " + method.getBytecodeSignature()); System.out.println("--- locals ---"); for (Local l : body.getLocals()) System.out.println(" " + l.getName() + " : " + l.getType()); System.out.println("--- units ---"); Unit[] units = body.getUnits().toArray(new Unit[0]); for (int i = 0; i < units.length; i++) { if (units[i].hasTag("StringTag")) { String info = ((StringTag) units[i].getTag("StringTag")).getInfo(); if (info.endsWith("Pre")) System.out.println("\n " + info); } System.out.printf("%4d ", i); if (units[i] instanceof GotoStmt) { System.out.println("goto " + getIndex(units, ((GotoStmt) units[i]).getTarget())); } else if (units[i] instanceof IfStmt) { System.out.println( "if " + ((IfStmt) units[i]).getCondition() + " goto " + getIndex(units, ((IfStmt) units[i]).getTarget())); } else if (units[i] instanceof TableSwitchStmt) { TableSwitchStmt sw = (TableSwitchStmt) units[i]; System.out.println("tswitch(" + sw.getKey() + ")"); final int lowIndex = sw.getLowIndex(); for (int t = 0; t <= sw.getHighIndex() - lowIndex; t++) System.out.println( " case " + (t + lowIndex) + ": goto " + getIndex(units, sw.getTarget(t))); System.out.println(" default: goto " + getIndex(units, sw.getDefaultTarget())); } else if (units[i] instanceof LookupSwitchStmt) { LookupSwitchStmt sw = (LookupSwitchStmt) units[i]; System.out.println("lswitch(" + sw.getKey() + ")"); for (int v = 0; v < sw.getTargetCount(); v++) System.out.println( " case " + sw.getLookupValue(v) + ": goto " + getIndex(units, sw.getTarget(v))); System.out.println(" default: goto " + getIndex(units, sw.getDefaultTarget())); } else if (units[i] instanceof InvokeStmt) { System.out.println(toString(((InvokeStmt) units[i]).getInvokeExpr())); } else if (units[i] instanceof AssignStmt) { if (((AssignStmt) units[i]).getRightOp() instanceof InvokeExpr) System.out.println( ((AssignStmt) units[i]).getLeftOp() + " = " + toString((InvokeExpr) ((AssignStmt) units[i]).getRightOp())); else System.out.println(units[i]); } else { System.out.println(units[i]); } if (units[i].hasTag("StringTag")) { String info = ((StringTag) units[i].getTag("StringTag")).getInfo(); if (!info.endsWith("Pre")) System.out.println(" " + info); if (info.endsWith("After")) System.out.println(); } } System.out.println("--- traps ---"); for (Trap t : body.getTraps()) System.out.println( " [" + getIndex(units, t.getBeginUnit()) + "-" + getIndex(units, t.getEndUnit()) + ") -> (" + t.getException() + ") -> " + getIndex(units, t.getHandlerUnit())); System.out.println(); }