[Soot-list] Simple Interprocedural Analysis

Eric Bodden eric.bodden at mail.mcgill.ca
Tue Jul 17 20:06:31 EDT 2007


http://www.sable.mcgill.ca/pipermail/soot-list/2007-February/001041.html

On 17/07/07, Armand Navabi <anavabi at purdue.edu> wrote:
> Thanks Chris,
>
> I'll take a look at that.  In the meantime, here is where I'm at.  I
> found "An Example to Get a Call Graph" slide here:
> http://www.cs.rutgers.edu/~ryder/515/f05/lectures/Sootlecture-Weilei.pdf
>
> I implemented the example, so my code looks like this:
>
> public class MyTransformer extends SceneTransformer {
>
>   public static void main(String[] args) {
>     if(args.length == 0) System.exit(-1);
>     PackManager.v().getPack("wjtp").
>       add(new Transform("wjtp.mytransform", MyTransformer.v()));
>     soot.Main.main(args);
>   }
>
>   private static MyTransformer instance = null;
>   public static MyTransformer v() {
>     if(instance == null)
>       return (instance = new MyTransformer());
>     return instance;
>   }
>
>   protected void internalTransform (String phaseName, Map options) {
>     CallGraph cg = Scene.v().getCallGraph();
>     System.out.println("call graph: " + cg);
>   }
> }
>
> So I try to run it as the next slide says: java YourMain --app -p
> cg.spark on-fly-cg:true -w TargetJavaApplication
>
> And at first I get: Exception in thread "main"
> java.lang.RuntimeException: couldn't find class: javax.crypto.Cipher (is
> your soot-class-path set properly?)
>
> My soot-class-path is apparently not set properly.  So then I run it
> setting the soot-classpath to include rt.jar, jce.jar and jsse.jar.  So
> I run it again like this:
>
>  java analysis.getcallgraph.MyTransformer -soot-classpath
> ".:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/jsse.jar"
> --app -p cg.spark on-fly-cg:true -w analysis.examples.Foo
>
> Now this gets me further, but I still have the following error:
>
> Soot started on Tue Jul 17 19:57:12 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 6.3 seconds.
> [Spark] Type masks in 1.0 seconds.
> [Spark] Pointer Graph simplified in 0.0 seconds.
> Exception in thread "main" java.lang.RuntimeException: This operation
> requires resolving level HIERARCHY but java/lang/Object; is at resolving
> level DANGLING
>
> Not sure what resolving level hierarchy means and how exactly I fix
> this.  Any ideas?
>
> Thanks,
> Armand
>
>
> Chris Pickett wrote:
> > And by the way, I think you may as well update to the SVN trunk... no
> > promises though :)
> >
> > Chris Pickett wrote:
> >> Hi Armand,
> >>
> >> I would try searching the Soot source code for SceneTransformer.
> >>
> >> Chris
> >>
> >> Armand Navabi wrote:
> >>> Anyone know of a complete example that demonstrates interprocedural
> >>> analysis in Soot?  I have been able to find many intraprocedural
> >>> data flow analyses, but the survivor's guide (and any other tutorial
> >>> I have found) only contain bits and pieces of code for
> >>> interprocedural analysis.  Another problem is that I am using soot
> >>> 2.2.2 and it seems that everything I find is for older versions of
> >>> soot.
> >>>
> >>> While I have been able to implement any intraprocedural analysis I
> >>> want, I have played around a lot with it and have been unable to get
> >>> anything interprocedural working.  Any small example online or in a
> >>> tutorial?  Even something as simple as getting the call graph and
> >>> then printing all the methods that could potentially be called at a
> >>> call site.
> >>>
> >>> Thanks,
> >>> Armand
> >>>
> >>>
> >>> _______________________________________________
> >>> 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
>


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


More information about the Soot-list mailing list