protected CallGraphBuilder<? super I> buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, IProgressMonitor monitor) throws IllegalArgumentException, CancelException { CallGraphBuilder<? super I> builder = getCallGraphBuilder(cha, options, cache); cg = builder.makeCallGraph(options, monitor); if (savePointerAnalysis) { pointerAnalysis = builder.getPointerAnalysis(); } return builder; }
public CallGraph buildDefaultCallGraph() throws IllegalArgumentException, CancelException, IOException { return defaultCallGraphBuilder().makeCallGraph(options, null); }
public CallGraph buildDefaultCallGraph() throws IllegalArgumentException, CancelException, IOException { return defaultCallGraphBuilder().makeCallGraph(options, null); }
protected CallGraphBuilder<? super I> buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, IProgressMonitor monitor) throws IllegalArgumentException, CancelException { CallGraphBuilder<? super I> builder = getCallGraphBuilder(cha, options, cache); cg = builder.makeCallGraph(options, monitor); if (savePointerAnalysis) { pointerAnalysis = builder.getPointerAnalysis(); } return builder; }
public static CallGraph buildRTA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) throws IllegalArgumentException, CancelException { StopwatchGC S = null; if (CHECK_FOOTPRINT) { S = new StopwatchGC("build RTA graph"); S.start(); } CallGraphBuilder<InstanceKey> builder = Util.makeRTABuilder(options, cache, cha, scope); CallGraph cg = builder.makeCallGraph(options, null); if (CHECK_FOOTPRINT) { S.stop(); System.err.println(S.report()); } return cg; }
public static CallGraph buildZeroOneCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope, boolean testPAtoString) throws IllegalArgumentException, CancelException { StopwatchGC S = null; if (CHECK_FOOTPRINT) { S = new StopwatchGC("build RTA graph"); S.start(); } CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope); CallGraph cg = builder.makeCallGraph(options, null); if (testPAtoString) { builder.getPointerAnalysis().toString(); } if (CHECK_FOOTPRINT) { S.stop(); System.err.println(S.report()); } return cg; }
public static CallGraph buildVanillaZeroOneCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) throws IllegalArgumentException, CancelException { StopwatchGC S = null; if (CHECK_FOOTPRINT) { S = new StopwatchGC("build RTA graph"); S.start(); } CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope); CallGraph cg = builder.makeCallGraph(options, null); if (CHECK_FOOTPRINT) { S.stop(); System.err.println(S.report()); } return cg; }
public static Graph<Object> buildPointsTo(String appJar) throws WalaException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, (new FileProvider()).getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS)); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha); AnalysisOptions options = new AnalysisOptions(scope, entrypoints); // // // build the call graph // // com.ibm.wala.ipa.callgraph.CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(),cha, scope, null, null); CallGraph cg = builder.makeCallGraph(options,null); PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis(); System.err.println(pointerAnalysis); return new BasicHeapGraph<>(pointerAnalysis, cg); } }
public static CallGraph buildZeroContainerCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) throws IllegalArgumentException, CancelException { StopwatchGC S = null; if (CHECK_FOOTPRINT) { S = new StopwatchGC("build RTA graph"); S.start(); } CallGraphBuilder<InstanceKey> builder = Util.makeZeroContainerCFABuilder(options, cache, cha, scope); CallGraph cg = builder.makeCallGraph(options, null); if (CHECK_FOOTPRINT) { S.stop(); System.err.println(S.report()); } return cg; }
private static void run(String classPath, String exclusionFilePath) throws IOException, ClassHierarchyException, CallGraphBuilderCancelException{ File exclusionFile = (new FileProvider()).getFile(exclusionFilePath); AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, exclusionFile != null ? exclusionFile : new File(CallGraphTestUtil.REGRESSION_EXCLUSIONS)); ClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha); AnalysisOptions options = new AnalysisOptions(scope, entrypoints); // // // build the call graph // // com.ibm.wala.ipa.callgraph.CallGraphBuilder<InstanceKey> builder = Util.makeZeroCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis(); @SuppressWarnings("unused") WalaViewer walaViewer = new WalaViewer(cg, pa); } }
public static CallGraph buildZeroOneContainerCFA(AnalysisOptions options, IAnalysisCacheView cache, IClassHierarchy cha, AnalysisScope scope) throws IllegalArgumentException, CancelException { StopwatchGC S = null; if (CHECK_FOOTPRINT) { S = new StopwatchGC("build RTA graph"); S.start(); } CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope); CallGraph cg = builder.makeCallGraph(options, null); if (CHECK_FOOTPRINT) { S.stop(); System.err.println(S.report()); } return cg; }
/** * test for bug reported on mailing list by Joshua Garcia, 5/16/2010 */ @Test public void testTestInetAddr() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException, UnsoundGraphException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTINETADDR); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); SDG<?> sdg = new SDG<>(cg, builder.getPointerAnalysis(), DataDependenceOptions.NO_BASE_NO_HEAP, ControlDependenceOptions.FULL); GraphIntegrity.check(sdg); }
CallGraph cg = builder.makeCallGraph(options, null); long end = System.currentTimeMillis(); System.out.println("done");
@Test public void testSlice5() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE5_MAIN); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); CGNode n = findMethod(cg, "baz"); Statement s = findCallTo(n, "foo"); s = PDFSlice.getReturnStatementForCall(s); System.err.println("Statement: " + s); // compute a data slice final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis(); Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL, ControlDependenceOptions.NONE); dumpSlice(slice); Assert.assertEquals(slice.toString(), 7, slice.size()); }
this.callgraph = builder.makeCallGraph(options, null); this.buildTimeNano = System.nanoTime() - start_nanos; WalaCallgraphConstructor.log.info("Call graph construction completed in " + StringUtil.nanoToFlexDurationString(this.buildTimeNano));
@Test public void testSlice4() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE4_MAIN); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); CGNode main = findMainMethod(cg); Statement s = findCallTo(main, "foo"); s = PDFSlice.getReturnStatementForCall(s); System.err.println("Statement: " + s); // compute a data slice final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis(); Collection<Statement> slice = Slicer.computeForwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL, ControlDependenceOptions.NONE); dumpSlice(slice); Assert.assertEquals(slice.toString(), 4, slice.size()); }
CallGraph cg = builder.makeCallGraph(options, null); long end = System.currentTimeMillis(); System.out.println("done");
@Test public void testJustThrow() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_JUSTTHROW); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); CGNode main = findMainMethod(cg); Statement s = findCallToDoNothing(main); System.err.println("Statement: " + s); final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis(); Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.FULL, ControlDependenceOptions.NO_EXCEPTIONAL_EDGES); dumpSlice(slice); }
/** * Usage: {@code IFDSExplorerExample -dotExe <path_to_dot_exe> -viewerExe <path_to_viewer_exe>} */ public static void main(String[] args) throws IOException, IllegalArgumentException, CallGraphBuilderCancelException, WalaException { Properties p = CommandLine.parse(args); AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, "Java60RegressionExclusions.txt"); IClassHierarchy cha = ClassHierarchyFactory.make(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Ldataflow/StaticDataflow"); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); IAnalysisCacheView cache = new AnalysisCacheImpl(); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope); System.out.println("building CG"); CallGraph cg = builder.makeCallGraph(options, null); System.out.println("done with CG"); System.out.println("computing reaching defs"); ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg); TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, Pair<CGNode, Integer>> result = reachingDefs.analyze(); System.out.println("done with reaching defs"); IFDSExplorer.setDotExe(p.getProperty("dotExe")); IFDSExplorer.setGvExe(p.getProperty("viewerExe")); IFDSExplorer.viewIFDS(result); }
@Test public void testTestCD1() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.SLICE_TESTCD1); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraphBuilder<InstanceKey> builder = Util.makeZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope); CallGraph cg = builder.makeCallGraph(options, null); CGNode main = findMainMethod(cg); Statement s = findCallToDoNothing(main); System.err.println("Statement: " + s); // compute a data slice final PointerAnalysis<InstanceKey> pointerAnalysis = builder.getPointerAnalysis(); Collection<Statement> slice = Slicer.computeBackwardSlice(s, cg, pointerAnalysis, DataDependenceOptions.NONE, ControlDependenceOptions.FULL); dumpSlice(slice); Assert.assertEquals(slice.toString(), 2, countConditionals(slice)); }