[Soot-list] ConcurrentModificationException in an extremely simple code piece
Sai Zhang
racezhang at gmail.com
Tue May 25 20:08:28 EDT 2010
Hi all:
I feel a bit confused about the ConcurrentModficationException thrown by
Soot.
Here is the whole runnable code. The only thing it does is to change the
method's name,
by adding the SUFFIX. It is a bit weird that it throws a
ConcurrentModificationException
when doing instrumentation.
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)
at soot.PackManager.runBodyPacks(PackManager.java:736)
at soot.PackManager.runBodyPacks(PackManager.java:452)
at soot.PackManager.runBodyPacks(PackManager.java:371)
at soot.PackManager.runPacks(PackManager.java:348)
at soot.Main.run(Main.java:202)
at soot.Main.main(Main.java:145)
MyInstrumenter.main(MyInstrumenter.java:25)
It seems that there is no other thread in modifying the SootMethod object.
So, a bit confused! Any hints are welcome!
thanks
-Sai
----------------- the whole program -----------------
import java.util.Map;
import soot.Body;
import soot.BodyTransformer;
import soot.PackManager;
import soot.SootMethod;
import soot.Transform;
public class MyInstrumenter extends BodyTransformer {
public static final String SUFFIX = "_suffix";
private static MyInstrumenter instrumenter = new MyInstrumenter();
private MyInstrumenter() { }
public static MyInstrumenter v() { return instrumenter; }
@Override
protected void internalTransform(Body body, String arg1, Map arg2) {
// skip constructor code and some dangerous classes, like Object,
Class
System.out.println(" " + body.getMethod().getName());
SootMethod method = body.getMethod();
String methodName = method.getName();
method.setName(methodName + SUFFIX); //reset the
name here
}
public static void main(String[] args) {
MyInstrumenter instrumenter = MyInstrumenter.v();
PackManager.v().getPack("jtp").add(
new Transform("jtp.instrumenter", instrumenter));
String[] sootArgs = new String[] { "-cp", ".", "-pp", "-f",
"jimple",
"test.BooleanTest" };
soot.Main.main(sootArgs);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100525/11b1725b/attachment.html
More information about the Soot-list
mailing list