[Soot-list] How to get reaching definitions using IFDSReachingDefinitions

TELKUNTE NIKHIL RAJENDRA cs16m028 cs16m028 at smail.iitm.ac.in
Tue Mar 20 08:08:18 EDT 2018


Hello Soot-Community

I am facing a problem with IFDSReachingDefinitions.

I am trying to get reaching definitions for the following function.

public void foo()
> {
> 1     TestLoop this;
> 2     java.io.PrintStream $r0;
> 3     int j;
>
> 4     this := @this: TestLoop;
>
> 5     j = 0;
>
> 6    label1:
> 7     if j >= 10 goto label2;
>
> 8     $r0 = <java.lang.System: java.io.PrintStream out>;
>
> 9     virtualinvoke $r0.<java.io.PrintStream: void println(int)>(j);
>
> 10    j = j + 1;
>
> 11    goto label1;
>
> 12    label2:
> 13       return;
> }
>


for line 7 reaching defs should be line 5 and line 10.

But after using this code, I'm not getting any reaching defs.

*******Code********
> Set<Pair<Value, Set<DefinitionStmt>>> results = new HashSet<Pair<Value,
> Set<DefinitionStmt>>>();
>
> JimpleBasedInterproceduralCFG icfg = new JimpleBasedInterproceduralCFG();
>
> IFDSTabulationProblem<Unit, Pair<Value, Set<DefinitionStmt>>, SootMethod,
> InterproceduralCFG<Unit, SootMethod>>
>     problem = (IFDSTabulationProblem) new IFDSReachingDefinitions(icfg);
>
> JimpleIFDSSolver<Pair<Value, Set<DefinitionStmt>>,
> InterproceduralCFG<Unit, SootMethod>>
> solver = new JimpleIFDSSolver<Pair<Value, Set<DefinitionStmt>>,
> InterproceduralCFG<Unit, SootMethod>>(problem, true);
>
> solver.solve();
>
> results.addAll((Collection<? extends Pair<Value, Set<DefinitionStmt>>>)
> solver.ifdsResultsAt(ret));
> print(results);
>

"results" is empty at this point.

I don't understand what I'm doing wrong. Any suggestions?

Thanks,

--Nikhil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20180320/26da9fc6/attachment.html>


More information about the Soot-list mailing list