[Soot-list] Building a call graph for a class that has no main

John Dee jdsoot at hotmail.com
Thu Jul 21 17:03:15 EDT 2011


Hi there. 
I refer to the example of building a class graph from the 'soot survivors guide':
	public static void main(String[] args) {	   List<String> argsList = new ArrayList<String>(Arrays.asList(args));	   argsList.addAll(Arrays.asList(new String[]{			   "-w",			   "-main-class",			   "testers.CallGraphs",//main-class			   "testers.CallGraphs",//argument classes			   "testers.A"			//	   }));	   PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {		@Override		protected void internalTransform(String phaseName, Map options) {		       CHATransformer.v().transform();                       SootClass a = Scene.v().getSootClass("testers.A");
		       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);		       }		}	   }));
           args = argsList.toArray(new String[0]);           soot.Main.main(args);	}
The above example works fine, except that class 'CallGraphs' contains a main method. However, the class that I want to analyse does not contain a main method. So, I'm wondering how I can set the method entry point? 
Thanks & Regards,JD
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110721/98341904/attachment.html 


More information about the Soot-list mailing list