java - WALA :“Could not create a entrypoint callsites:” 问题

标签 java slicers

我正在使用WALA进行静态分析,但遇到了一些问题。当我构建调用图时,某些 jar 存在以下问题:

Exception in thread "main" java.lang.IllegalStateException: Could not create a entrypoint callsites:

  1. [Moderate] class com.ibm.wala.ipa.cha.ClassHierarchy$ClassExclusion : No superclass found for Superclass name Lorg/eclipse/swt/dnd/ByteArrayTransfer

  2. [Moderate] class com.ibm.wala.ipa.cha.ClassHierarchy$ClassExclusion : No superclass found for Superclass name Lorg/eclipse/swt/widgets/Canvas

  3. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Lorg/eclipse/swt/dnd/DragSourceListener

  4. [SEVERE] class com.ibm.wala.classLoader.BytecodeClass$ClassNotFoundWarning : Lorg/eclipse/swt/dnd/DropTargetListener

com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder.makeCallGraph(PropagationCallGraphBuilder.java:263)

wala 似乎无法获取 eclipse.swt 包的 .class 文件,因此我无法构建调用图来进行切片。 您遇到过这样的问题吗?这个问题兄弟我很久了。 问题Jar是这样的:http://mirror.bit.edu.cn/apache/commons/io/binaries/

WALA版本是1.4.3。 我的代码是:

AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(jarPath, exFile);
ClassHierarchy cha = ClassHierarchyFactory.make(scope);

Iterable entrypoints = Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);// the problem line
options.setReflectionOptions(ReflectionOptions.NONE);

那么,我该如何处理这个问题。非常非常感谢。

最佳答案

我想知道你的jarPath包含什么代码。因为我发现您的入口点是通过 makeMainEntrypoints 方法创建的,所以该方法要求您正在分析的二进制文件的源代码必须包含 main 方法。

如果它不包含main方法,您可以使用AllApplicationEntrypoints类来构建入口点,如下所示:

Iterable<Entrypoint> entrypoints = new AllApplicationEntrypoints(scope, cha);

关于java - WALA :“Could not create a entrypoint callsites:” 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56003762/

相关文章:

java - 使用具有相对路径的 JasperReports

java - 读取 jar 文件中的数据(Java 中)并对文件进行计数

java - 无法反射(reflect)。异常 java.lang.IllegalArgumentException : object is not an instance of declaring class

java - 变量不工作android

java - JPA:如何在不加载延迟加载集的情况下计算子记录

excel - VBA 连接切片器(寻找代码改进)

excel - 切片器正在更改我的数据透视表的行高?

excel - 计算切片器中选择的元素

go - 合并排序计数器 slice