Reputation: 207
im writing a program to get and print the call graph of a program. im using soot to try and get the call graph and i pass as an argument the java class i want to print out but when i run the program i get a message that soot cant find the class. how do i configure the eclipse class path to find the calss i want to print?
my code:
public class CFG extends SceneTransformer
{
public static void main(String[] args)
{
if(args.length == 0)
{
System.out.println("Syntax: java CFG [soot options]");
System.exit(0);
}
PackManager.v().getPack("wjtp").add(new Transform("wjtp.cfg", CFG.v()));
// Just in case, resolve the PrintStream and System SootClasses.
Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);
Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);
soot.Main.main(args);
}
private static CFG instance = new CFG();
public static CFG v() { return instance; }
protected void internalTransform(String phaseName, Map options)
{
System.out.println("Entering CFG transformer");
System.out.println("phaseName = " + phaseName);
System.out.println("options = " + options);
CallGraph cg = Scene.v().getCallGraph();
SootMethod m = Scene.v().getMainMethod();
Iterator targets = new Targets(cg.edgesOutOf(m));
while (targets.hasNext()) {
SootMethod trgt = (SootMethod)targets.next();
System.out.println(m.getName() + " -> " + trgt.getName() + ";");
}
System.out.println("Exiting CFG transformer");
}
}
Upvotes: 1
Views: 1128
Reputation: 1393
You need to enable whole-program mode by using the -w flag. Otherwise w* packs do not get executed.
Upvotes: 1