[Soot-list] create a CFG from scratch
Z
zell08v at orange.fr
Sat Apr 21 14:35:16 EDT 2012
Hello,
I am learning SOOT by doing a mini-project
http://www.cse.ohio-state.edu/~rountev/788/project/Phase1.txt
The project is to create a intraprocedural CFG among instructions (in stead
of basic blocks) *from scratch*. For each method, I plan to create
construct an empty CFG of type BriefUnitGraph, and then add arcs and nodes
following the successors and predecessors of each statement. I think this
is a natural way to do the job.
But apparently, I am not allowed to create an empty CFG associated with a
certain method. (See the one-line code below, and its error message) Can
you help?? Many Thanks!
Zell
~~~~~~~~~~~~~the code that gives the run-time error~~~~~~~~~~~~~~~~~~
private UnitGraph buildCFG(JimpleBody b) {
//run-time error for the following sentence.
UnitGraph cfg=new BriefUnitGraph(Jimple.v().newBody(b.getMethod()));
...
}
~~~~~~~~~~~~~~~~Error message~~~~~~~~~~~~~~~~~~~
Exception in thread "main" java.util.NoSuchElementException
at soot.util.HashChain.getFirst(HashChain.java:315)
at soot.PatchingChain.getFirst(PatchingChain.java:217)
at soot.PatchingChain.getFirst(PatchingChain.java:40)
at soot.toolkits.graph.UnitGraph.buildHeadsAndTails(UnitGraph.java:174)
at soot.toolkits.graph.BriefUnitGraph.<init>(BriefUnitGraph.java:64)
at cta.MyTransform.buildCFG(MyTransform.java:60)
at cta.MyTransform.internalTransform(MyTransform.java:33)
at soot.BodyTransformer.transform(BodyTransformer.java:51)
at soot.Transform.apply(Transform.java:104)
at soot.BodyPack.internalApply(BodyPack.java:49)
at soot.Pack.apply(Pack.java:124)
at soot.PackManager.runBodyPacks(PackManager.java:775)
at soot.PackManager.runBodyPacks(PackManager.java:463)
at soot.PackManager.runBodyPacks(PackManager.java:380)
at soot.PackManager.runPacks(PackManager.java:357)
at soot.Main.run(Main.java:198)
at soot.Main.main(Main.java:141)
at cta.Main.main(Main.java:14)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120421/d3418071/attachment.html
More information about the Soot-list
mailing list