• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AnalysisScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.ibm.wala.ipa.callgraph.AnalysisScope的典型用法代码示例。如果您正苦于以下问题:Java AnalysisScope类的具体用法?Java AnalysisScope怎么用?Java AnalysisScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AnalysisScope类属于com.ibm.wala.ipa.callgraph包,在下文中一共展示了AnalysisScope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createClassHierarchy

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
private void createClassHierarchy() throws IOException, ClassHierarchyException {
	long s = System.currentTimeMillis();

	// check if we have a multi-dex file
	stats.isMultiDex = ApkUtils.isMultiDexApk(stats.appFile);
	if (stats.isMultiDex)
		logger.info("Multi-dex apk detected - Code is merged to single class hierarchy!");

	// create analysis scope and generate class hierarchy
	// we do not need additional libraries like support libraries,
	// as they are statically linked in the app code.
	final AnalysisScope scope = AndroidAnalysisScope.setUpAndroidAnalysisScope(new File(stats.appFile.getAbsolutePath()).toURI(), null /* no exclusions */, null /* we always pass an android lib */, CliOptions.pathToAndroidJar.toURI());

	cha = ClassHierarchy.make(scope);
	logger.info("generated class hierarchy (in " + Utils.millisecondsToFormattedTime(System.currentTimeMillis() - s) + ")");
	LibraryProfiler.getChaStats(cha);
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:18,代码来源:LibraryIdentifier.java


示例2: makeCG

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
  try {
    IClassHierarchy cha = makeHierarchy(scope, loaders);
    com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
    Iterable<Entrypoint> roots = makeScriptRoots(cha);
    JSAnalysisOptions options = makeOptions(scope, cha, roots);
    options.setHandleCallApply(builderType.handleCallApply());
    IAnalysisCacheView cache = makeCache(irFactory);
    JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
        builderType.useOneCFA());
    if(builderType.extractCorrelatedPairs())
      builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));

    return builder;
  } catch (ClassHierarchyException e) {
    assert false : "internal error building class hierarchy";
    return null;
  }
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:20,代码来源:JSCallGraphBuilderUtil.java


示例3: makeCG

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
  try {
    IClassHierarchy cha = makeHierarchy(scope, loaders);
    com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
    Iterable<Entrypoint> roots = makeScriptRoots(cha);
    JSAnalysisOptions options = makeOptions(scope, cha, roots);
    options.setHandleCallApply(builderType.handleCallApply());
    AnalysisCache cache = makeCache(irFactory);
    JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
        builderType.useOneCFA());
    if(builderType.extractCorrelatedPairs())
      builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));

    return builder;
  } catch (ClassHierarchyException e) {
    return null;
  }
}
 
开发者ID:ylimit,项目名称:HybridFlow,代码行数:19,代码来源:JSCallGraphBuilderUtil.java


示例4: makeAnalysisOptions

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
 * Note that the resulting `AnalysisOptions` object does not have any entrypoints.
 * 
 * @param cha
 * @param scope
 * @return
 */
public static AnalysisOptions makeAnalysisOptions(IClassHierarchy cha)
{
    AnalysisScope scope = cha.getScope();
    AnalysisOptions options = new AnalysisOptions(scope, null);

    ClassLoader classLoader = WalaUtil.class.getClassLoader();
    InputStream nativesSpec = classLoader.getResourceAsStream(NATIVE_SPEC_RESOURCE_NAME);
    XMLMethodSummaryReader nativeSpecSummary = new XMLMethodSummaryReader(nativesSpec, scope);

    // Add default selectors then custom ones. The defaults will serve as the parents of the
    // custom children. The children delegate to their parents when they do not definitively
    // target a class/method.
    Util.addDefaultSelectors(options, cha);
    setToSynthesizeNativeMethods(cha, options, nativeSpecSummary);
    setToSynthesizeNativeClasses(cha, options, nativeSpecSummary);

    return options;
}
 
