[Soot-list] Callgraphs, CHATransformer

André Lobitz andre-lobitz at gmx.de
Wed Feb 18 02:20:59 EST 2009


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);
    }

}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090218/5f6eb422/attachment.html 


More information about the Soot-list mailing list