本文整理汇总了Java中com.ibm.wala.ipa.callgraph.AnalysisOptions类的典型用法代码示例。如果您正苦于以下问题:Java AnalysisOptions类的具体用法?Java AnalysisOptions怎么用?Java AnalysisOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnalysisOptions类属于com.ibm.wala.ipa.callgraph包,在下文中一共展示了AnalysisOptions类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeAnalysisOptions
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的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
示例2: TargetApplication
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public TargetApplication(String jarName, String exclusionFileName)
throws IOException, ClassHierarchyException {
LOG.info("creating analysis scope for {}", jarName);
File exclusionFile = null;
if (exclusionFileName != null) {
LOG.info("using exclusion file {}", exclusionFileName);
exclusionFile = new File(exclusionFileName);
}
scope = AnalysisScopeFactory.createJavaAnalysisScope(jarName,
exclusionFile);
LOG.info("building class hierarchy...", jarName);
classHierarchy = ClassHierarchy.make(scope);
cache = new AnalysisCache();
options = new AnalysisOptions();
}
开发者ID:wondee,项目名称:faststring,代码行数:22,代码来源:TargetApplication.java
示例3: main
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的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
示例4: setToSynthesizeNativeMethods
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
/**
* TODO: Is this method name an accurate description of what this bypass logic is doing?
*/
private static void setToSynthesizeNativeMethods(IClassHierarchy cha,
AnalysisOptions options,
XMLMethodSummaryReader natives)
{
MethodTargetSelector parent = options.getMethodTargetSelector();
MethodTargetSelector child = new BypassMethodTargetSelector(parent,
natives.getSummaries(),
natives.getIgnoredPackages(),
cha);
options.setSelector(child);
}
开发者ID:paninij,项目名称:paninij,代码行数:15,代码来源:WalaUtil.java
示例5: setToSynthesizeNativeClasses
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
/**
* TODO: Is this method name an accurate description of what this bypass logic is doing?
*/
private static void setToSynthesizeNativeClasses(IClassHierarchy cha,
AnalysisOptions options,
XMLMethodSummaryReader natives)
{
IClassLoader loader = cha.getLoader(cha.getScope().getSyntheticLoader());
Set<TypeReference> allocatable = natives.getAllocatableClasses();
ClassTargetSelector parent = options.getClassTargetSelector();
ClassTargetSelector child = new BypassClassTargetSelector(parent, allocatable, cha, loader);
options.setSelector(child);
}
开发者ID:paninij,项目名称:paninij,代码行数:15,代码来源:WalaUtil.java
示例6: CallGraphAnalysis
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public CallGraphAnalysis(CapsuleCore core, IClassHierarchy cha, AnalysisOptions options,
AnalysisCache cache)
{
this.core = core;
this.cha = cha;
this.options = options;
this.cache = cache;
}
开发者ID:paninij,项目名称:paninij,代码行数:9,代码来源:CallGraphAnalysis.java
示例7: main
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的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
示例8: getCallGraphBuilder
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
@Override
protected CallGraphBuilder getCallGraphBuilder(
IClassHierarchy cha, AnalysisOptions options, IAnalysisCacheView cache) {
return Util.makeZeroCFABuilder(options, cache, cha, scope);
}
开发者ID:wala,项目名称:WALA-start,代码行数:6,代码来源:SimpleThreadEscapeAnalysis.java
示例9: CallGraphAnalysisFactory
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public CallGraphAnalysisFactory(IClassHierarchy cha, AnalysisOptions options)
{
this.cha = cha;
this.options = options;
}
开发者ID:paninij,项目名称:paninij,代码行数:6,代码来源:CallGraphAnalysisFactory.java
示例10: getCallGraph
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
/**
* Gets callgraph for given parameters (binary analysis only)
* @param exclusionFilePath
* @param classPath
* @param entryClass
* @param entryMethod
* @return
*/
public static CallGraph getCallGraph(String exclusionFilePath, String classPath, String entryClass, String entryMethod) {
AnalysisScope scope = null;
ClassHierarchy cha = null;
HashSet<Entrypoint> entryPoints = null;
try {
File exclusionFile = new File(exclusionFilePath);
scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classPath, exclusionFile); // works with class and jar files
cha = ClassHierarchyFactory.make(scope);
ClassLoaderReference clr = scope.getApplicationLoader();
entryPoints = HashSetFactory.make();
for(IClass class1 : cha) {
if(class1.getClassLoader().getReference().equals(clr)) {
Collection<IMethod> allMethods = class1.getDeclaredMethods();
for(IMethod m : allMethods) {
if(m.isPrivate()) {
continue;
}
TypeName tn = m.getDeclaringClass().getName();//MainApplication
if(tn.toString().contains("/" + entryClass) && m.getName().toString().contains(entryMethod)) { // TODO: too weak
entryPoints.add(new DefaultEntrypoint(m, cha));
}
}
}
}
// Iterable<Entrypoint> result1 = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha); // uses the static main methods as entry methods
if(entryPoints.size() == 0) {
log.error("Could not find specified entry point for analysis.\n" +
" path: " + classPath + "\n" +
" class: " + entryClass + "\n" +
" method: " + entryMethod);
System.exit(1);
}
AnalysisOptions options = new AnalysisOptions(scope, entryPoints);
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeRTABuilder(options, new AnalysisCacheImpl(), cha, scope); // Rapid Type Analysis
SSAPropagationCallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-CFA = context-insensitive, class-based heap
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-1-CFA = context-insensitive, allocation-site-based heap
// CallGraphBuilder builder = com.ibm.wala.ipa.callgraph.impl.Util.makeZeroOneContainerCFABuilder(options, new AnalysisCacheImpl(), cha, scope); // 0-1-Container-CFA = object-sensitive container
return builder.makeCallGraph(options);
} catch (Exception e) {
log.error("Error while building the call graph");
e.printStackTrace();
System.exit(1);
return null;
}
}
开发者ID:logicalhacking,项目名称:DASCA,代码行数:57,代码来源:AnalysisUtil.java
示例11: buildCallGraph
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public CallGraphBuilder buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, IProgressMonitor monitor) throws com.ibm.wala.util.CancelException {
return super.buildCallGraph(cha, options, savePointerAnalysis, monitor);
}
开发者ID:wala,项目名称:MemSAT,代码行数:4,代码来源:MiniaturECJJavaAnalysisEngine.java
示例12: getOptions
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public AnalysisOptions getOptions() {
return options;
}
开发者ID:wala,项目名称:MemSAT,代码行数:4,代码来源:CallGraphCreation.java
示例13: buildCallGraph
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public CallGraphBuilder buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, IProgressMonitor monitor) throws com.ibm.wala.util.CancelException {
return super.buildCallGraph(cha, options, savePointerAnalysis, monitor);
}
开发者ID:wala,项目名称:MemSAT,代码行数:4,代码来源:MiniaturJavaScriptAnalysisEngine.java
示例14: analysisOptions
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
public AnalysisOptions analysisOptions() {
return analysisOptions;
}
开发者ID:wala,项目名称:MemSAT,代码行数:4,代码来源:WalaInformationImpl.java
示例15: performStandardAnalysis
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
/**
* A helper method for making a call graph analysis and performing the build in the default way.
* This is useful for building a single call for a core. However, if call graphs for
* multiple cores are needed, it is recommended (for performance reasons) separate
* `CallGraphAnalyses` and to call perform on each with resources shared across all of the
* call graph analyses (e.g. the class * hierarchy analysis).
*
* @param coreName The name of the core to be analyzed. Should be something of the form
* `-Lorg/paninij/soter/FooCore`.
* @param classPath A colon-separated list of file system locations in which WALA should
* look for application classes.
*/
public static CallGraphAnalysis performStandardAnalysis(String coreName, String classPath)
{
IClassHierarchy cha = WalaUtil.makeClassHierarchy(classPath);
AnalysisOptions options = WalaUtil.makeAnalysisOptions(cha);
IClass coreClass = WalaUtil.loadCoreClass(coreName, cha);
CapsuleCore core = new CapsuleCore(coreClass);
CallGraphAnalysis cga = new CallGraphAnalysis(core, cha, options);
cga.perform();
return cga;
}
开发者ID:paninij,项目名称:paninij,代码行数:24,代码来源:CallGraphAnalysisFactory.java
示例16: analysisOptions
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
/**
* Returns the analysis options used for constructing the sliced call graph.
* @return analysis options used for constructing the sliced call graph.
*/
public abstract AnalysisOptions analysisOptions();
开发者ID:wala,项目名称:MemSAT,代码行数:6,代码来源:WalaInformation.java
示例17: buildCallGraph
import com.ibm.wala.ipa.callgraph.AnalysisOptions; //导入依赖的package包/类
CallGraphBuilder buildCallGraph(IClassHierarchy cha, AnalysisOptions options, boolean savePointerAnalysis, IProgressMonitor monitor) throws com.ibm.wala.util.CancelException;
开发者ID:wala,项目名称:MemSAT,代码行数:2,代码来源:MiniaturAnalysisEngine.java
注:本文中的com.ibm.wala.ipa.callgraph.AnalysisOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论