[Soot-list] Issue Loading Method Bodies

Eric Bodden eric.bodden at uni-paderborn.de
Tue Sep 11 07:36:27 EDT 2018


Hmm, does the code for this method exist on the classpath you provide to Soot?

com.example.UISample.JSONProject: void main(java.lang.String[])

Cheers
Eric

> On 10. Sep 2018, at 16:55, Chris Shiflet <cshiflet at pjrcorp.com> wrote:
> 
> Hi Eric,
> 
> Yes, I do enabled whole-program mode. I neglected to include them in my code snippet. These lines appears just before the snippet in my previous message.
> 
>        Options.v().set_whole_program(true);
>        Options.v().set_app(true);
> 
> Thanks,
> ---Chris
> 
> -----Original Message-----
> From: Eric Bodden <eric.bodden at uni-paderborn.de> 
> Sent: Monday, September 10, 2018 3:29 AM
> To: Chris Shiflet <cshiflet at pjrcorp.com>
> Subject: Re: [Soot-list] Issue Loading Method Bodies
> 
> Hi Chris.
> 
> Do you have whole-program-mode enabled? (-w flag) I cannot see this in your code.
> 
> Cheers
> Eric
> 
>> On 7. Sep 2018, at 22:02, Chris Shiflet <cshiflet at pjrcorp.com> wrote:
>> 
>> 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
>> _______________________________________________
>> Soot-list mailing list
>> Soot-list at CS.McGill.CA
>> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
> 
> 



More information about the Soot-list mailing list