com.ibm.wala.ipa.callgraph.impl.Util.makeVanillaZeroOneCFABuilder()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中com.ibm.wala.ipa.callgraph.impl.Util.makeVanillaZeroOneCFABuilder()方法的一些代码示例,展示了Util.makeVanillaZeroOneCFABuilder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.makeVanillaZeroOneCFABuilder()方法的具体详情如下:
包路径:com.ibm.wala.ipa.callgraph.impl.Util
类名称:Util
方法名:makeVanillaZeroOneCFABuilder

Util.makeVanillaZeroOneCFABuilder介绍

暂无

代码示例

代码示例来源:origin: wala/WALA

/**
 * @return a 0-1-CFA Call Graph Builder.
 * 
 * @param options options that govern call graph construction
 * @param cha governing class hierarchy
 * @param scope representation of the analysis scope
 */
public static SSAPropagationCallGraphBuilder makeVanillaZeroOneCFABuilder(Language l, AnalysisOptions options, IAnalysisCacheView analysisCache,
  IClassHierarchy cha, AnalysisScope scope) {
 return makeVanillaZeroOneCFABuilder(l, options, analysisCache, cha, scope, null, null);
}

代码示例来源:origin: com.ibm.wala/com.ibm.wala.core

/**
 * @return a 0-1-CFA Call Graph Builder.
 * 
 * @param options options that govern call graph construction
 * @param cha governing class hierarchy
 * @param scope representation of the analysis scope
 */
public static SSAPropagationCallGraphBuilder makeVanillaZeroOneCFABuilder(Language l, AnalysisOptions options, IAnalysisCacheView analysisCache,
  IClassHierarchy cha, AnalysisScope scope) {
 return makeVanillaZeroOneCFABuilder(l, options, analysisCache, cha, scope, null, null);
}

代码示例来源:origin: wala/WALA

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;
}

代码示例来源:origin: SAP/vulnerability-assessment-tool

builder = Util.makeZeroContainerCFABuilder(options, cache, this.cha, this.scope);
} else if (cg_algorithm.equals("vanilla-0-1-CFA")) {
  builder = Util.makeVanillaZeroOneCFABuilder(options, cache, this.cha, this.scope);
} else if (cg_algorithm.equals("0-1-CFA")) {
  builder = Util.makeZeroOneCFABuilder(options, cache, this.cha, this.scope);

代码示例来源:origin: wala/WALA

private static IDemandPointerAnalysis makeDemandPointerAnalysis(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
  CallGraph cg, MemoryAccessMap fam) {
 SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 // return new TestNewGraphPointsTo(cg, builder, fam, cha, warnings);
 DemandRefinementPointsTo fullDemandPointsTo = DemandRefinementPointsTo.makeWithDefaultFlowGraph(cg, builder, fam, cha, options, new DummyStateMachine.Factory<IFlowLabel>());
 // fullDemandPointsTo.setOnTheFly(true);
 // fullDemandPointsTo.setRefineFields(true);
 return fullDemandPointsTo;
}

代码示例来源:origin: wala/WALA

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);
 }
}

代码示例来源:origin: wala/WALA

private static IDemandPointerAnalysis makeDemandPointerAnalysis(AnalysisOptions options, ClassHierarchy cha, AnalysisScope scope,
  CallGraph cg, MemoryAccessMap fam) {
 SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 // return new TestNewGraphPointsTo(cg, builder, fam, cha, warnings);
 DemandRefinementPointsTo fullDemandPointsTo = DemandRefinementPointsTo.makeWithDefaultFlowGraph(cg, builder, fam, cha, options, new DummyStateMachine.Factory<IFlowLabel>());
 // fullDemandPointsTo.setCGRefinePolicy(new AlwaysRefineCGPolicy());
 // fullDemandPointsTo.setFieldRefinePolicy(new AlwaysRefineFieldsPolicy());
 fullDemandPointsTo.setRefinementPolicyFactory(new SinglePassRefinementPolicy.Factory(new AlwaysRefineFieldsPolicy(),
   new AlwaysRefineCGPolicy()));
 return fullDemandPointsTo;
}

代码示例来源:origin: wala/WALA

/**
 * builds a call graph, and sets the corresponding heap model for analysis
 */
private static Pair<CallGraph, PointerAnalysis<InstanceKey>> buildCallGraph(AnalysisScope scope, ClassHierarchy cha, AnalysisOptions options)
  throws IllegalArgumentException, CancelException {
 CallGraph retCG = null;
 PointerAnalysis<InstanceKey> retPA = null;
 final IAnalysisCacheView cache = new AnalysisCacheImpl();
 CallGraphBuilder<InstanceKey> builder;
 if (CHEAP_CG) {
  builder = Util.makeZeroCFABuilder(Language.JAVA, options, cache, cha, scope);
  // we want vanilla 0-1 CFA, which has one abstract loc per allocation
  heapModel = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, cache, cha, scope);
 } else {
  builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
  heapModel = (HeapModel) builder;
 }
 ProgressMaster master = ProgressMaster.make(new NullProgressMonitor(), 360000, false);
 master.beginTask("runSolver", 1);
 try {
  retCG = builder.makeCallGraph(options, master);
  retPA = builder.getPointerAnalysis();
 } catch (CallGraphBuilderCancelException e) {
  System.err.println("TIMED OUT!!");
  retCG = e.getPartialCallGraph();
  retPA = e.getPartialPointerAnalysis();
 }
 return Pair.make(retCG, retPA);
}

