[Soot-list] Simple Interprocedural Analysis

Armand Navabi anavabi at purdue.edu
Wed Jul 18 10:48:12 EDT 2007


Yes the problem was that I was using an older version of Soot.  I was using
Soot 2.2.2.  Using Soot 2.2.4, I was able to get the code to work (removing
the line Scene.v().loadBasicClasses()).

Thanks for the help Eric,

Armand

-----Original Message-----
From: eric.bodden at googlemail.com [mailto:eric.bodden at googlemail.com] On
Behalf Of Eric Bodden
Sent: Tuesday, July 17, 2007 8:52 PM
To: Armand Navabi
Cc: soot-list at sable.mcgill.ca
Subject: Re: [Soot-list] Simple Interprocedural Analysis

Are you still using the same command line? Might it be the case that
you are using an old version of Soot?

Eric

On 17/07/07, Armand Navabi <anavabi at purdue.edu> wrote:
> Eric,
>
> So now I get a similar runtime error except earlier.  Perhaps I am
> loading the classes at the wrong place.  Here is how I changed my code.
> I also changed the code to set the classpath instead of having to do it
> at the command line:
>
> public class MyTransformer extends SceneTransformer {
>   public static void main(String[] args) {
>     if(args.length == 0) System.exit(-1);
>
>
Scene.v().setSootClassPath(".:/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/rt.ja
r:"
> +
>
> "/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");
>     PackManager.v().getPack("wjtp").
>       add(new Transform("wjtp.mytransform", MyTransformer.v()));
>     Scene.v().loadBasicClasses();
>     soot.Main.main(args);
>   }
>
> Now I get the following runtime error:
>
> anavabi at ubuntu:~/soot/trunk$ java analysis.getcallgraph.MyTransformer
> --app -p cg.spark on-fly-cg:true -w analysis.examples.Foo
> Soot started on Tue Jul 17 20:11:58 EDT 2007
> Exception in thread "main" java.lang.RuntimeException: This operation
> requires resolving level SIGNATURES but java.lang.ref.Finalizer is at
> resolving level HIERARCHY
>         at soot.SootClass.checkLevel(SootClass.java:126)
>
> Thanks for the help,
> Armand
>
> Eric Bodden wrote:
> > 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