开发者ID:paninij,项目名称:paninij,代码行数:26,代码来源:WalaUtil.java


示例5: createECJJavaEngine

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
public static JavaSourceAnalysisEngine
createECJJavaEngine(Collection<String> sources, List<String> libs, final String [] entryPoints)  {
    JavaSourceAnalysisEngine engine=null;
    if(null == entryPoints) {
        engine = new ECJJavaSourceAnalysisEngine();
    } else {
        engine = new ECJJavaSourceAnalysisEngine() {
            @Override
            protected Iterable<Entrypoint> makeDefaultEntrypoints(AnalysisScope scope, IClassHierarchy cha) {
                return Util.makeMainEntrypoints(JavaSourceAnalysisScope.SOURCE,cha, entryPoints);
            }
        };
    }
    engine.setExclusionsFile(REGRESSION_EXCLUSIONS);
    populateScope(engine, sources, libs);
    return engine;
}
 
开发者ID:logicalhacking,项目名称:DASCA,代码行数:18,代码来源:PlugInUtil.java


示例6: makeCG

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders,
                                     AnalysisScope scope, CGBuilderType builderType,
                                     IRFactory<IMethod> irFactory) throws IOException, WalaException {
    try {
        IClassHierarchy cha = makeHierarchy(scope, loaders);
        com.ibm.wala.cast.util.Util.checkForFrontEndErrors(cha);
        Iterable<Entrypoint> roots = makeScriptRoots(cha);
        JSAnalysisOptions options = makeOptions(scope, cha, roots);
        options.setHandleCallApply(builderType.handleCallApply());
        IAnalysisCacheView cache = makeCache(irFactory);
        JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options,
                cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
                builderType.useOneCFA());
        
        if (builderType.extractCorrelatedPairs())
            builder.setContextSelector(new PropertyNameContextSelector(
                                           builder.getAnalysisCache(), 2, builder
                                           .getContextSelector()));

        return builder;
    } catch (ClassHierarchyException e) {
        // Assert.assertTrue("internal error building class hierarchy",
        // false);
        return null;
    }
}
 
开发者ID:logicalhacking,项目名称:DASCA,代码行数:27,代码来源:ImprovedJSCallGraphBuilderUtil.java


示例7: makeCG

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, CGBuilderType builderType, IRFactory<IMethod> irFactory) throws IOException, WalaException {
  try {
    IClassHierarchy cha = makeHierarchy(scope, loaders);
    com.ibm.wala.cast.js.util.Util.checkForFrontEndErrors(cha);
    Iterable<Entrypoint> roots = makeScriptRoots(cha);
    JSAnalysisOptions options = makeOptions(scope, cha, roots);
    options.setHandleCallApply(builderType.handleCallApply());
    AnalysisCache cache = makeCache(irFactory);
    JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS,
        builderType.useOneCFA());
    if(builderType.extractCorrelatedPairs())
      builder.setContextSelector(new PropertyNameContextSelector(builder.getAnalysisCache(), 2, builder.getContextSelector()));

    return builder;
  } catch (ClassHierarchyException e) {
    Assert.assertTrue("internal error building class hierarchy", false);
    return null;
  }
}
 
开发者ID:blackoutjack,项目名称:jamweaver,代码行数:20,代码来源:JSCallGraphBuilderUtil.java


