public AnalysisCacheImpl(IRFactory<IMethod> irFactory) { this(irFactory, new AnalysisOptions().getSSAOptions()); }
if (jarIS != null) scope.addInputStreamForJarToScope(ClassLoaderReference.Application, jarIS); else AnalysisScopeReader.addClassPathToScope(inPath, scope, ClassLoaderReference.Application); AnalysisOptions options = new AnalysisOptions(scope, null); AnalysisCache cache = new AnalysisCacheImpl(); IClassHierarchy cha = ClassHierarchyFactory.makeWithPhantom(scope);
AnalysisOptions options = new AnalysisOptions(this.scope, this.entrypoints); options.setReflectionOptions(ReflectionOptions.valueOf(VulasConfiguration.getGlobal().getConfiguration().getString("vulas.reach.wala.callgraph.reflection")));
@Override public AnalysisOptions getDefaultOptions(Iterable<Entrypoint> entrypoints) { AnalysisOptions options = new AnalysisOptions(getScope(), entrypoints); SSAOptions ssaOptions = new SSAOptions(); ssaOptions.setDefaultValues(SymbolTable::getDefaultValue); options.setSSAOptions(ssaOptions); return options; } }
private static DefinitelyDerefedParams getAnalysisDriver( IMethod mtd, AnalysisOptions options, AnalysisCache cache, IClassHierarchy cha) { IR ir = cache.getIRFactory().makeIR(mtd, Everywhere.EVERYWHERE, options.getSSAOptions()); ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = ir.getControlFlowGraph(); accountCodeBytes(mtd); return new DefinitelyDerefedParams(mtd, ir, cfg, cha); }
public static void addBypassLogic(AnalysisOptions options, AnalysisScope scope, ClassLoader cl, XMLMethodSummaryReader summary, IClassHierarchy cha) throws IllegalArgumentException { if (scope == null) { throw new IllegalArgumentException("scope is null"); } if (options == null) { throw new IllegalArgumentException("options is null"); } if (cl == null) { throw new IllegalArgumentException("cl is null"); } if (cha == null) { throw new IllegalArgumentException("cha cannot be null"); } MethodTargetSelector ms = new BypassMethodTargetSelector(options.getMethodTargetSelector(), summary.getSummaries(), summary.getIgnoredPackages(), cha); options.setSelector(ms); ClassTargetSelector cs = new BypassClassTargetSelector(options.getClassTargetSelector(), summary.getAllocatableClasses(), cha, cha.getLoader(scope.getLoader(Atom.findOrCreateUnicodeAtom("Synthetic")))); options.setSelector(cs); }
System.out.println(Warnings.asString()); Warnings.clear(); AnalysisOptions options = new AnalysisOptions(); Iterable<Entrypoint> entrypoints = entryClass != null ? makePublicEntrypoints(cha, entryClass) : Util.makeMainEntrypoints(scope, cha, mainClass); options.setEntrypoints(entrypoints); options.setReflectionOptions(ReflectionOptions.NONE); IAnalysisCacheView cache = new AnalysisCacheImpl();
private static MethodTargetSelector setupMethodTargetSelector(JavaScriptConstructorFunctions constructors2, AnalysisOptions options) { MethodTargetSelector result = new JavaScriptConstructTargetSelector(constructors2, options.getMethodTargetSelector()); if (options instanceof JSAnalysisOptions && ((JSAnalysisOptions)options).handleCallApply()) { result = new JavaScriptFunctionApplyTargetSelector(new JavaScriptFunctionDotCallTargetSelector(result)); } return result; }
System.out.println(Warnings.asString()); Warnings.clear(); AnalysisOptions options = new AnalysisOptions(); Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE, cha, new String[] { mainClass } ); options.setEntrypoints(entrypoints);
public static void addDefaultDispatchLogic(AnalysisOptions options, IClassHierarchy cha) { com.ibm.wala.ipa.callgraph.impl.Util.addDefaultSelectors(options, cha); Map<Atom,MethodTargetSelector> methodTargetSelectors = HashMapFactory.make(); methodTargetSelectors.put(JavaScriptLoader.JS.getName(), new JavaScriptConstructTargetSelector(cha, new StandardFunctionTargetSelector(cha, options.getMethodTargetSelector()))); methodTargetSelectors.put(Language.JAVA.getName(), options.getMethodTargetSelector()); options.setSelector(new CrossLanguageMethodTargetSelector(methodTargetSelectors)); }
if (!getBuilder().getOptions().getHandleStaticInit()) { return; IMethod targetMethod = getOptions().getMethodTargetSelector().getCalleeTarget(callGraph.getFakeRootNode(), site, null); if (targetMethod != null) { CGNode target = getTargetForCall(callGraph.getFakeRootNode(), site, null, null);
system.setMinEquationsForTopSort(options.getMinEquationsForTopSort()); system.setTopologicalGrowthFactor(options.getTopologicalGrowthFactor()); system.setMaxEvalBetweenTopo(options.getMaxEvalBetweenTopo()); for (Entrypoint E : options.getEntrypoints()) { if (DEBUG_ENTRYPOINTS) { System.err.println("Entrypoint: " + E);
IAnalysisCacheView cache = new AnalysisCacheImpl(); options.setReflectionOptions(ReflectionOptions.STRING_ONLY); options.setTraceStringConstants(true); options.setUseConstantSpecificKeys(true);
@Override public CallGraph makeCallGraph(AnalysisOptions options, IProgressMonitor monitor) throws IllegalArgumentException, CallGraphBuilderCancelException { Pair<JSCallGraph, PointerAnalysis<ObjectVertex>> dat; try { dat = builder.buildCallGraph(options.getEntrypoints(), monitor); } catch (CancelException e) { throw CallGraphBuilderCancelException.createCallGraphBuilderCancelException(e, null, null); } ptr = dat.snd; return dat.fst; }
@Test public void testCornerCases() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); // this speeds up the test options.setReflectionOptions(ReflectionOptions.NONE); doCallGraphs(options, new AnalysisCacheImpl(), cha, scope); // we expect a warning or two about class Abstract1, which has no concrete // subclasses String ws = Warnings.asString(); Assert.assertTrue("failed to report a warning about Abstract1", ws.indexOf("cornerCases/Abstract1") > -1); // we do not expect a warning about class Abstract2, which has a concrete // subclasses Assert.assertTrue("reported a warning about Abstract2", ws.indexOf("cornerCases/Abstract2") == -1); }
/** * Set up an AnalysisOptions object with default selectors, corresponding to class hierarchy lookup * * @throws IllegalArgumentException if options is null */ public static void addDefaultSelectors(AnalysisOptions options, IClassHierarchy cha) { if (options == null) { throw new IllegalArgumentException("options is null"); } options.setSelector(new LambdaMethodTargetSelector(new ClassHierarchyMethodTargetSelector(cha))); options.setSelector(new ClassHierarchyClassTargetSelector(cha)); }
public AndroidModel(final IClassHierarchy cha, final AnalysisOptions options, final IAnalysisCacheView cache) { this.options = options; this.cha = cha; this.cache = cache; this.built = false; this.scope = options.getAnalysisScope(); this.instanceBehavior = AndroidEntryPointManager.MANAGER.getInstantiationBehavior(cha); }
public static AnalysisOptions makeAnalysisOptions(AnalysisScope scope, Iterable<Entrypoint> entrypoints) { AnalysisOptions options = new AnalysisOptions(scope, entrypoints); return options; }
public static Pair<CallGraph, PointerAnalysis<InstanceKey>> makeAPKCallGraph(URI[] androidLibs, File androidAPIJar, String apkFileName, IProgressMonitor monitor, ReflectionOptions policy) throws IOException, ClassHierarchyException, IllegalArgumentException, CancelException { AnalysisScope scope = makeDalvikScope(androidLibs, androidAPIJar, apkFileName); final IClassHierarchy cha = ClassHierarchyFactory.make(scope); IAnalysisCacheView cache = new AnalysisCacheImpl(new DexIRFactory()); List<? extends Entrypoint> es = getEntrypoints(cha); assert ! es.isEmpty(); AnalysisOptions options = new AnalysisOptions(scope, es); options.setReflectionOptions(policy); // SSAPropagationCallGraphBuilder cgb = Util.makeZeroCFABuilder(options, cache, cha, scope, null, makeDefaultInterpreter(options, cache)); SSAPropagationCallGraphBuilder cgb = Util.makeZeroCFABuilder(Language.JAVA, options, cache, cha, scope); CallGraph callGraph = cgb.makeCallGraph(options, monitor); PointerAnalysis<InstanceKey> ptrAnalysis = cgb.getPointerAnalysis(); return Pair.make(callGraph, ptrAnalysis); }
@Override public AnalysisOptions getDefaultOptions(Iterable<Entrypoint> entrypoints) { AnalysisOptions options = new AnalysisOptions(getScope(), entrypoints); SSAOptions ssaOptions = new SSAOptions(); ssaOptions.setDefaultValues(SymbolTable::getDefaultValue); options.setSSAOptions(ssaOptions); return options; }