[Soot-list] How to load a new class in whole program analysis?
L. Wang
dududuwang at yahoo.com
Tue Jul 31 15:16:59 EDT 2007
My workflow is: first do a whole program analysis (use Spark points-to to do some client analysis); then rewrite some of the bytecode based on the analysis results.
One option is to save the analysis resutls, and use a separate intra-procedural traversal of the application to rewrite bytecode. But I don't know a proper way to save the points-to information and restore it in a new process. (Any hint on doing this is also very much appreciated.)
So I'm thinking to rewrite bytecode after the whole program analysis while the points-to info is still in memory. I need to use a rewriting supporting class during bytecode rewriting. But I got exception as follows when I tried to load this new class. Details see below:
Soot option I used for the whole program analysis:
--app -w
-p cg.spark on
Suppose the supporting class I need to load for the rewriting is "Support.class".
---------------------------------------------------------------------------------------------------
SootClass supportClass = Scene.v().loadClassAndSupport("Support");
supportClass.setApplicationClass();
---------------------------------------------------------------------------------------------------
I tried to place the above code at various places. But all I got is the exceptions below. My question is: can I load a new class myself with "-w" option? And how? Thanks!
---------------------------------------------------------------------------------------------------
Exception in thread "main" java.lang.RuntimeException: This operation requires resolving level SIGNATURES but Support is at resolving level HIERARCHY
or
Exception in thread "main" java.lang.RuntimeException: This operation requires resolving level BODIES but java.lang.Object is at resolving level SIGNATURES
at soot.SootClass.checkLevel(SootClass.java:126)
at soot.SootClass.addField(SootClass.java:188)
at soot.coffi.Util.resolveFromClassFile(Util.java:150)
at soot.CoffiClassSource.resolve(CoffiClassSource.java:37)
at soot.SootResolver.bringToHierarchy(SootResolver.java:148)
at soot.SootResolver.bringToSignatures(SootResolver.java:172)
at soot.SootResolver.bringToBodies(SootResolver.java:214)
at soot.SootResolver.processResolveWorklist(SootResolver.java:100)
at soot.SootResolver.resolveClass(SootResolver.java:89)
at soot.Scene.loadClass(Scene.java:329)
at soot.Scene.loadClassAndSupport(Scene.java:314)
at ORG.vis.BodyTransformBCRewriter.internalTransform(BodyTransformBCRewriter.java:50)
at soot.BodyTransformer.transform(BodyTransformer.java:51)
at soot.Transform.apply(Transform.java:104)
at soot.BodyPack.internalApply(BodyPack.java:50)
at soot.Pack.apply(Pack.java:120)
at soot.PackManager.runBodyPacks(PackManager.java:681)
at soot.PackManager.runBodyPacks(PackManager.java:396)
at soot.PackManager.runBodyPacks(PackManager.java:340)
at soot.PackManager.runPacks(PackManager.java:335)
at soot.Main.run(Main.java:203)
at soot.Main.main(Main.java:146)
at ORG.vis.BodyTransformBCRewriter.main(BodyTransformBCRewriter.java:183)
--------------------------------------------------------------------------------------------------------------
- Lei
---------------------------------
Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20070731/fe7de652/attachment.htm
More information about the Soot-list
mailing list