示例8: main

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
   * Usage: ScopeFileCallGraph -scopeFile file_path [-entryClass class_name |
   * -mainClass class_name]
   * 
   * If given -mainClass, uses main() method of class_name as entrypoint. If
   * given -entryClass, uses all public methods of class_name.
   * 
   * @throws IOException
   * @throws ClassHierarchyException
   * @throws CallGraphBuilderCancelException
   * @throws IllegalArgumentException
   */
  public static void main(String[] args) throws IOException, ClassHierarchyException, IllegalArgumentException,
      CallGraphBuilderCancelException {
    long start = System.currentTimeMillis();
    Properties p = CommandLine.parse(args);
    String scopeFile = p.getProperty("scopeFile");
    String entryClass = p.getProperty("entryClass");
    String mainClass = p.getProperty("mainClass");
    if (mainClass != null && entryClass != null) {
      throw new IllegalArgumentException("only specify one of mainClass or entryClass");
    }
    AnalysisScope scope = AnalysisScopeReader.readJavaScope(scopeFile, null, ScopeFileCallGraph.class.getClassLoader());
    // set exclusions.  we use these exclusions as standard for handling JDK 8
    ExampleUtil.addDefaultExclusions(scope);
    IClassHierarchy cha = ClassHierarchyFactory.make(scope);
    System.out.println(cha.getNumberOfClasses() + " classes");
    System.out.println(Warnings.asString());
    Warnings.clear();
    AnalysisOptions options = new AnalysisOptions();
    Iterable<Entrypoint> entrypoints = entryClass != null ? makePublicEntrypoints(scope, cha, entryClass) : Util.makeMainEntrypoints(scope, cha, mainClass);
    options.setEntrypoints(entrypoints);
    // you can dial down reflection handling if you like
//    options.setReflectionOptions(ReflectionOptions.NONE);
    AnalysisCache cache = new AnalysisCacheImpl();
    // other builders can be constructed with different Util methods
    CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
//    CallGraphBuilder builder = Util.makeNCFABuilder(2, options, cache, cha, scope);
//    CallGraphBuilder builder = Util.makeVanillaNCFABuilder(2, options, cache, cha, scope);
    System.out.println("building call graph...");
    CallGraph cg = builder.makeCallGraph(options, null);
    long end = System.currentTimeMillis();
    System.out.println("done");
    System.out.println("took " + (end-start) + "ms");
    System.out.println(CallGraphStats.getStats(cg));
  }
 
开发者ID:wala,项目名称:WALA-start,代码行数:47,代码来源:ScopeFileCallGraph.java


示例9: makePublicEntrypoints

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
private static Iterable<Entrypoint> makePublicEntrypoints(AnalysisScope scope, IClassHierarchy cha, String entryClass) {
  Collection<Entrypoint> result = new ArrayList<Entrypoint>();
  IClass klass = cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,
      StringStuff.deployment2CanonicalTypeString(entryClass)));
  for (IMethod m : klass.getDeclaredMethods()) {
    if (m.isPublic()) {
      result.add(new DefaultEntrypoint(m, cha));
    }
  }
  return result;
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:12,代码来源:ScopeFileCallGraph.java


示例10: run

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
public static Process run(String[] args) throws IOException {
  try {
    validateCommandLine(args);
    String classpath = args[CLASSPATH_INDEX];
    AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, null);
    ExampleUtil.addDefaultExclusions(scope);

    // invoke WALA to build a class hierarchy
    ClassHierarchy cha = ClassHierarchyFactory.make(scope);

    Graph<IClass> g = typeHierarchy2Graph(cha);

    g = pruneForAppLoader(g);
    //String dotFile = "/tmp" + File.separatorChar + DOT_FILE;
    String dotFile = File.createTempFile("out", ".dt").getAbsolutePath();
    String pdfFile = File.createTempFile("out", ".pdf").getAbsolutePath();
    String dotExe = "dot";
    String gvExe = "open";
    DotUtil.dotify(g, null, dotFile, pdfFile, dotExe);
    return PDFViewUtil.launchPDFView(pdfFile, gvExe);

  } catch (WalaException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return null;
  }
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:28,代码来源:PDFTypeHierarchy.java


示例11: makeScriptCGBuilder

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
 * create a CG builder for script.  Note that the script at dir/name is loaded via the classloader, not from the filesystem.
 */
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, CGBuilderType builderType, ClassLoader loader) throws IOException, WalaException {
  URL script = getURLforFile(dir, name, loader);
  CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, script) : null;
  JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(preprocessor);

  AnalysisScope scope = makeScriptScope(dir, name, loaders, loader);

  return makeCG(loaders, scope, builderType, AstIRFactory.makeDefaultFactory());
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:13,代码来源:JSCallGraphBuilderUtil.java


