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

Eric Bodden eric.bodden at ec-spride.de
Fri Nov 16 03:48:23 EST 2012


Hi.

Are you sure that "." contains a file CallGraph.class?

Eric

On 15 November 2012 19:51, ASHISH MISHRA <ashish123.mishragkp at gmail.com> wrote:
> 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
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list