[Soot-list] Generating callgraph with a custom entry point
Zhoulai
zell08v at orange.fr
Fri Nov 16 03:34:17 EST 2012
Hi
I guess you should reset your classpath.
You may want to put this line into your java source,
* System.out.println( System.getenv("CLASSPATH") ;*
and see whether soot.jimple.toolkits.CallGraph is reachable from the
printed class path ?
You may also want to check your PATH environment, because you used the
"-pp" option.
Hope that helps.
Zell.
On Thu, Nov 15, 2012 at 7:51 PM, 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20121116/b0fd3839/attachment.html
More information about the Soot-list
mailing list