示例12: removeErrorModules

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
private SourceModule[] removeErrorModules(SourceModule[] scriptsArray, JavaScriptLoaderFactory loaders)
        throws IOException, ClassHierarchyException {
    AnalysisScope scope = CAstCallGraphUtil.makeScope(scriptsArray, loaders, JavaScriptLoader.JS);
    IClassHierarchy cha = ClassHierarchy.make(scope, loaders, JavaScriptLoader.JS);
    Set<ModuleEntry> errorModules = new HashSet<>();
    for (IClassLoader loader : cha.getLoaders()) {
        if(loader instanceof CAstAbstractLoader) {
            Iterator errors = ((CAstAbstractLoader)loader).getModulesWithParseErrors();

            while(errors.hasNext()) {
                ModuleEntry errorModule = (ModuleEntry)errors.next();
                errorModules.add(errorModule);
            }

            ((CAstAbstractLoader)loader).clearMessages();
        }
    }

    Set<SourceModule> newSourceModules = new HashSet<>();
    for (SourceModule sourceModule : scriptsArray) {
        boolean isErrorModule = false;
        Iterator<? extends ModuleEntry> moduleEntries = sourceModule.getEntries();
        while (moduleEntries.hasNext()) {
            ModuleEntry moduleEntry = moduleEntries.next();
            if (errorModules.contains(moduleEntry)) {
                isErrorModule = true;
                break;
            }
        }
        if (isErrorModule) {
            continue;
        }
        newSourceModules.add(sourceModule);
    }
    return newSourceModules.toArray(new SourceModule[newSourceModules.size()]);
}
 
开发者ID:ylimit,项目名称:HybridFlow,代码行数:37,代码来源:WebManager.java


示例13: loadCoreClass

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
   * @param cha
   * @param coreName The name of the core to be analyzed. Should be something of the form
   *                 `-Lorg/paninij/soter/FooCore`.
   */
  public static IClass loadCoreClass(String coreName, IClassHierarchy cha)
  {
      AnalysisScope scope = cha.getScope();
      ClassLoaderReference appLoaderRef = scope.getApplicationLoader();
TypeReference typeRef = TypeReference.findOrCreate(appLoaderRef, coreName);

      IClass coreClass = cha.lookupClass(typeRef);
      if (coreClass == null)
      {
          String msg = "Failed to load a core's `IClass`: " + coreName;
          throw new IllegalArgumentException(msg);
      }
      return coreClass;
  }
 
开发者ID:paninij,项目名称:paninij,代码行数:20,代码来源:WalaUtil.java


示例14: makeScriptCGBuilder

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
 * create a CG builder for script. Note that the script at dir/name is
 * loaded via the classloader, not from the filesystem.
 */
public static JSCFABuilder makeScriptCGBuilder(String dir, String name,
        CGBuilderType builderType) throws IOException, WalaException {
    URL script = getURLforFile(dir, name);
    CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs
                                       ? new CorrelatedPairExtractorFactory(translatorFactory, script)
                                       : null;
    JavaScriptLoaderFactory loaders = JSCallGraphUtil
                                      .makeLoaders(preprocessor);

    AnalysisScope scope = makeScriptScope(script, dir, name, loaders);

    return makeCG(loaders, scope, builderType,
                  AstIRFactory.makeDefaultFactory());
}
 
开发者ID:logicalhacking,项目名称:DASCA,代码行数:19,代码来源:ImprovedJSCallGraphBuilderUtil.java


示例15: makeScriptScope

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
static AnalysisScope makeScriptScope(URL script, String dir, String name,
                                     JavaScriptLoaderFactory loaders) throws IOException {
    return makeScope(new SourceModule[] {
                         (script.openConnection() instanceof JarURLConnection)
                         ? new SourceURLModule(script)
                         : makeSourceModule(script, dir, name),
                         getPrologueFile("prologue.js")
                     }, loaders, JavaScriptLoader.JS);

}
 
