public ReachableMethods getReachableMethods() { if (reachableMethods == null) { reachableMethods = new ReachableMethods(getCallGraph(), new ArrayList<MethodOrMethodContext>(getEntryPoints())); } reachableMethods.update(); return reachableMethods; }
@Override protected void internalTransform(String phaseName, Map<String, String> options) { PurityOptions opts = new PurityOptions(options); logger.debug("[AM] Analysing purity"); CallGraph cg = Scene.v().getCallGraph(); // launch the analysis new PurityInterproceduralAnalysis(cg, Scene.v().getEntryPoints().iterator(), opts); } }
@Override public FlowFunction<Local> getNormalFlowFunction(Unit curr, Unit succ) { final SootMethod m = interproceduralCFG().getMethodOf(curr); if (Scene.v().getEntryPoints().contains(m) && interproceduralCFG().isStartPoint(curr)) { return new FlowFunction<Local>() {
public ReachableMethods getReachableMethods() { if( reachableMethods == null ) { reachableMethods = new ReachableMethods( getCallGraph(), new ArrayList<MethodOrMethodContext>(getEntryPoints()) ); } reachableMethods.update(); return reachableMethods; } public void setReachableMethods( ReachableMethods rm ) {
public ReachableMethods getReachableMethods() { if( reachableMethods == null ) { reachableMethods = new ReachableMethods( getCallGraph(), new ArrayList<MethodOrMethodContext>(getEntryPoints()) ); } reachableMethods.update(); return reachableMethods; } public void setReachableMethods( ReachableMethods rm ) {
protected void internalTransform(String phaseName, Map options) { PurityOptions opts = new PurityOptions(options); G.v().out.println("[AM] Analysing purity"); CallGraph cg = Scene.v().getCallGraph(); // launch the analysis PurityInterproceduralAnalysis p = new PurityInterproceduralAnalysis(cg, Scene.v().getEntryPoints().iterator(), opts); } }
protected void internalTransform(String phaseName, Map options) { PurityOptions opts = new PurityOptions(options); G.v().out.println("[AM] Analysing purity"); CallGraph cg = Scene.v().getCallGraph(); // launch the analysis PurityInterproceduralAnalysis p = new PurityInterproceduralAnalysis(cg, Scene.v().getEntryPoints().iterator(), opts); } }
@Override public IInfoflowCFG buildBiDirICFG(CallgraphAlgorithm callgraphAlgorithm, boolean enableExceptions) { if (callgraphAlgorithm == CallgraphAlgorithm.OnDemand) { // Load all classes on the classpath to signatures long beforeClassLoading = System.nanoTime(); OnTheFlyJimpleBasedICFG.loadAllClassesOnClassPathToSignatures(); logger.info("Class loading took {} seconds", (System.nanoTime() - beforeClassLoading) / 1E9); long beforeHierarchy = System.nanoTime(); Scene.v().getOrMakeFastHierarchy(); assert Scene.v().hasFastHierarchy(); logger.info("Hierarchy building took {} seconds", (System.nanoTime() - beforeHierarchy) / 1E9); long beforeCFG = System.nanoTime(); IInfoflowCFG cfg = new InfoflowCFG(new OnTheFlyJimpleBasedICFG(Scene.v().getEntryPoints())); logger.info("CFG generation took {} seconds", (System.nanoTime() - beforeCFG) / 1E9); return cfg; } BiDiInterproceduralCFG<Unit, SootMethod> baseCFG = getBaseCFG(enableExceptions); return new InfoflowCFG(baseCFG); }
protected Collection<SootMethod> getMethodsForSeeds(IInfoflowCFG icfg) { List<SootMethod> seeds = new LinkedList<SootMethod>(); // If we have a callgraph, we retrieve the reachable methods. Otherwise, // we have no choice but take all application methods as an // approximation if (Scene.v().hasCallGraph()) { ReachableMethods reachableMethods = Scene.v().getReachableMethods(); reachableMethods.update(); for (Iterator<MethodOrMethodContext> iter = reachableMethods.listener(); iter.hasNext();) { SootMethod sm = iter.next().method(); if (isValidSeedMethod(sm)) seeds.add(sm); } } else { long beforeSeedMethods = System.nanoTime(); Set<SootMethod> doneSet = new HashSet<SootMethod>(); for (SootMethod sm : Scene.v().getEntryPoints()) getMethodsForSeedsIncremental(sm, doneSet, seeds, icfg); logger.info("Collecting seed methods took {} seconds", (System.nanoTime() - beforeSeedMethods) / 1E9); } return seeds; }
String newLine = System.getProperty("line.separator"); List<MethodOrMethodContext> eps = new ArrayList<MethodOrMethodContext>(Scene.v().getEntryPoints()); ReachableMethods reachableMethods = new ReachableMethods(Scene.v().getCallGraph(), eps.iterator(), null);
/** * Runs all code optimizers * * @param sourcesSinks The SourceSinkManager */ private void eliminateDeadCode(ISourceSinkManager sourcesSinks) { InfoflowManager dceManager = new InfoflowManager(config, null, icfgFactory.buildBiDirICFG(config.getCallgraphAlgorithm(), config.getEnableExceptionTracking()), null, null, null, new AccessPathFactory(config), null); // We need to exclude the dummy main method and all other artificial methods // that the entry point creator may have generated as well Set<SootMethod> excludedMethods = new HashSet<>(); if (additionalEntryPointMethods != null) excludedMethods.addAll(additionalEntryPointMethods); excludedMethods.addAll(Scene.v().getEntryPoints()); ICodeOptimizer dce = new DeadCodeEliminator(); dce.initialize(config); dce.run(dceManager, excludedMethods, sourcesSinks, taintWrapper); }
new ArrayList<MethodOrMethodContext>(Scene.v().getEntryPoints()); ReachableMethods reachableMethods = new ReachableMethods(Scene.v().getCallGraph(), eps.iterator(), null);
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());
List<SootMethod> entryPoints = new LinkedList<SootMethod>(Scene.v().getEntryPoints()); for (SootClass sc : classes) { if (sc.resolvingLevel() >= SootClass.SIGNATURES) {