[Soot-list] Using soot and heros : Inter procedural Flow Analysis

Utsav Chokshi uvc.smart.29 at gmail.com
Thu Feb 27 02:14:07 EST 2014


Hello Soot-Community,

I am currently using 'heros and soot' combination for interprocedural data
flow analysis.
For that,  I am going through 'Reaching Definition' example provided under
'soot.jimple.toolkits.ide'
In that I am unable to manipulate 'FlowFunction' reference returned by
flowFunctions.NormalFlowFunction

Below is code, I am using for getting NormalFlowFunction between Unit and
Successor Unit of single method. [ also I have written my difficulties in
comments.]

See the code, if you find my approach for getting reaching definition wrong
then tell me.
If any one have good document over this thing, then do provide me. [ I
already read paper published by Erric Bodden on this.]
I am aiming to use IFDS framework for performing Intraprocedural Analysis
(normal flow function is for that ,right?) as well as Interprocedural Flow
analysis (other threee flow functions).

[Note : I am using nightly build version [ 24th Feb, 2014] of soot]

And lastly, is there any other way of doing inter procedural data flow
analysis (using soot).

Thanks in advance for reading this much.

*Code written under SceneTransformer :*

SootMethod mainMethod=mainClass.getMethod(

"void main(java.lang.String[])");

JimpleBasedInterproceduralCFG icfg=
*new* JimpleBasedInterproceduralCFG();

IFDSReachingDefinitions reachingDefs=
*new* IFDSReachingDefinitions(icfg);

reachingDefs.computeValues();

Set<SootMethod> calledMethodSet=
*new* HashSet<SootMethod>();

calledMethodSet.add(mainMethod);

*for*(Unit unit, icfg.getCallsFromWithin(mainMethod)){

InvokeExpr expr=((Stmt)unit).getInvokeExpr();

* if*(!expr.getMethod().isJavaLibraryMethod()){

calledMethodSet.add(expr.getMethod());
}

}

UnitGraph unitGraph;

FlowFunction<Pair<Value, Set<DefinitionStmt>>> flowFunction;

*for*

(SootMethod sootMethod : calledMethodSet){

System.*out*.println("Currently in : " + sootMethod.toString());

jimpleBody=(JimpleBody) sootMethod.getActiveBody();

unitGraph=

*new* BriefUnitGraph(jimpleBody);

*for*(Unit unit : jimpleBody.getUnits()){

System.*out*.println(" Current unit : " + unit.toString());

*if*((Stmt)unit *instanceof* DefinitionStmt){

*for*(Unit succUnit : unitGraph.getSuccsOf(unit)){

 flowFunction = reachingDefs.flowFunctions().getNormalFlowFunction(unit,
succUnit);
 // Now what to do with this refrence 'flowFunction'
 // Only method it provides is 'computevalues()' which requires source as
argument

 // So what should be that argument ?
 // I have tried providing an arg : left operand of definition stmt and
definition set, but it is returning empty set
 // And What is puropse of having 'succ unit' as second argument in
'NormalFlowFunction' ?

   }

}

}

}

- Utsav Chokshi
[ Intern ,TCS Innovation Labs , Pune, India]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20140227/e160ca64/attachment.html 


More information about the Soot-list mailing list