[Soot-list] Building a call graph for a class that has no main
John Dee
jdsoot at hotmail.com
Fri Jul 22 12:35:41 EDT 2011
Nope, I get an error stating:
"The constructor MyEntryPoints(G) is undefined"
My code looks like:
public class CallGraphExample{ public static void main(String[] args) { // create a list from args List<String> argsList = new ArrayList<String>(Arrays.asList(args)); // add on the following arguments argsList.addAll(Arrays.asList(new String[]{ "-w", "testers.CallGraphs" })); // PackManager manages the packs containing the various phases and their options 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.CallGraphs");
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]); Scene.v().setEntryPoints(new MyEntryPoints(G.v()).all()); // Error here soot.Main.main(args); }}
class MyEntryPoints extends EntryPoints {
public MyEntryPoints(Global g) { super(g); } public List<SootMethod> all() { List<SootMethod> methods = new ArrayList<SootMethod>(); SootMethod entryPoint = Scene.v().getMainClass().getMethodByName("doStuff"); methods.add(entryPoint); return methods; }}
RegardsJD
> From: bodden at st.informatik.tu-darmstadt.de
> Date: Fri, 22 Jul 2011 18:18:25 +0200
> Subject: Re: [Soot-list] Building a call graph for a class that has no main
> To: jdsoot at hotmail.com
> CC: soot-list at sable.mcgill.ca
>
> Hi.
>
> > Now, I see an issue with this. To subclass 'EntryPoints', you must provide a
> > call to super with an
> > argument of type Singletons.Global. I'm not sure what that is or how to pass
> > it into the 'MyEntryPoints' constructor.
>
> G.v() is the singleton you are looking for.
>
> Does that work?
>
> Eric
> --
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20110722/c21cf906/attachment.html
More information about the Soot-list
mailing list