use of soot.MethodSource in project soot by Sable.
the class DexMethod method createMethodSource.
protected MethodSource createMethodSource(final Method method) {
return new MethodSource() {
@Override
public Body getBody(SootMethod m, String phaseName) {
Body b = Jimple.v().newBody(m);
try {
// add the body of this code item
DexBody dexBody = new DexBody(dexFile, method, declaringClass.getType());
dexBody.jimplify(b, m);
} catch (InvalidDalvikBytecodeException e) {
String msg = "Warning: Invalid bytecode in method " + m + ": " + e;
logger.debug("" + msg);
Util.emptyBody(b);
Util.addExceptionAfterUnit(b, "java.lang.RuntimeException", b.getUnits().getLast(), "Soot has detected that this method contains invalid Dalvik bytecode which would have throw an exception at runtime. [" + msg + "]");
TypeAssigner.v().transform(b);
}
m.setActiveBody(b);
return m.getActiveBody();
}
};
}
Aggregations