[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Soot API: VerifyError when using Chain.insertBefore() methods
Hello,
I am trying to use the following routine along with the Soot API to
insert code before every return statement
in a method called "v on class called "test.LoadMe".
JimpleBody body =
(JimpleBody)sootMethod.retrieveActiveBody();
Chain units = body.getUnits();
String methodStr = "<test.LoadMe: java.lang.String
v(java.lang.String, java.io.InputStream,
java.util.Date)>";
SootMethod method = scene.getMethod(methodStr );
ArrayList params = new ArrayList();
// add method parameters to params
.
.
.
Unit postCondMthdUnit = Jimple.v().newInvokeStmt
(Jimple.v().newStaticInvokeExpr(method ,
params));
Iterator unitIterator = units.snapshotIterator();
while (unitIterator.hasNext()) {
Unit nextUnit = (Unit)unitIterator.next();
if (nextUnit instanceof JReturnVoidStmt ||
nextUnit instanceof JReturnStmt) {
units.insertBefore(postCondMthdUnit,
nextUnit);
}
}
However, I recieve the following a Verify Error when executing the class.
Exception in thread "main" java.lang.VerifyError: (class:
test/LoadMe, method: v
signature:
(Ljava/lang/String;Ljava/io/InputStream;Lcom/rtscinc/util/DebugMsg;)
Ljava/lang/String;) Incompatible argument to function.
I would appreciate any advice on what may be the cause of this problem.
I have attatched the Jimple
code for this instrumented class also.
Nathan
test.LoadMe.jimple