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

Wiza w1zagr33n at gmail.com
Wed Mar 5 10:52:33 EST 2014


Hi again,

I've read every tutorial and documentation. But still seems weird.
I follow exactly the example on the tutorial for PointsToAnalysis.java 
from soot code.
I would really appreciate if you could take a look on my code and let me 
know
what goes wrong.

Thank you very much in advance,
Wii


*My Code:*
public static void main(String[] args) {

         // Inject the analysis into Soot
         PackManager.v().getPack("jtp").add(
                 new Transform("jtp.myColorer", new SceneTransformer() {

                     protected void internalTransform(String phase, Map 
options) {

                         SootClass sc = loadClass("hello.Test1",true);

                         soot.Scene.v().loadNecessaryClasses();
                         soot.Scene.v().loadBasicClasses();

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");

                         // Run SPARK analysis
                         SparkTransformer.v().transform("",opt);
                     }
                 }));


         LinkedList<String> sootArgs = new 
LinkedList<String>(Arrays.asList(args));

         String cp = "same_path_as_used_on_soot_output";
         Scene.v().setSootClassPath(cp);

         Options.v().set_whole_program(true);
Options.v().set_src_prec(soot.options.Options.src_prec_java);

         // prepend class path
         sootArgs.add("-prepend-classpath");
         sootArgs.add("enabled:true");

         // enable verbose - detailed info about what Soot is doing as 
it runs.
         // sootArgs.add("-v");

         // enable whole program mode
         sootArgs.add("-w");

         // enable whole-jimple optimization pack with true opt value
         sootArgs.add("-p");
         sootArgs.add("wjop");
         sootArgs.add("enabled:true");

         //enable points-to analysis(cg)
         sootArgs.add("-p");
         sootArgs.add("cg");
         sootArgs.add("enabled:true");

         sootArgs.add("-p");
         sootArgs.add("cg");
         sootArgs.add("implicit-entry:false");

         sootArgs.add("-p");
         sootArgs.add("cg");
         sootArgs.add("verbose:true");

         sootArgs.add("-p");
         sootArgs.add("cg.cha");
         sootArgs.add("enabled:false");

         //enable Spark points-to analysis
         sootArgs.add("-p");
         sootArgs.add("cg.spark");
         sootArgs.add("enabled:true");

         sootArgs.add("-p");
         sootArgs.add("cg.spark");
         sootArgs.add("dump-html:true");

         sootArgs.add("-p");
         sootArgs.add("cg.spark");
         sootArgs.add("geom-pta:true");

         //disable Paddle points-to analysis
         sootArgs.add("-p");
         sootArgs.add("cg.paddle");
         sootArgs.add("enabled:false");

         sootArgs.add("-no-bodies-for-excluded");
         sootArgs.add("-allow-phantom-refs");

         String[] argsArray = sootArgs.toArray(new String[0]);

         // Invoke soot.Main with arguments given
         soot.Main.main(argsArray);
     }
}




*This is what I get on the output:*

Starting from project MyColorer:
MyMain --d D:\Wiza\workspace\hello\sootOutput --cp 
/C:/Program%20Files/Java/jre7/lib/jsse.jar; ... --xml-attributes 
--src-prec java hello.Foo

Soot started on Wed Mar 05 17:40:40 EET 2014
Warning: java.dyn.InvokeDynamic is a phantom class!
No main class given. Inferred 'hello.Foo' as main class.
[Spark] Pointer Assignment Graph in 0.0 seconds.
java.lang.reflect.InvocationTargetException
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
     at java.lang.reflect.Method.invoke(Unknown Source)
     at ca.mcgill.sable.soot.launching.SootThread.run(SootThread.java:138)
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).*
     at soot.SootClass.checkLevel(SootClass.java:125)
     at soot.FastHierarchy.canStoreClass(FastHierarchy.java:280)
     at soot.FastHierarchy.canStoreType(FastHierarchy.java:215)
     at soot.FastHierarchy.canStoreType(FastHierarchy.java:261)
     at 
soot.jimple.spark.internal.TypeManager.castNeverFails(TypeManager.java:113)
     at 
