[Soot-list] Spark Points-to analysis

Armand Navabi anavabi at purdue.edu
Thu Jul 19 01:47:29 EDT 2007


Of course.  Thanks for all the help Eric.  I am now able to get the 
spark points-to analysis.

I have a question about the verbose option for Spark though.  It does 
not seem to be printing out any extra information.  For example, I tried 
this from the Phase Options tutorial:

:~/soot/trunk$ java soot.Main analysis.examples.PointsToExample -p 
cg.spark verbose:true,on-fly-cg:true
Soot started on Thu Jul 19 01:41:57 EDT 2007
Transforming analysis.examples.PointsToExample...
Writing to sootOutput/analysis/examples/PointsToExample.class
Soot finished on Thu Jul 19 01:42:00 EDT 2007
Soot has run for 0 min. 2 sec.

I am setting verbose to true, but this does not print any extra 
information from spark.  Below I do not set verbose to true.  The 
default is false.  But its prints out the same thing.

:~/soot/trunk$ java soot.Main analysis.examples.PointsToExample -p 
cg.spark on-fly-cg:true
Soot started on Thu Jul 19 01:41:49 EDT 2007
Transforming analysis.examples.PointsToExample...
Writing to sootOutput/analysis/examples/PointsToExample.class
Soot finished on Thu Jul 19 01:41:51 EDT 2007
Soot has run for 0 min. 2 sec.

How can I get Spark to print out information as the analysis goes 
along.  Again thanks for the help.

Armand

