[Soot-list] Active body not present

Richard L. Halpert richardlhalpert at gmail.com
Tue Jun 24 14:54:31 EDT 2008


I'd guess that jimple bodies get purged before the end of Soot.Main.main(),
probably when Soot moves on to a Baf or output stage.  Try creating your own
whole-program analysis, and add it to the wjtp stage, *then* run
Soot.Main.main().  Within your whole-program analysis' transform method, you
should be able to run the UnsynchronizedMhpAnalysis.

By the way, you don't need to run wjtp.tn in order to run the mhp analysis.
wjtp.tn analyzes and transforms the locks in your program.  Mhp is simply
used as a phase within it.  I can see from your output that wjtp.tn is
running mhp (and printing the results if it, in case you're interested in
just seeing them), a local-objects analysis, and a lock analysis, and
transforming your program.  I doubt that this is what you want.

-Richard

On Tue, Jun 24, 2008 at 9:56 AM, Kristen Walcott <walcott at virginia.edu>
wrote:

> Hi,
>
> I'm very new to Soot, and I'm trying to create an instance of
> UnsynchronizedMhpAnalysis.  I keep getting an error that no active body is
> present.  I've also received this error when trying to draw a PEG and
> retrieveActiveBody() was called.  After loading the class and support, I can
> call getActiveBody on each method, but once I set whole program mode, the
> active bodies can no longer be found.  The code I'm using and exact error
> are below.  Does anyone know what I'm doing wrong?
>
> Thank you,
> Kristen
>
> public class MHPrunner {
>     public static void main(String[] args){
>         args = new String[] {"RaceNotFixed"};
>         if (args.length == 0){
>             System.out.println("Usage: java MHPrunner class_to_analyse");
>             System.exit(0);
>         }
>
>         PhaseOptions.v().setPhaseOption("jb", "enabled:true");
>         Options.v().set_keep_line_number(true);
>         Options.v().setPhaseOption("jb", "use-original-names:true");
>         Options.v().set_whole_program(true);
>         Options.v().set_app(true);
>
>         SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
>         sClass.setApplicationClass();
>         Scene.v().setMainClass(sClass);
>
>         //Enable Spark
>         HashMap<String,String> opt = new HashMap<String,String>();
>         opt.put("verbose","true");
>         opt.put("propagator","worklist");
>         opt.put("simple-edges-bidirectional","false");
>         opt.put("on-fly-cg","true");
>         opt.put("set-impl","double");
>         opt.put("double-set-old","hybrid");
>         opt.put("double-set-new","hybrid");
>         opt.put("pre_jimplify", "true");
>         SparkTransformer.v().transform("",opt);
>         SparkOptions opts = new SparkOptions( opt );
>
>         PhaseOptions.v().setPhaseOption("cg", "enabled:true");
>         PhaseOptions.v().setPhaseOption("cg.spark", "enabled:true");
>
>         PackManager.v().getPack("wjtp").apply();
>         PhaseOptions.v().setPhaseOption("wjtp.tn", "enabled:true");
>         PhaseOptions.v().setPhaseOption("wjtp.tn", "do-mhp:true");
>
>         String[] args2 = { "-w", args[0]};
>         soot.Main.main(args2);
>         UnsynchronizedMhpAnalysis uma = new UnsynchronizedMhpAnalysis();
> }
>
> Output:
> Soot started on Sat Jun 21 14:29:59 EDT 2008
> [Call Graph] For information on where the call graph may be incomplete, use
> the verbose option to the cg phase.
> [Spark] Pointer Assignment Graph in 3.0 seconds.
> [Spark] Type masks in 0.7 seconds.
> [Spark] Pointer Graph simplified in 0.0 seconds.
> [Spark] Propagation in 115.2 seconds.
> [Spark] Solution found in 115.2 seconds.
> [wjtp.tn] *** Build May-Happen-in-Parallel Info *** Sat Jun 21 14:32:01
> EDT 2008
> [mhp]
> [mhp] User Thread (Single, SRO,---): Started in <RaceNotFixed: void
> main(java.lang.String[])> by virtualinvoke lo.<java.lang.Thread: void
> start()>()
> [mhp] [<RaceNotFixed: void run()>
> [mhp]   <SharedNotFixed: int dif()>
> [mhp]   <RaceNotFixed: void <clinit>()>]
> [mhp]
> [mhp] Main Thread (Single, ---,---):
> [mhp] [<RaceNotFixed: void main(java.lang.String[])>
> [mhp]   <RaceNotFixed: void <clinit>()>
> [mhp]   <RaceNotFixed: void run()>
> [mhp]   <RaceNotFixed: void <init>(java.lang.String)>
> [mhp]   <SharedNotFixed: void bump()>
> [mhp]   <SharedNotFixed: void <init>()>
> [mhp]   <SharedNotFixed: int dif()>]
> [mhp]
> [wjtp.tn] *** Find Thread-Local Objects *** Sat Jun 21 14:32:01 EDT 2008
> [local-objects] Analyzing local objects for RaceNotFixed
> [local-objects]   preparing class             Sat Jun 21 14:32:01 EDT 2008
> [local-objects]   analyzing class             Sat Jun 21 14:32:01 EDT 2008
> [local-objects]   propagating over call graph Sat Jun 21 14:32:02 EDT 2008
> [local-objects]   finished at                 Sat Jun 21 14:32:02 EDT 2008
> [local-objects]   (#analyzed/#encountered): 49/106
> [wjtp.tn] TLO totals (#analyzed/#encountered): 49/106
> [wjtp.tn] *** Find and Name Transactions *** Sat Jun 21 14:32:02 EDT 2008
> Warning: using default implementation of addAll. You should implement a
> faster specialized implementation.
> this is of type soot.jimple.spark.sets.HashPointsToSet
> other is of type soot.jimple.spark.sets.HybridPointsToSet
> exclude is null
> [wjtp.tn] *** Find Transitive Read/Write Sets *** Sat Jun 21 14:32:02 EDT
> 2008
> [wjtp.tn] *** Calculate Locking Groups *** Sat Jun 21 14:32:02 EDT 2008
> [wjtp.tn] *** Detect the Possibility of Deadlock *** Sat Jun 21 14:32:02
> EDT 2008
> [wjtp.tn] *** Calculate Locking Objects *** Sat Jun 21 14:32:02 EDT 2008
> [wjtp.tn] * m001n01 *
> [wjtp.tn] Healthy lockset: S1/G1/O1 [this] refToBase:{} refToIndex:{}
> [wjtp.tn] |= results:{this=1} refToBaseGroup:{}
> [wjtp.tn] * m000n01 *
> [wjtp.tn] Healthy lockset: S1/G1/O1 [this] refToBase:{} refToIndex:{}
> [wjtp.tn] |= results:{this=5} refToBaseGroup:{}
> [wjtp.tn] *** Print Output and Transform Program *** Sat Jun 21 14:32:02
> EDT 2008
> Transforming SharedNotFixed...
> Transforming RaceNotFixed...
> Writing to sootOutput/SharedNotFixed.class
> Writing to sootOutput/RaceNotFixed.class
> Soot finished on Sat Jun 21 14:32:03 EDT 2008
> Soot has run for 2 min. 3 sec.
> Done setting whole program mode
> about to run Unsynchronized MHP analysis
> Exception in thread "main" java.lang.RuntimeException: no active body
> present for method <RaceNotFixed: void <clinit>()>
>     at soot.SootMethod.getActiveBody(SootMethod.java:304)
>     at
> soot.jimple.toolkits.thread.mhp.findobject.AllocNodesFinder.find(AllocNodesFinder.java:53)
>     at
> soot.jimple.toolkits.thread.mhp.findobject.AllocNodesFinder.<init>(AllocNodesFinder.java:41)
>     at
> soot.jimple.toolkits.thread.mhp.UnsynchronizedMhpAnalysis.run(UnsynchronizedMhpAnalysis.java:91)
>     at
> soot.jimple.toolkits.thread.mhp.UnsynchronizedMhpAnalysis.buildMHPLists(UnsynchronizedMhpAnalysis.java:61)
>     at
> soot.jimple.toolkits.thread.mhp.UnsynchronizedMhpAnalysis.<init>(UnsynchronizedMhpAnalysis.java:47)
>     at MHPrunner.main(MHPrunner.java:87)
>
> ____________________________
> Kristen R. Walcott
> Department of Computer Science
> University of Virginia
> http://www.cs.virginia.edu/walcott
> walcott at cs.virginia.edu
> 814-573-1283
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20080624/2f946798/attachment-0001.htm


More information about the Soot-list mailing list