soot.jimple.spark.internal.TypeManager.makeTypeMask(TypeManager.java:92)
     at 
soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:91)
     at soot.SceneTransformer.transform(SceneTransformer.java:39)
     at soot.Transform.apply(Transform.java:89)
     at soot.RadioScenePack.internalApply(RadioScenePack.java:57)
     at 
soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:49)
     at soot.Pack.apply(Pack.java:114)
     at soot.PackManager.runWholeProgramPacks(PackManager.java:417)
     at soot.PackManager.runPacks(PackManager.java:336)
     at soot.Main.run(Main.java:198)
     at soot.Main.main(Main.java:141)
     at MyMain.main(MyMain.java:307)
     ... 5 more




On 05/03/2014 05:04, soot-list-request at sable.mcgill.ca wrote:
> ----------------------------------------------------------------------
> Message: 1
> Date: Tue, 04 Mar 2014 14:40:24 -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 (Wii re)
> To: soot-list at sable.mcgill.ca
> Message-ID: <53162C28.9030105 at polymtl.ca>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi Wiza,
>
> Try setting prepend classpath to true. Please take the time to read the
> documentation.
>
> Marc-Andr? Laverdi?re-Papineau
> Doctorant - PhD Candidate
>
> On 03/04/2014 12:59 PM, Wiza wrote:
>> Hi,
>>
>> I still get the same error.
>> As 'class path' you mean:   soot.Scene.v().setSootClassPath(mypath);
>> ,right?
>> *mypath* should point to the same path? It's not so clear to me.
>>
>>
>> _The error I get:_
>> [Spark] Pointer Assignment Graph in 0.2 seconds.
>> java.lang.reflect.InvocationTargetException
>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>      at java.lang.reflect.Method.invoke(Unknown Source)
>>      at ca.mcgill.sable.soot.launching.SootThread.run(SootThread.java:138)
>> 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).
>>      at soot.SootClass.checkLevel(SootClass.java:125)
>>      at soot.FastHierarchy.canStoreClass(FastHierarchy.java:280)
>>      at soot.FastHierarchy.canStoreType(FastHierarchy.java:215)
>>      at soot.FastHierarchy.canStoreType(FastHierarchy.java:261)
>>      at
>> soot.jimple.spark.internal.TypeManager.castNeverFails(TypeManager.java:113)
>>      at
>> soot.jimple.spark.internal.TypeManager.makeTypeMask(TypeManager.java:92)
>>      at
>> soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:91)
>>      at soot.SceneTransformer.transform(SceneTransformer.java:39)
>>      at soot.Transform.apply(Transform.java:89)
>>      at soot.RadioScenePack.internalApply(RadioScenePack.java:57)
>>      at
>> soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:49)
>>      at soot.Pack.apply(Pack.java:114)
>>      at soot.PackManager.runWholeProgramPacks(PackManager.java:417)
>>      at soot.PackManager.runPacks(PackManager.java:336)
>>      at soot.Main.run(Main.java:198)
>>      at soot.Main.main(Main.java:141)
>>      at MyMain.main(MyMain.java:328)
>>
>> Thank you very much :)
>>
>>
>> On 04/03/2014 19:00, soot-list-request at sable.mcgill.ca wrote:
>>> ------------------------------ Message: 2 Date: Tue, 04 Mar 2014
>>> 11:53:15 -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 (Wii re) To: soot-list at sable.mcgill.ca
>>> Message-ID: <531604FB.9030709 at polymtl.ca> Content-Type: text/plain;
>>> charset=ISO-8859-1
>>>
>>> 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
>>>>
>>>>
>>
>>
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at sable.mcgill.ca
>> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 5 Mar 2014 02:43:51 +0000
> From: M Alsob <m99m20 at hotmail.com>
> Subject: Re: [Soot-list] Duplicating Locals!!
> To: " Bodden, Eric " <eric.bodden at sit.fraunhofer.de>
> Cc: " soot-list at sable.mcgill.ca " <soot-list at sable.mcgill.ca>
> Message-ID: <DUB407-EAS145F779F1BF04D0DA5F906FCD890 at phx.gbl>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,,
>
> this is a method in the test java source:
>
> public static void fun(int x)
>
>
>
> {
>
>
>
>
>
>
>
> x--;
>
>   
>
> int option1 = x%3;
>
>
>
> int option2 = x%2;
>
>
>
> switch ( option1 )
>
>
>
> {
>
>   
>
> case 1 :
>
>
>
> switch ( option2 )
>
>
>
> {
>
>   
>
> case 1 : System.out.println("Option1, Option1");
>
>
>
> break;
>
>
>
> case 0 : System.out.println("Option1, Option2");
>
>
>
> break;
>
>
>
> default : System.out.println("Option1, Unknown");
>
>
>
> }
>
>   
>
> break;
>
>
>
> case 2 : System.out.println("Option2, No Nested Switch");
>
>
>
> break;
>
>
>
> default : System.out.println("Unknown Case");
>
>
>
> }
>
>
>
>
>   
>
> System.out.println(x);
>
>
>
> return;
>
>
>
> }
>
> the jimple body corresponding to it:
>
>
> /*8*/
>
>   public static void fun(int)
>
> {
>
>   int x, option1, option2, x;
>
> java.io.PrintStream $r0;
>
>
>   x := @parameter0: int;
>
> /*9*/
>
> x = x + -1;
>
> /*9*/
>
> option1 = x % 3;
>
> /*10*/
>
> /*10*/
>
> option2 = x % 2;
>
> /*11*/
>
> /*11*/
>
>   tableswitch(option1)
>
> {
>
>   case 1: goto label0;
>
>   case 2: goto label4;
>
>   default: goto label5;
>
> };
>
> /*12*/
>
>
> label0:
>
>   tableswitch(option2)
>
> {
>
>   case 0: goto label2;
>
>   case 1: goto label1;
>
>   default: goto label3;
>
> };
>
> /*15*/
>
>
> label1:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*17*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>("Option1, Option1");
>
> /*17*/
>
>   goto label6;
>
> /*18*/
>
>
> label2:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*19*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>("Option1, Option2");
>
> /*19*/
>
>   goto label6;
>
> /*20*/
>
>
> label3:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*21*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>("Option1, Unknown");
>
> /*21*/
>
>   goto label6;
>
> /*23*/
>
>
> label4:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*24*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>("Option2, No Nested Switch");
>
> /*24*/
>
>   goto label6;
>
> /*25*/
>
>
> label5:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*26*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(java.lang.String)>("Unknown Case");
>
> /*26*/
>
>
> label6:
>
> $r0 = <java.lang.System: java.io.PrintStream out>;
>
> /*29*/
>
>   virtualinvoke $r0.<java.io.PrintStream: void println(int)>(x);
>
> /*29*/
>
>   return;
>
> /*30*/
>
> }
>
> for the main method, we the following vars:
>
> int w = 5, y, x, z;
>
> the corresponding vars in jimple body:
>
> byte w, y;
>
> int x, z, x, w, $i0;
>
> java.lang.StringBuilder $r0;
>
> boolean $z0, y;
>
> As you can see some vars in jimple declared twice -in the same scope- either of the same data type( such as x) or of different data types( such as w, and y)..
>
> this issue affects the both liveness and reaching definition analysis of the source code!!
>
> is there a way to force jimple transformation to stick to the original data types as declared in the source code??
>
> Thank you,,
>
>
>
>
>
>
>
> Sent from Windows Mail
>
>
>
>
>
> From: Bodden, Eric
> Sent: ?Monday?, ?March? ?3?, ?2014 ?8?:?02? ?AM
> To: Modhi Alsobeihy
> Cc: Steven Arzt, soot-list at sable.mcgill.ca
>
>
>
>
>
> Hello.
>
> What does the Jimple body look like for this method?
> In general it is not uncommon for Jimple bodies to have multiple Locals with the same name. This can even happen in Java due to scoping rules of blocks.
>
> Eric
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140305/2e371460/attachment.html
>
> ------------------------------
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>
> End of Soot-list Digest, Vol 107, Issue 8
> *****************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140305/36c6bf18/attachment-0001.html 


More information about the Soot-list mailing list