开发者ID:logicalhacking,项目名称:DASCA,代码行数:11,代码来源:ImprovedJSCallGraphBuilderUtil.java


示例16: makeScriptCGBuilder

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
 * create a CG builder for script.  Note that the script at dir/name is loaded via the classloader, not from the filesystem.
 */
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, CGBuilderType builderType) throws IOException, WalaException {
  URL script = getURLforFile(dir, name);
  CAstRewriterFactory preprocessor = builderType.extractCorrelatedPairs ? new CorrelatedPairExtractorFactory(translatorFactory, script) : null;
  JavaScriptLoaderFactory loaders = JSCallGraphUtil.makeLoaders(preprocessor);

  AnalysisScope scope = makeScriptScope(script, dir, name, loaders);

  return makeCG(loaders, scope, builderType, AstIRFactory.makeDefaultFactory());
}
 
开发者ID:blackoutjack,项目名称:jamweaver,代码行数:13,代码来源:JSCallGraphBuilderUtil.java


示例17: makeScriptScope

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
static AnalysisScope makeScriptScope(URL script, String dir, String name, JavaScriptLoaderFactory loaders) throws IOException {
  return makeScope(
      new SourceModule[] { 
          (script.openConnection() instanceof JarURLConnection)? new SourceURLModule(script): makeSourceModule(script, dir, name), 
          getPrologueFile("prologue.js")
      }, loaders, JavaScriptLoader.JS);
  
}
 
开发者ID:blackoutjack,项目名称:jamweaver,代码行数:9,代码来源:JSCallGraphBuilderUtil.java


示例18: extractFingerPrints

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
public void extractFingerPrints() throws IOException, ClassHierarchyException, ClassNotFoundException {
	long starttime = System.currentTimeMillis();
	
	logger.info("Process library: " + libraryFile.getName());
	logger.info("Library description:");
	for (String desc: libDesc.getDescription())
		logger.info(desc);
	
	// create analysis scope and generate class hierarchy
	final AnalysisScope scope = AnalysisScope.createJavaAnalysisScope();
	
	JarFile jf = libraryFile.getName().endsWith(".aar")? new AarFile(libraryFile).getJarFile() : new JarFile(libraryFile); 
	scope.addToScope(ClassLoaderReference.Application, jf);
	scope.addToScope(ClassLoaderReference.Primordial, new JarFile(CliOptions.pathToAndroidJar));

	IClassHierarchy cha = ClassHierarchy.make(scope);
	getChaStats(cha);
	
	// cleanup tmp files if library input was an .aar file
	if (libraryFile.getName().endsWith(".aar")) {
		File tmpJar = new File(jf.getName());
		tmpJar.delete();
		logger.debug(Utils.indent() + "tmp jar-file deleted at " + tmpJar.getName());
	}
	
	PackageTree pTree = Profile.generatePackageTree(cha);
	if (pTree.getRootPackage() == null) {
		logger.warn(Utils.INDENT + "Library contains multiple root packages");
	}

	List<HashTree> hTrees = Profile.generateHashTrees(cha);

	// if hash tree is empty do not dump a profile
	if (hTrees.isEmpty() || hTrees.get(0).getNumberOfClasses() == 0) {
		logger.error("Empty Hash Tree generated - SKIP");
		return;
	}		
		
	// serialize lib profiles to disk (<profilesDir>/<lib-category>/libName_libVersion.lib)
	logger.info("");
	File targetDir = new File(CliOptions.profilesDir + File.separator + libDesc.category.toString());
	logger.info("Serialize library fingerprint to disk (dir: " + targetDir + ")");
	String proFileName = libDesc.name.replaceAll(" ", "-") + "_" + libDesc.version + "." + FILE_EXT_LIB_PROFILE;
	LibProfile lp = new LibProfile(libDesc, pTree, hTrees);
	
	Utils.object2Disk(new File(targetDir + File.separator + proFileName), lp);
	
	logger.info("");
	logger.info("Processing time: " + Utils.millisecondsToFormattedTime(System.currentTimeMillis() - starttime));
}
 
