[Soot-list] , 'Scene.v().addBasicClass(sun.misc.ClassFileTransformer,HIERARCHY); even when -w option is enabled (Wii re)

Marc-André Laverdière marc-andre.laverdiere-papineau at polymtl.ca
Tue Mar 4 11:53:15 EST 2014


Hello,

Your error report was not clear. I'm going to guess what is happening,
and it is likely that your soot class path doesn't include your JDK. You
can use the prepend classpath option or set the class path yourself.

If you still have a problem, please include all the details.

Regards,

Marc-André Laverdière-Papineau
Doctorant - PhD Candidate

On 03/04/2014 11:35 AM, Wiza wrote:
> Thanks Marc-Andr for your response.
> 
> Could you be more specific,please? I'm afraid I don't get your answer.
> I don't try to add any basic class, this is the error msg that I get.
> The strange thing is that it asks for enabling the program mode even if
> I give it as an argument option and from soot-eclipse's gui.
> 
> Thanks again in advance.
> 
> On 01/03/2014 21:10, soot-list-request at sable.mcgill.ca wrote:
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Sat, 01 Mar 2014 13:01:47 -0500
>> From: Marc-Andr? Laverdi?re
>> 	<marc-andre.laverdiere-papineau at polymtl.ca>
>> Subject: Re: [Soot-list]
>> 	'Scene.v().addBasicClass(sun.misc.ClassFileTransformer,HIERARCHY);
>> 	even when -w option is enabled
>> To: soot-list at sable.mcgill.ca
>> Message-ID: <5312208B.9000202 at polymtl.ca>
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Hello Wiza,
>>
>> Adding a class as a basic class affects the soot class loader, not the
>> call graph construction algorithm. If you want to set the main class,
>> there is an option for that. If you want custom entry points, check out
>> this tutorial:
>> http://www.bodden.de/2012/07/26/soot-custom-entry-points/
>>
>> Marc-Andr? Laverdi?re-Papineau
>> Doctorant - PhD Candidate
>>
>> On 02/28/2014 03:48 PM, Wiza wrote:
>>> Hi list :)
>>>
>>> I'm trying to create a transformer to call points-to spark analysis.
>>> I get an error msg for adding
>>> '*Scene.v().addBasicClass(sun.misc.ClassFileTransformer,HIERARCHY);'
>>> *or enabling the "-whole-program mode".
>>> Although I enable the -w option giving it as an argument for soot.Main
>>> and I even tried enabling it manually from Soot-Eclipse, but I get the
>>> same result.
>>> Am I doing something wrong on my code or it is a Soot bug?
>>>
>>> My code as well as the command line output follow up.
>>>
>>> Thank you very much in advance,
>>>
>>> --Wi
>>>
>>>
>>> *_COMMAND LINE OUTPUT:_*
>>> Starting from project MyColorer:
>>> Soot started on Fri Feb 28 22:14:48 EET 2014
>>> resolving [from .class]: java.lang.NoClassDefFoundError
>>> resolving [from .class]: java.lang.LinkageError
>>> resolving [from .class]: java.lang.String
>>> resolving [from .class]: java.lang.Error
>>> ...
>>> Warning: java.dyn.InvokeDynamic is a phantom class!
>>> resolving [from .java]: hello.Foo
>>> Warning: enabled:true is a phantom class!
>>> Applying phase cg.spark to the scene.
>>> No main class given. Inferred 'hello.Foo' as main class.
>>> [Call Graph] For information on where the call graph may be incomplete,
>>> use the verbose option to the cg phase.
>>> [<clinit>] Constructing JimpleBody from coffi...
>>> Applying phase jb.ls to <java.lang.Object: void <clinit>()>.
>>> [<clinit>] Splitting locals
>>> ...
>>> Applying phase jb.a to <java.lang.Object: void <clinit>()>.
>>> [<clinit>] Aggregating iteration 1...
>>> Applying phase jb.ule to <java.lang.Object: void <clinit>()>.
>>> [<clinit>] Eliminating unused locals...
>>> Applying phase jb.tr to <java.lang.Object: void <clinit>()>.
>>> [TypeAssigner] typing system started on Fri Feb 28 22:14:50 EET 2014
>>> [TypeAssigner] typing system ended. It took 0 mins and 0 secs.
>>> Applying phase jb.lns to <java.lang.Object: void <clinit>()>.
>>> Applying phase jb.cp to <java.lang.Object: void <clinit>()>.
>>> [<clinit>] Propagating copies...
>>> Applying phase jb.dae to <java.lang.Object: void <clinit>()>.
>>> [<clinit>] Eliminating dead code...
>>> ...
>>>
>>> [Spark] Pointer Assignment Graph in 0.0 seconds.
>>> Caused by: java.lang.RuntimeException: This operation requires resolving
>>> level HIERARCHY but sun.misc.ClassFileTransformer is at resolving level
>>> DANGLING*
>>> *If you are extending Soot, try to add the following call before calling
>>> soot.Main.main(..):*
>>> **Scene.v().addBasicClass(sun.misc.ClassFileTransformer,HIERARCHY);**
>>> **Otherwise, try whole-program mode (-w).*
>>>
>>>
>>> _*MY TRANSFORMER:*_
>>>
>>> public class MyMain {
>>>    
>>>      /**
>>>       * setup the Soot Scene to load the name class
>>>       * @param name
>>>       * @param main
>>>       * @return
>>>       */
>>>      private static SootClass loadClass(String name, boolean main) {
>>>          SootClass c = Scene.v().loadClassAndSupport(name);
>>>          c.setApplicationClass();
>>>          if (main) Scene.v().setMainClass(c);
>>>          return c;
>>>      }
>>>     
>>>      private static int getLineNumber(Stmt s) {
>>>          Iterator<Tag> ti = s.getTags().iterator();
>>>          while (ti.hasNext()) {
>>>              Object o = ti.next();
>>>              if (o instanceof LineNumberTag)
>>>                  return Integer.parseInt(o.toString());
>>>          }
>>>          return -1;
>>>      }
>>>
>>>
>>>      public static void main(String[] args) {
>>>                 
>>>          LinkedList<String> sootArgs = new
>>> LinkedList<String>(Arrays.asList(args));
>>>
>>>          // enable verbose - Provide detailed information about what Soot
>>> is doing as it runs.
>>>          sootArgs.add("-v");
>>>          sootArgs.add("enabled:true");
>>>         
>>>          // enable whole program mode
>>>          sootArgs.add("-w");
>>>          sootArgs.add("enabled:true");
>>>         
>>>          // enable whole-jimple optimization pack with true opt value
>>>          sootArgs.add("-p");
>>>          sootArgs.add("wjop");
>>>          sootArgs.add("enabled:true");
>>>
>>>          //enable points-to analysis(cg) with true opt value
>>>          sootArgs.add("-p");
>>>          sootArgs.add("cg");
>>>          sootArgs.add("enabled:true");
>>>
>>>          //enable Spark points-to analysis with true opt value
>>>          sootArgs.add("-p");
>>>          sootArgs.add("cg.spark");
>>>          sootArgs.add("enabled:true");
>>>         
>>>          //enable no-bodies-for-excluded
>>>          sootArgs.add("-no-bodies-for-excluded");
>>>          sootArgs.add("enabled:true");
>>>
>>>          //enable allow-phantom-refs
>>>          sootArgs.add("-allow-phantom-refs");
>>>          sootArgs.add("enabled:true");
>>>         
>>>          String[] argsArray = sootArgs.toArray(new String[0]);
>>>         
>>>          // Inject the analysis into Soot
>>>          PackManager.v().getPack("jtp").add(
>>>                  new Transform("jtp.myColorer", new SceneTransformer() {
>>>                     
>>>                      protected void internalTransform(String phase, Map
>>> options) {
>>>                       
>>>                          // Load the main Class
>>>                          SootClass sc = loadClass("hello.Foo",true);
>>>
>>>                          soot.Scene.v().loadNecessaryClasses();
>>>                         
>>>                         
>>> soot.Scene.v().setEntryPoints(EntryPoints.v().all());
>>>                                             
>>>                          // Set SPARK options
>>>                          HashMap<String, String> opt = new
>>> HashMap<String, String>();
>>>                          opt.put("enabled","true");
>>>                          opt.put("verbose","true");
>>>                          opt.put("ignore-types","false");
>>>                          opt.put("force-gc","false");
>>>                          opt.put("pre-jimplify","false");
>>>                          opt.put("propagator","worklist");
>>>                          opt.put("simple-edges-bidirectional","false");
>>>                          opt.put("on-fly-cg","true");
>>>                          opt.put("set-impl","double");
>>>                                 
>>>                          opt.put("vta","false");
>>>                          opt.put("rta","false");
>>>                          opt.put("field-based","false");
>>>                          opt.put("types-for-sites","false");
>>>                          opt.put("merge-stringbuffer","true");
>>>                          opt.put("string-constants","false");
>>>                          opt.put("simulate-natives","true");
>>>                          opt.put("simplify-offline","false");
>>>                          opt.put("simplify-sccs","false");
>>>                          opt.put("ignore-types-for-sccs","false");
>>>                          opt.put("double-set-old","hybrid");
>>>                          opt.put("double-set-new","hybrid");
>>>                          opt.put("dump-html","false");
>>>                          opt.put("dump-pag","false");
>>>                          opt.put("dump-solution","false");
>>>                          opt.put("topo-sort","false");
>>>                          opt.put("dump-types","true");
>>>                          opt.put("class-method-var","true");
>>>                          opt.put("dump-answer","false");
>>>                          opt.put("add-tags","false");
>>>                          opt.put("set-mass","false");
>>>
>>>                          //
>>> ---------------------------------------------------------
>>>
>>>                          // Call graph options
>>>                          soot.options.Options.v().setPhaseOption("cg",
>>> "enabled:true");
>>>                          soot.options.Options.v().setPhaseOption("cg",
>>> "implicit-entry:false");
>>>                          soot.options.Options.v().setPhaseOption("cg",
>>> "verbose:true");
>>>                         
>>> soot.options.Options.v().setPhaseOption("cg.cha",
>>> "enabled:false");
>>>                         
>>> soot.options.Options.v().setPhaseOption("cg.spark",  "enabled:true");
>>>                     
>>>                         
>>> soot.options.Options.v().setPhaseOption("cg.paddle", "enabled:false");
>>>                         
>>> soot.options.Options.v().setPhaseOption("cg.paddle", "geom-pta:true");
>>>                         
>>>                          //
>>> ---------------------------------------------------------
>>>
>>>                          // Run SPARK analysis
>>>                          G.v().out.println("[spark] Starting analysis
>>> ...");
>>>                          SparkTransformer.v().transform("",opt);
>>>                          G.v().out.println("[spark] Done!");
>>>                      }
>>>                  }));
>>>         
>>>          soot.Main.main(argsArray);
>>>      }
>>> }
>>>
>>>
>>> _______________________________________________
>>> Soot-list mailing list
>>> Soot-list at sable.mcgill.ca
>>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>>
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 


More information about the Soot-list mailing list