Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2015 The Pennsylvania State University and the University of Wisconsin
   * Systems and Internet Infrastructure Security Laboratory
   *
   * Author: Damien Octeau
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package edu.psu.cse.siis.coal;
 
 import java.util.Map;
 
 
 import soot.Scene;
The scene transformer for the propagation problem.
 
 public class PropagationSceneTransformer extends SceneTransformer {
   private static final int MAX_ITERATIONS = 15;
 
   private final Logger logger = LoggerFactory.getLogger(getClass());
   private final ResultBuilder resultBuilder;
   private final PropagationSceneTransformerPrinter printer;

  
Constructor for the scene transformer.

Parameters:
resultBuilder A ResultBuilder that describes how the result is generated once the problem solution is found.
printer A PropagationSceneTransformerPrinter that prints the output of the analysis when debugging is enabled. If null, nothing gets printed.
 
   public PropagationSceneTransformer(ResultBuilder resultBuilder,
       PropagationSceneTransformerPrinter printer) {
     this. = resultBuilder;
     this. = printer;
   }
 
   @Override
   protected void internalTransform(String phaseName, @SuppressWarnings("rawtypes"Map options) {
     PropagationTimers.v()..start();
     PropagationTimers.v()..start();
     StringValueAnalysis.initialize();
 
     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 < ) {
       IterationSolver.v().initialize(solver);
       PropagationTimers.v()..end();
 
       PropagationTimers.v()..start();
       solver = new PropagationSolver(problem);
       PropagationTimers.v()..end();
 
       PropagationTimers.v()..start();
       .info("Solving propagation problem (iteration " + iterationCounter + ")");
       solver.solve();
       PropagationTimers.v()..end();
 
       PropagationTimers.v()..start();
       if (!AnalysisParameters.v().isIterative() || IterationSolver.v().hasFoundFixedPoint()) {
         iterationCounter = ;
       } else {
         ++iterationCounter;
       }
     }
     PropagationTimers.v()..end();
 
     .info("Reached a fixed point");
    Results.addResult(.buildResult(solver));
    PropagationTimers.v()..end();
    if (.isDebugEnabled()) {
      CallGraph cg = Scene.v().getCallGraph();
      Iterator<Edgeit = cg.listener();
      while (it.hasNext()) {
        .debug("" + e.src() + e.srcStmt() + " =" + e.kind() + "=> " + e.tgt());
      }
      if ( != null) {
        .print(solver);
      }
    }
  }
New to GrepCode? Check out our FAQ X