[Soot-list] Callgraphs, CHATransformer
Marco Bakera
marco.bakera at tu-dortmund.de
Wed Feb 18 02:32:37 EST 2009
Hi André,
I consider a similar problem although the CHATransformer does not throw an
Exception but simply does not return. It seems to call System.exit(0)
somewhere in between. :( I think your call to the transformer should be after
having set up the options.
However, Soot community, could you please hand in some code snippet that can
be used to generate a call graph? So far extensive research in the tutorial
and this mailinglist weren't successful. :(
Thank you for your support.
Best,
Marco.
On Wednesday 18 February 2009 08:20:59 André Lobitz wrote:
> 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 --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20090218/99a4d010/attachment.bin
More information about the Soot-list
mailing list