[Soot-list] Trouble building CallGraph

Eric Bodden eric.bodden at mail.mcgill.ca
Fri May 4 09:07:09 EDT 2007


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(OnFlyCallGraphBuilder.java:182)
>         at
> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.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(OnFlyCallGraphBuilder.java:182)
> >>
> >>         at
> >> soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.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


More information about the Soot-list mailing list