代码示例来源:origin: wala/WALA

@Test public void testMultiDim() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA, CallGraphTestUtil.REGRESSION_EXCLUSIONS);
 ClassHierarchy cha = ClassHierarchyFactory.make(scope);
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util
   .makeMainEntrypoints(scope, cha, TestConstants.MULTI_DIM_MAIN);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(),cha, scope);
 CallGraph cg = builder.makeCallGraph(options, null);
 PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
 
 CGNode node = findDoNothingNode(cg);
 PointerKey pk = pa.getHeapModel().getPointerKeyForLocal(node, 1);
 OrdinalSet<InstanceKey> ptsTo = pa.getPointsToSet(pk);
 Assert.assertEquals(1, ptsTo.size());
}

代码示例来源:origin: wala/WALA

@Test
 public void testZeroLengthArray() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
  AnalysisScope scope = CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,
    CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  ClassHierarchy cha = ClassHierarchyFactory.make(scope);
  Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
    TestConstants.ZERO_LENGTH_ARRAY_MAIN);
  AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);

  CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
  CallGraph cg = builder.makeCallGraph(options, null);
  PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();
//    System.err.println(pa);

  HeapModel heapModel = pa.getHeapModel();
  CGNode mainNode = cg.getNode(
    cha.resolveMethod(MethodReference.findOrCreate(
      TypeReference.findOrCreate(ClassLoaderReference.Application, TestConstants.ZERO_LENGTH_ARRAY_MAIN),
      Selector.make("main([Ljava/lang/String;)V"))), Everywhere.EVERYWHERE);
  OrdinalSet<InstanceKey> pointsToSet = pa.getPointsToSet(heapModel.getPointerKeyForLocal(mainNode, 4));
  Assert.assertEquals(1, pointsToSet.size());
  InstanceKey arrayKey = pointsToSet.iterator().next();
  OrdinalSet<InstanceKey> arrayContents = pa.getPointsToSet(heapModel.getPointerKeyForArrayContents(arrayKey));
  System.err.println(arrayContents);
  Assert.assertEquals(0, arrayContents.size());
  
 }
}

代码示例来源:origin: wala/WALA

Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphBuilder<InstanceKey> builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);

代码示例来源:origin: wala/WALA

private static void doTests(AnalysisScope scope, final ClassHierarchy cha, AnalysisOptions options) throws IllegalArgumentException, CancelException {
 final SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, new AnalysisCacheImpl(), cha, scope);
 final CallGraph oldCG = builder.makeCallGraph(options,null);
 final PointerAnalysis<InstanceKey> pa = builder.getPointerAnalysis();

代码示例来源:origin: wala/WALA

protected DemandRefinementPointsTo makeDemandPointerAnalysis(String mainClass) throws ClassHierarchyException,
  IllegalArgumentException, CancelException, IOException {
 AnalysisScope scope = findOrCreateAnalysisScope();
 // build a type hierarchy
 IClassHierarchy cha = findOrCreateCHA(scope);
 // set up call graph construction options; mainly what should be considered
 // entrypoints?
 Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, mainClass);
 AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
 final IAnalysisCacheView analysisCache = new AnalysisCacheImpl();
 CallGraphBuilder<InstanceKey> cgBuilder = Util.makeZeroCFABuilder(Language.JAVA, options, analysisCache, cha, scope);
 final CallGraph cg = cgBuilder.makeCallGraph(options, null);
 // System.err.println(cg.toString());
 // MemoryAccessMap mam = new SimpleMemoryAccessMap(cg,
 // cgBuilder.getPointerAnalysis().getHeapModel(), false);
 MemoryAccessMap mam = new PABasedMemoryAccessMap(cg, cgBuilder.getPointerAnalysis());
 SSAPropagationCallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(Language.JAVA, options, analysisCache, cha, scope);
 DemandRefinementPointsTo fullDemandPointsTo = DemandRefinementPointsTo.makeWithDefaultFlowGraph(cg, builder, mam, cha, options,
   getStateMachineFactory());
 // always refine array fields; otherwise, can be very sensitive to differences
 // in library versions.  otherwise, no refinement by default
 fullDemandPointsTo.setRefinementPolicyFactory(new SinglePassRefinementPolicy.Factory(new OnlyArraysPolicy(), new NeverRefineCGPolicy()));
 return fullDemandPointsTo;
}

相关文章