[Soot-list] Generating callgraph with a custom entry point

ASHISH MISHRA ashish123.mishragkp at gmail.com
Thu Nov 15 13:51:44 EST 2012


Dear All,

I followed the following link on Eric Bodden page for generating call
graphs with custom entry points. I also looked on the archives in the
mailing list and tried the answers, but I am stuck at the exception-


*Exception in thread "main" java.lang.RuntimeException: couldn't find
class: CallGraph (is your soot-class-path set properly?)*
* at soot.SootResolver.bringToHierarchy(SootResolver.java:205)*
* at soot.SootResolver.bringToSignatures(SootResolver.java:239)*
* at soot.SootResolver.bringToBodies(SootResolver.java:280)*
* at soot.SootResolver.processResolveWorklist(SootResolver.java:153)*
* at soot.SootResolver.resolveClass(SootResolver.java:124)*
* at soot.Scene.forceResolve(Scene.java:1279)*
* at CGGenerate.CallGraphAndroid.main(CallGraphAndroid.java:60)*
*
*
*
*
*My Transform file is as follows*
*
*
*
public class CallGraphAndroid {
public static void main(String[] args) {
 List<String> argsList = new ArrayList<String>(Arrays.asList(args));
 argsList.addAll(Arrays.asList(new String[]{
   "-w",
   "-pp",
   "-soot-class-path",
   ".",
   "-main-class",
   "testers.CallGraphs", //main-class
   "testers.CallGraphs",//argument classes
   "testers.A" //
   }));


   PackManager.v().getPack("wjtp").add(new
Transform("wjtp.customentrycall", new SceneTransformer() {

@Override
protected void internalTransform(String phaseName, Map options) {
// TODO Auto-generated method stub
//Options.v().parse(args);
 CHATransformer.v().transform();
        SootMethod src =
Scene.v().getMainClass().getMethodByName("doStuff");
CallGraph cg = Scene.v().getCallGraph();
Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(src));
while (targets.hasNext()) {
        SootMethod tgt = (SootMethod)targets.next();
        System.out.println(src + " may call " + tgt);
   }

 }
}));
   Options.v().parse(args);

   SootClass c = Scene.v().forceResolve("CallGraph", SootClass.BODIES);
   c.setApplicationClass();
   Scene.v().loadNecessaryClasses();
   SootMethod m = c.getMethodByName("doStuff");
   List entryPoints= new ArrayList();
   entryPoints.add(m);
   Scene.v().setEntryPoints(entryPoints);
   args= argsList.toArray(new String[0]);

   //soot.Main.main(args);
    PackManager.v().runPacks();

}
}

My input files are under the root directory of the project, so I gave the
current directory as the soot-class-path option, which works fine in normal
cases of cg with main methods.

If some one can tell me where I am going wrong it will be a great help.
Browsing the mailing list archives I found that the problem is old and
repetitive but couldn't find a solution which works for me.
*

-- 
Regards,
Ashish Mishra
Graduate Student,
Computer Science and Automation Department,IISc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20121116/aa7b6713/attachment.html 


More information about the Soot-list mailing list