soot.jimple.toolkits.ide.icfg.JimpleBasedInterproceduralCFG Java Examples

The following examples show how to use soot.jimple.toolkits.ide.icfg.JimpleBasedInterproceduralCFG. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java    From JAADAS with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param args
 */
public static void main(String[] args) {
	
	
	PackManager.v().getPack("wjtp").add(new Transform("wjtp.ifds", new SceneTransformer() {
		protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes") Map options) {

			IFDSTabulationProblem<Unit,?,SootMethod,InterproceduralCFG<Unit,SootMethod>> problem = new IFDSPossibleTypes(new JimpleBasedInterproceduralCFG());
			
			@SuppressWarnings({ "rawtypes", "unchecked" })
			JimpleIFDSSolver<?,InterproceduralCFG<Unit,SootMethod>> solver = new JimpleIFDSSolver(problem);
			solver.solve();
		}
	}));
	
	soot.Main.main(args);
}
 
Example #2
Source File: Util.java    From SPDS with Eclipse Public License 2.0 6 votes vote down vote up
public static long getICFGEdges() {
    if (icfgEdges > 0)
        return icfgEdges;
    ReachableMethods reachableMethods = Scene.v().getReachableMethods();
    JimpleBasedInterproceduralCFG icfg = new JimpleBasedInterproceduralCFG();
    QueueReader<MethodOrMethodContext> listener = reachableMethods.listener();
    while (listener.hasNext()) {
        MethodOrMethodContext next = listener.next();
        SootMethod method = next.method();
        if (!method.hasActiveBody())
            continue;
        Body activeBody = method.getActiveBody();
        for (Unit u : activeBody.getUnits()) {
            List<Unit> succsOf = icfg.getSuccsOf(u);
            icfgEdges += succsOf.size();
            if (icfg.isCallStmt(u)) {
                icfgEdges += icfg.getCalleesOfCallAt(u).size();
            }
            if (icfg.isExitStmt(u)) {
                icfgEdges += icfg.getCallersOf(method).size();
            }
        }
    }
    return icfgEdges;
}
 
Example #3
Source File: InfoflowCFG.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
public InfoflowCFG() {
	this(new JimpleBasedInterproceduralCFG());
}
 
Example #4
Source File: InfoflowCFG.java    From JAADAS with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void notifyMethodChanged(SootMethod m) {
	if (delegate instanceof JimpleBasedInterproceduralCFG)
		((JimpleBasedInterproceduralCFG) delegate).initializeUnitToOwner(m);
}
 
Example #5
Source File: PropagationProblem.java    From DroidRA with GNU Lesser General Public License v2.1 4 votes vote down vote up
public PropagationProblem(JimpleBasedInterproceduralCFG icfg) {
  super(icfg);
  this.icfg = icfg;
}
 
Example #6
Source File: PropagationSceneTransformer.java    From DroidRA with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes") Map options) {
  PropagationTimers.v().totalTimer.start();
  PropagationTimers.v().misc.start();
  StringValueAnalysis.initialize();

  JimpleBasedInterproceduralCFG iCfg = new PropagationIcfg();
  AnalysisParameters.v().setIcfg(iCfg);
  PropagationProblem problem = new PropagationProblem(iCfg);
  for (SootMethod ep : Scene.v().getEntryPoints()) {
    if (ep.isConcrete()) {
      problem.getInitialSeeds().add(ep.getActiveBody().getUnits().getFirst());
    }
  }

  int iterationCounter = 0;
  PropagationSolver solver = null;

  while (iterationCounter < MAX_ITERATIONS) {
    IterationSolver.v().initialize(solver);
    PropagationTimers.v().misc.end();

    PropagationTimers.v().problemGeneration.start();
    solver = new PropagationSolver(problem);
    PropagationTimers.v().problemGeneration.end();

    PropagationTimers.v().ideSolution.start();
    logger.info("Solving propagation problem (iteration " + iterationCounter + ")");
    solver.solve();
    PropagationTimers.v().ideSolution.end();

    PropagationTimers.v().misc.start();
    if (!AnalysisParameters.v().isIterative() || IterationSolver.v().hasFoundFixedPoint()) {
      iterationCounter = MAX_ITERATIONS;
    } else {
      ++iterationCounter;
    }
  }
  PropagationTimers.v().misc.end();

  logger.info("Reached a fixed point");

  Results.addResult(resultBuilder.buildResult(solver));

  PropagationTimers.v().totalTimer.end();

  if (logger.isDebugEnabled()) {
    CallGraph cg = Scene.v().getCallGraph();

    Iterator<Edge> it = cg.listener();
    while (it.hasNext()) {
      soot.jimple.toolkits.callgraph.Edge e = (soot.jimple.toolkits.callgraph.Edge) it.next();
      logger.debug("" + e.src() + e.srcStmt() + " =" + e.kind() + "=> " + e.tgt());
    }

    if (printer != null) {
      printer.print(solver);
    }
  }
}
 
Example #7
Source File: AnalysisParameters.java    From DroidRA with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Sets the interprocedural control flow graph for the analysis.
 * 
 * @param icfg The interprocedural CFG.
 */
public void setIcfg(JimpleBasedInterproceduralCFG icfg) {
  this.icfg = icfg;
}
 
Example #8
Source File: AnalysisParameters.java    From DroidRA with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Gets the interprocedural control flow graph for the analysis.
 * 
 * @return The interprocedural control flow graph.
 */
public JimpleBasedInterproceduralCFG getIcfg() {
  return icfg;
}