Eric Bodden wrote:
> But that bug is in your code! "options" is an unmodifiable map, as the
> exception says... So better make a copy of it.
>
> Eric
>
> On 18/07/07, Armand Navabi <anavabi at purdue.edu> wrote:
>> Eric,
>>
>> Thanks for your help, but that didn't work either.  It takes a long time
>> and then I get the following exception.
>>
>> ~/soot/trunk$ java -Xmx512m analysis.pointsto.SparkExample
>> analysis.examples.PointsToExample
>> Soot started on Wed Jul 18 20:43:30 EDT 2007
>> [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 5.5 seconds.
>> [Spark] Type masks in 0.8 seconds.
>> [Spark] Pointer Graph simplified in 0.0 seconds.
>> [Spark] Propagation in 120.6 seconds.
>> [Spark] Solution found in 120.7 seconds.
>> Exception in thread "main" java.lang.UnsupportedOperationException
>>         at 
>> java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
>>         at
>> analysis.pointsto.SparkExample$1.internalTransform(SparkExample.java:50)
>>         at soot.SceneTransformer.transform(SceneTransformer.java:39)
>>         at soot.Transform.apply(Transform.java:89)
>>         ...
>>
>> Here is my code:
>> public class SparkExample
>> {
>>   public static void main(String[] args) {
>>     List<String>  sootArgs = new LinkedList(Arrays.asList(args));
>>
>>     //enable whole program mode
>>     sootArgs.add("-W");
>>     sootArgs.add("-p");
>>     sootArgs.add("wjop");
>>     sootArgs.add("enabled:true");
>>
>>     //enable points-to analysis
>>     sootArgs.add("-p");
>>     sootArgs.add("cg");
>>     sootArgs.add("enabled:true");
>>
>>     //enable Spark
>>     sootArgs.add("-p");
>>     sootArgs.add("cg.spark");
>>     sootArgs.add("enabled:true");
>>
>>     String[] argsArray = sootArgs.toArray(new String[0]);
>>
>>     PackManager.v().getPack("wjop").add(new
>>      Transform("wjop.mytrans",new SceneTransformer() {
>>          protected void internalTransform(String phaseName, Map 
>> options) {
>>            //set the PointsToAnalysis with phase options
>>            options.put("verbose", "true");
>>            options.put("propagator", "worklist");
>>            options.put("simple-edges-bidirectional", "false");
>>            options.put("on-fly-cg", "true");
>>            options.put("set-impl", "hybrid");
>>            options.put("double-set-old", "hybrid");
>>            options.put("double-set-new", "hybrid");
>>           SparkTransformer.v().transform("",options);
>>          }
>>        }));
>>     soot.Main.main(argsArray);
>>   }
>> }
>>
>> Thanks,
>> Armand
>>
>> Eric Bodden wrote:
>> > You want to do something like this here:
>> >
>> >     public static void main(String[] args) {
>> >          List<String>  sootArgs = new LinkedList(Arrays.asList(args));
>> >
>> >          //enable whole program mode
>> >          sootArgs.add("-W");
>> >          sootArgs.add("-p");
>> >          sootArgs.add("wjop");
>> >          sootArgs.add("enabled:true");
>> >
>> >          //enable points-to analysis
>> >          sootArgs.add("-p");
>> >          sootArgs.add("cg");
>> >          sootArgs.add("enabled:true");
>> >
>> >          //enable Spark
>> >          sootArgs.add("-p");
>> >          sootArgs.add("cg.spark");
>> >          sootArgs.add("enabled:true");
>> >
>> >
>> >          String[] argsArray = sootArgs.toArray(new String[0]);
>> >
>> >          PackManager.v().getPack("wjop").add(new
>> > Transform("wjop.mytrans",new SceneTransformer() {
>> >
>> >            protected void internalTransform(String phaseName, Map
>> > options) {
>> >         // your stuff here
>> >            }
>> >
>> >          }));
>> >
>> >          soot.Main.main(argsArray);
>> >      }
>> >
>> > On 18/07/07, Eric Bodden <eric.bodden at mail.mcgill.ca> wrote:
>> >> I think you never call soot.Main.main(args); - do you? Also, you 
>> might
>> >> want to use the -w option.
>> >>
>> >> Eric
>> >>
>> >> On 18/07/07, Armand Navabi <anavabi at purdue.edu> wrote:
>> >> > I am trying to use Soot's points-to analysis. I figured the best 
>> place
>> >> > to go is the survivor's guide Points-to Analysis chapter
>> >> > (http://www.brics.dk/~mis/soot.pdf).  There they have an example
>> >> that I
>> >> > have implemented.  In the example verbose option is set to true.  I
>> >> > think this is what makes it print out information as the 
>> analysis goes
>> >> > along, except that when I run mine nothing prints out.  Below is 
>> the
>> >> > code.  I am running the program like this:
>> >> > java -Xmx512m -Xss256m analysis.pointsto.SparkExample
>> >> > Perhaps I need extra command line arguments to Soot?
>> >> >
>> >> > public class SparkExample
>> >> > {
>> >> >   private static SootClass loadClass(String name, boolean main) {
>> >> >     SootClass c = Scene.v().loadClassAndSupport(name);
>> >> >     c.setApplicationClass();
>> >> >     if(main) Scene.v().setMainClass(c);
>> >> >     return c;
>> >> >   }
>> >> >
>> >> >   public static void main(String[] args)
>> >> >   {
>> >> >     loadClass("analysis.pointsto.Item", false);
>> >> >     loadClass("analysis.pointsto.Container", false);
>> >> >     SootClass c = loadClass("analysis.pointsto.SparkExample", 
>> true);
>> >> >
>> >> >     Map options = new HashMap();
>> >> >     options.put("verbose", "true");
>> >> >     options.put("propagator", "worklist");
>> >> >     options.put("simple-edges-bidirectional", "false");
>> >> >     options.put("on-fly-cg", "true");
>> >> >     options.put("set-impl", "hybrid");
>> >> >     options.put("double-set-old", "hybrid");
>> >> >     options.put("double-set-new", "hybrid");
>> >> >
>> >> >     SparkTransformer.v().transform("",options);
>> >> >   }
>> >> >
>> >> >   public void go() {
>> >> >     Container c1 = new Container();
>> >> >     Item i1 = new Item();
>> >> >     c1.setItem(i1);
>> >> >     Container c2 = new Container();
>> >> >     Item i2 = new Item();
>> >> >     c2.setItem(i2);
>> >> >     Container c3 = c2;
>> >> >   }
>> >> > }
>> >> >
>> >> > class Container {
>> >> >   private Item item = new Item();
>> >> >   void setItem(Item item) {
>> >> >     this.item = item;
>> >> >   }
>> >> >   Item getItem() {
>> >> >     return this.item;
>> >> >   }
>> >> > }
>> >> > class Item { Object data; }
>> >> >
>> >> > Thanks,
>> >> > Armand
>> >> > _______________________________________________
>> >> > Soot-list mailing list
>> >> > Soot-list at sable.mcgill.ca
>> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >> >
>> >>
>> >>
>> >> --
>> >> Eric Bodden
>> >> Sable Research Group
>> >> McGill University, Montréal, Canada
>> >>
>> >
>> >
>>
>>
>
>



More information about the Soot-list mailing list