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

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Fri Jul 22 07:28:16 EDT 2011


Hi John.

This has been answered many times on the list. Please search the
archives for EntryPoints.

Eric

On 21 July 2011 23:03, John Dee <jdsoot at hotmail.com> wrote:
> 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
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>



-- 
Dr. Eric Bodden, http://bodden.de/
Principal Investigator in Secure Services at CASED
Coordinator of the CASED Advisory Board of Study Affairs
PostDoc at Software Technology Group, Technische Universität Darmstadt
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt


More information about the Soot-list mailing list