[Soot-list] How to get a call graph about my program except the thousands of library methods' edges?

wang_qingtan wqt4585 at 163.com
Thu Jun 17 03:08:22 EDT 2010


 Hi all!
When I use call graph in Soot:
CallGraph cg = Scene.v().getCallGraph();
the cg contains thousands of edges between library methods. For example, when I use the code in http://www.sable.mcgill.ca/pipermail/soot-list/2004-October/000047.html to analysis the CallGraphs.java file which is the example of soot-survivors-guide .The call graph contains 168254 edges. 
After learning the soot-survivors-guide, I know how to get a specified method's edges outof or into it( cg.edgesOutOf(src) or cg.edgesInto(src)). 
But, now I want to know can I get a call grph which only contains edges between my program methods or between my method and library methods. 
Thank you !
 
Souce code inhttp://www.sable.mcgill.ca/pipermail/soot-list/2004-October/000047.html:
package olhotak;
import soot.*;
import java.util.*;
import java.io.*;
import soot.jimple.*;
import soot.util.queue.*;
import soot.jimple.toolkits.callgraph.*;

public class CallGraphDumper extends SceneTransformer {
    public static void main(String[] args) 
    {
PackManager.v().getPack("wjtp").add(
    new Transform("wjtp.dumpcg", new CallGraphDumper()));

soot.Main.main(args);
    }

    protected void internalTransform(String phaseName, Map options)
    {
        CallGraph cg = Scene.v().getCallGraph();

        Iterator it = cg.listener();
        while( it.hasNext() ) {
            soot.jimple.toolkits.callgraph.Edge e =
                (soot.jimple.toolkits.callgraph.Edge) it.next();
            System.out.println(""+e.src()+e.srcStmt()+" ="+e.kind()+"=> "+e.tgt());
        }
    }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20100617/9d7dd0b7/attachment-0001.html 


More information about the Soot-list mailing list