开发者ID:reddr,项目名称:LibScout,代码行数:51,代码来源:LibraryProfiler.java


示例19: main

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
/**
	   * Usage: CSReachingDefsDriver -scopeFile file_path -mainClass class_name
	   * 
	   * Uses main() method of class_name as entrypoint.
	   * 
	   * @throws IOException
	   * @throws ClassHierarchyException
	   * @throws CallGraphBuilderCancelException
	   * @throws IllegalArgumentException
	   */
	  public static void main(String[] args) throws IOException, ClassHierarchyException, IllegalArgumentException, CallGraphBuilderCancelException {
	    long start = System.currentTimeMillis();		
	    Properties p = CommandLine.parse(args);
	    String scopeFile = p.getProperty("scopeFile");
	    if (scopeFile == null) {
	    	throw new IllegalArgumentException("must specify scope file");
	    }
	    String mainClass = p.getProperty("mainClass");
	    if (mainClass == null) {
	      throw new IllegalArgumentException("must specify main class");
	    }
	    AnalysisScope scope = AnalysisScopeReader.readJavaScope(scopeFile, null, CSReachingDefsDriver.class.getClassLoader());
	    ExampleUtil.addDefaultExclusions(scope);
	    IClassHierarchy cha = ClassHierarchyFactory.make(scope);
	    System.out.println(cha.getNumberOfClasses() + " classes");
	    System.out.println(Warnings.asString());
	    Warnings.clear();
	    AnalysisOptions options = new AnalysisOptions();
	    Iterable<Entrypoint> entrypoints = Util.makeMainEntrypoints(scope, cha, mainClass);
	    options.setEntrypoints(entrypoints);
	    // you can dial down reflection handling if you like
	    options.setReflectionOptions(ReflectionOptions.NONE);
	    AnalysisCache cache = new AnalysisCacheImpl();
	    // other builders can be constructed with different Util methods
	    CallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
//	    CallGraphBuilder builder = Util.makeNCFABuilder(2, options, cache, cha, scope);
//	    CallGraphBuilder builder = Util.makeVanillaNCFABuilder(2, options, cache, cha, scope);
	    System.out.println("building call graph...");
	    CallGraph cg = builder.makeCallGraph(options, null);
//	    System.out.println(cg);
	    long end = System.currentTimeMillis();
	    System.out.println("done");
	    System.out.println("took " + (end-start) + "ms");
	    System.out.println(CallGraphStats.getStats(cg));
	    
	    ContextSensitiveReachingDefs reachingDefs = new ContextSensitiveReachingDefs(cg, cache);
	    TabulationResult<BasicBlockInContext<IExplodedBasicBlock>, CGNode, Pair<CGNode, Integer>> result = reachingDefs.analyze();
	    ISupergraph<BasicBlockInContext<IExplodedBasicBlock>, CGNode> supergraph = reachingDefs.getSupergraph();

	    // TODO print out some analysis results
	}
 
开发者ID:wala,项目名称:WALA-start,代码行数:52,代码来源:CSReachingDefsDriver.java


示例20: makeScriptScope

import com.ibm.wala.ipa.callgraph.AnalysisScope; //导入依赖的package包/类
public static AnalysisScope makeScriptScope(String dir, String name, JavaScriptLoaderFactory loaders, ClassLoader loader) throws IOException {
  return makeScope(makeSourceModules(dir, name, loader), loaders, JavaScriptLoader.JS);    
}
 
开发者ID:wala,项目名称:WALA-start,代码行数:4,代码来源:JSCallGraphBuilderUtil.java



注:本文中的com.ibm.wala.ipa.callgraph.AnalysisScope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TestElementProperty类代码示例发布时间:2022-05-23
下一篇:
Java ResourceResolver类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap