[Soot-list] spark problem with "keep-original-names" option

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Jul 14 11:39:54 EDT 2009


By not calling Soot's main method you are circumventing much of it's
default logic, such as executing the LocalSplitter. In your particular
case it seems that you end up not executing the "jb" pack at all.

One way to circumvent this is to use PackManager to retrieve the "jb"
pack manually and then apply it. The other, possibly easier way is to
use Soot's main method and do all "your work" in a SceneTransformer.

Eric

2009/7/14 lpxz <lpxz at ust.hk>:
> Hi:
>   Yes, I see the reason, because spark is flow-insensitive. and the temp
> variable $r1 make i1 and i2 have the same point-to set.
>
>
>    I did not use soot.Main.main(), Instead, I use loadNecessaryClasses(),
> and loadClass("Item") to load them. I believe they can load the method I
> need.
> Then I directly use the transformer class to generate PAG:
>       PhaseOptions.v().setPhaseOption("cg.spark", "enabled:true");
>       SparkTransformer.v().transform("",opt);
>
>    and for query:
>    I call directly :
>    SparkQueryAnalysis.v().transform(); which is implemented this way:
>     for( Iterator cIt = Scene.v().getClasses().iterator(); cIt.hasNext(); )
> {
>               final SootClass c = (SootClass) cIt.next();
>               for( Iterator mIt = c.methodIterator(); mIt.hasNext(); ) {
>                   SootMethod m = (SootMethod) mIt.next();
>                   if( !m.isConcrete() ) continue;
>                   if( !m.hasActiveBody() ) continue;
>                   ====printout m.body here===
>               }
>     }
>
>
>    but seems
>     this option works:  PhaseOptions.v().setPhaseOption("jb",
> "use-original-names:true");
>     while this option does *not* work:
> PhaseOptions.v().setPhaseOption("jb.ls", "enabled:true");
>     Could you help me understand this matter.
>     Maybe I should try to use soot.Main.main(), but it seems a little slow
> to get what I want.
>
>      Thank you for your patient explanation.
> Regards.
> peng
>
>
>    Eric Bodden wrote:
>>
>> Ok, I can see what is causing the problem. It's these lines...
>>
>>
>>>
>>> $r1 = new Item
>>> i1 = $r1
>>> $r1 = new Item
>>> i2 = $r1
>>>
>>
>> As you probably know, Spark is flow-insensitive, i.e. it "sees" the
>> above statements as a set (!) of subset constraints. Because $r1 is
>> assigned both to i1 and i2, Spark does therefore not know whether the
>> value of $r1 from the first assignment "$r1 = new Item" or the one
>> from the second assignment "$r1 = new Item" is assigned to i1,
>> respectively i2.
>>
>> When you enable use-original-names, then Soot will rename the first
>> $r1 to a variable different from the second $r1 and therefore you get
>> different, more precise equations.
>>
>> The solution to your problem is applying the LocalSplitter to every
>> method:
>>
>> http://www.sable.mcgill.ca/soot/doc/soot/toolkits/scalar/LocalSplitter.html
>>
>> Normally, the splitter is enabled by default:
>>
>> http://www.sable.mcgill.ca/soot/tutorial/phase/phase.html#SECTION00021000000000000000
>>
>> I wonder why this does not happen in your case. How are you creating
>> the Jimple code? Are you calling soot.Main.main(..) at all?
>>
>> Eric
>>
>>
>
>



-- 
Eric Bodden
Sable Research Group, McGill University
Montréal, Québec, Canada


More information about the Soot-list mailing list