[Soot-list] Trouble building CallGraph

Eric Bodden eric.bodden at mail.mcgill.ca
Fri May 4 14:14:17 EDT 2007


You should hook in a SceneTransformer before calling main(...). I
think the survivor's show how to do that.

Eric

On 04/05/07, Armand Navabi <anavabi at purdue.edu> wrote:
> Which tutorial are you referring to?  I have taken a look at the
> documentation here: http://www.sable.mcgill.ca/soot/tutorial/index.html
>
> I have also taken a look at "A Survivor's Guide to Java Program Analysis in
> Soot".  In general I have found a lot of information on intra-procedural
> analyses, but not much on inter-procedural analysis.  The Survivor's Guide
> has a subsection on extending Soot's main class, but I was unable to modify
> it to do inter-procedural analysis.
>
> What I really want is to extend Soot's main with some custom arguments and
> then hooking in my analysis to somehow get a hold of the call graph of the
> program.
>
> Are there other tutorials?
>
> Thanks for the help,
> Armand
>
> -----Original Message-----
> From: eric.bodden at googlemail.com [mailto:eric.bodden at googlemail.com] On
> Behalf Of Eric Bodden
> Sent: Friday, May 04, 2007 9:07 AM
> To: Armand Navabi
> Cc: soot-list at sable.mcgill.ca
> Subject: Re: [Soot-list] Trouble building CallGraph
>
> No, I did not.
>
> A debugger could help at that point. Try to see which method it is
> that has no body.
>
> Or have a look at our tutorials. Those show how to run Soot in the
> preferred way, which is just calling Main.main(..) with some custom
> arguments after you have hooked in your own analyses. That way there's
> much less you have to do manually and less room for mistakes.
>
> Eric
>
> On 04/05/07, Armand Navabi <anavabi at purdue.edu> wrote:
> > Hey Eric,
> >
> > Yeah.  I did double check this.  It definitely contains sun.misc.Version.
> >
> > $ jar tf /opt/sun-jdk-1.4.2.10/jre/lib/rt.jar | grep sun.misc.Version
> > sun/misc/Version.class
> >
> > Also after playing around with it, I was able to get that exception to
> > go away, only to introduce another one.  Because the exception occurs
> > when trying to build the call graph, I thought the problem was that the
> > call graph builder is unable to find Version because it has not been
> > loaded into Soot.  Now, I thought that loadClassAndSupport would load
> > that.  I am never going into whole-program mode, so maybe that is the
> > problem.  So to try to go into whole program mode, I inserted the two
> > lines below:
> >
> >     String cp = ".:/opt/sun-jdk-1.4.2.10/jre/lib/rt.jar";
> >     Scene.v().setSootClassPath(cp);
> >     String [] opts = {"-w", args[0]};      //  <-- INSERTED
> >     Main.main(opts);                              //  <-- INSERTED!
> >     SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
> >     sClass.setApplicationClass();
> >     Scene.v().setMainClass(sClass);
> >     CallGraphBuilder cgb = new CallGraphBuilder(DumbPointerAnalysis.v());
> >     cgb.build(); // <-- EXCEPTION
> >     CallGraph cg = Scene.v().getCallGraph();
> >
> > Now I get the following exception:
> > Exception in thread "main" java.lang.NullPointerException
> >         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:80)
> >         at soot.SootMethod.retrieveActiveBody(SootMethod.java:304)
> >         at
> >
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyC
> allGraphBuilder.java:182)
> >         at
> >
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFly
> CallGraphBuilder.java:81)
> >         at
> >
> soot.jimple.toolkits.callgraph.CallGraphBuilder.build(CallGraphBuilder.java:
> 87)
> >         at analysis.test.Test.main(Test.java:26)
> >
> > Did you try to run the code and did it work for you?
> >
> > Thanks,
> > Armand
> >
> > Eric Bodden wrote:
> > > Hmmm... so does your version of rt.jar actually contain that class?
> > > Since it's a class in sun.misc and not java.*, it does not really have
> > > to be.
> > >
> > > Eric
> > >
> > > On 03/05/07, Armand Navabi <anavabi at purdue.edu> wrote:
> > >> My previous problem had too much going on.  The code below demonstrates
> > >> the problem I am having:
> > >>
> > >>   public static void main(String[] args) {
> > >>     String cp = ".:/opt/sun-jdk-1.4.2.10/jre/lib/rt.jar";
> > >>     Scene.v().setSootClassPath(cp);
> > >>
> > >>     SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
> > >>     sClass.setApplicationClass();
> > >>     Scene.v().setMainClass(sClass);
> > >>
> > >>     CallGraphBuilder cgb = new
> > >> CallGraphBuilder(DumbPointerAnalysis.v());
> > >>     cgb.build(); // <-- EXCEPTION
> > >>
> > >>     CallGraph cg = Scene.v().getCallGraph();
> > >>  }
> > >>
> > >> On the line with that says EXCEPTION, I get the following exception
> only
> > >> when the code I am analyzing has a call to a library class
> > >> (System.out.println).
> > >>
> > >> Exception in thread "main" java.lang.RuntimeException:
> > >> Aborting: can't find classfile sun.misc.Version
> > >>         at soot.Scene.getSootClass(Scene.java:374)
> > >>         at soot.coffi.CFG.generateJimple(CFG.java:4647)
> > >>         at soot.coffi.CFG.jimplify(CFG.java:1464)
> > >>         at soot.coffi.CFG.jimplify(CFG.java:1127)
> > >>         at
> > >> soot.coffi.CoffiMethodSource.getBody(CoffiMethodSource.java:98)
> > >>         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:80)
> > >>         at soot.SootMethod.retrieveActiveBody(SootMethod.java:304)
> > >>         at
> > >>
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyC
> allGraphBuilder.java:182)
> > >>
> > >>         at
> > >>
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFly
> CallGraphBuilder.java:81)
> > >>
> > >>         at
> > >>
> soot.jimple.toolkits.callgraph.CallGraphBuilder.build(CallGraphBuilder.java:
> 87)
> > >>
> > >>         at analysis.test.Test.main(Test.java:21)
> > >>
> > >> It seems to me that rt.jar should be in my Soot classpath (first two
> > >> lines of method).
> > >>
> > >> 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
>
>
>


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


More information about the Soot-list mailing list