[Soot-list] Issue Loading Method Bodies
Chris Shiflet
cshiflet at pjrcorp.com
Fri Sep 7 16:02:51 EDT 2018
Hi all,
I'm having an issue with loading method bodies when I attempt run the HEROS IFDS solver. Let me start with my stack trace:
Running Heros IFDS Solver...
Exception in thread "main" java.lang.RuntimeException: no active body present for method <com.example.UISample.JSONProject: void main(java.lang.String[])>
at soot.SootMethod.getActiveBody(SootMethod.java:359)
at soot.jimple.toolkits.ide.exampleproblems.IFDSReachingDefinitions.initialSeeds(IFDSReachingDefinitions.java:170)
at heros.solver.IFDSSolver$1.initialSeeds(IFDSSolver.java:68)
at heros.solver.IDESolver.<init>(IDESolver.java:200)
at heros.solver.IDESolver.<init>(IDESolver.java:165)
at heros.solver.IFDSSolver.<init>(IFDSSolver.java:52)
at <redacted calling method in my code>
This is the line where I instantiate IFDSSolver (reacted in the stack trace). You can see it in context later, but I've provided it here for reference:
IFDSSolver<Unit, Pair<Value, Set<DefinitionStmt>>,
SootMethod, InterproceduralCFG<Unit, SootMethod>> solver =
new IFDSSolver<Unit, Pair<Value, Set<DefinitionStmt>>, SootMethod, InterproceduralCFG<Unit, SootMethod>>(problem);
I am able to successfully perform the following earlier in the code:
* Build a call-graph using SPARK (shown below), and
* Process active method bodies with BodyTransformer and SceneTransformer in the jtp and wjtp packs, respectively (not shown).
The code leading up to the above error is as follows:
Options.v().setPhaseOption("cg", "safe-newinstance:true");
Options.v().setPhaseOption("cg.cha","enabled:false");
// Enable SPARK
Options.v().setPhaseOption("cg.spark","enabled:true");
Options.v().setPhaseOption("cg.spark","verbose:true");
Options.v().setPhaseOption("cg.spark","on-fly-cg:true");
Options.v().set_allow_phantom_refs(true);
Options.v().set_output_format(Options.output_format_class);
Options.v().set_main_class(mainClass);
SootClass c = Scene.v().loadClass(mainClass, SootClass.BODIES);
c.setApplicationClass();
SootMethod entryPoint = c.getMethodByName("main");
List<SootMethod> entryPoints = new ArrayList<SootMethod>();
entryPoints.add(entryPoint);
Scene.v().setEntryPoints(entryPoints);
Scene.v().loadNecessaryClasses();
// Set output dir
Options.v().set_output_dir(outputDir);
// Execute Soot
soot.Main.main();
// Run Heros IFDS Solver...
JimpleBasedInterproceduralCFG icfg= new JimpleBasedInterproceduralCFG();
System.out.println("1");
IFDSTabulationProblem<Unit, Pair<Value,
Set<DefinitionStmt>>, SootMethod,
InterproceduralCFG<Unit, SootMethod>> problem = new IFDSReachingDefinitions(icfg);
System.out.println("2");
IFDSSolver<Unit, Pair<Value, Set<DefinitionStmt>>,
SootMethod, InterproceduralCFG<Unit, SootMethod>> solver =
new IFDSSolver<Unit, Pair<Value, Set<DefinitionStmt>>, SootMethod, InterproceduralCFG<Unit, SootMethod>>(problem);
System.out.println("Starting solver");
solver.solve();
System.out.println("Done");
Any help is much appreciated!
Best,
---Chris
More information about the Soot-list
mailing list