[Soot-list] Callgraphs, CHATransformer

Eric Bodden eric.bodden at mail.mcgill.ca
Wed Feb 18 09:21:03 EST 2009


Hi.

At the point at which you call transform(), nothing at all has been
initialized. You should put your call to transform() into a
SceneTransformer, preferably within the wjtp pack. Then you have to
call Soot's main method. This will automatically take care of parsing
the command line, initializing Soot accordingly and then calling your
transformer.

You may want to look at our tutorials, especially into this one here
that explains the various packs and also how to insert a transform:
http://www.bodden.de/2008/11/26/soot-packs/

Eric

2009/2/18 André Lobitz <andre-lobitz at gmx.de>:
> I am trying to create callgraphs using soot. Therefore i've added the
> Soot-classes.jar to my library list and written a small class (see below). I
> am only getting the error message
>     [Call Graph] For information on where the call graph may be incomplete,
> use the verbose option to the cg phase.
> and a NullPointerException. It seems to be the call
>     CHATransformer.v().transform();
> throwing the Exception. Can anyone help me?
>
> Thanx,
> André
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> package diplom.main;
>
> import soot.jimple.toolkits.callgraph.*;
> import java.util.Iterator;
> import soot.Scene;
> import soot.SootClass;
> import soot.SootMethod;
> import soot.options.Options;
>
> public class SootTest {
>
>     public static void main(String[] args) {
>         CHATransformer.v().transform();
>
>         Options.v().set_whole_program(true);
>         SootClass mainClass =
> Scene.v().loadClassAndSupport("diplom.testers.omg");
>         mainClass.setApplicationClass();
>         Scene.v().setMainClass(mainClass);
>
>         SootMethod src = mainClass.getMethodByName("main");
>         CallGraph cg = Scene.v().getCallGraph();
>         Iterator targets = new Targets(cg.edgesOutOf(src));
>         while (targets.hasNext()) {
>             SootMethod tgt = (SootMethod) targets.next();
>             System.out.println(src + " may call " + tgt);
>         }
>     }
> }
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> package diplom.testers;
>
> public class omg {
>
>     int a;
>     int b;
>     int stop;
>
>     public omg(int a, int b){
>         this.a = a;
>         this.b = b;
>     }
>
>     public void omfg(int c){
>         for (int i=a; i<c; i++){
>             System.out.println(c+b);
>             omfg(--c);
>         }
>     }
>
>     public static void main(String[] args){
>         omg it = new omg(1, 10);
>         it.omfg(6);
>     }
>
> }
>
> _______________________________________________
> 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, Québec, Canada


More information about the Soot-list mailing list