-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to retrieve all classes of JarFile given in --classpath option #127
Comments
You need to put the target jars in If you edit your config as below,
The output will be
Also note you'd better use public static void main(String[] args) {
Main.buildWorld("--options-file","src/main/resources/options.yml");
JClass iClass = World.get().getClassHierarchy().getClass("jakarta.servlet.http.HttpServletRequest");
World.get().getClassHierarchy().getDirectImplementorsOf(iClass).forEach(System.out::println);
World.get().getClassHierarchy().getAllSubclassesOf(iClass).forEach(System.out::println);
World.get().getClassHierarchy().getDirectSubinterfacesOf(iClass).forEach(System.out::println);
} |
@ayanamists Thanks for you reply! one more question, if classes of jars which are put in
|
@springtime Here's a simple explanation of what `classPath` means:
`classPath` is similar to the JVM startup parameter, `-cp`.
Classpath is a parameter in the Java Virtual Machine or the Java compiler that
specifies the location of user-defined classes and packages. The parameter may
be set either on the command line, or through an environment variable.
Similar to the behavior of the JVM, when you specify `classPath`, Tai-e will
only use them as *lookup* paths and will not load all of them into the `World`.
The classes that are loaded into the `World` must satisfy one of the following
conditions:
1. They are specified by `--main-class` or `--input-classes`.
2. They belong to the classpath specified by `--app-class-path`.
3. They are referenced by another class that is loaded into the `World`.
Refer to the [Tai-e documentation](https://tai-e.pascal-lab.net/docs/current/reference/en/command-line-options.html#program-options)
for more details.
…On 08/11/2024 05:44, springtime wrote:
@ayanamists Thanks for you reply! one more question, if classes of **jars which are put in `classPath` option** cannot be fully loaded by Tai-e, what is the meaning of this option?
> You need to put the target jars in `appClassPath` instead of `classPath` if you want Tai-e to load every class in your jars.
>
> If you edit your config as below,
>
> ```
> optionsFile: null
> printHelp: false
> classPath: []
> appClassPath: [bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-annotations-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-core-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-databind-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-datatype-jdk8-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-datatype-jsr310-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jackson-module-parameter-names-2.17.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jakarta.annotation-api-2.1.1.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\jul-to-slf4j-2.0.16.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\log4j-api-2.23.1.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\log4j-to-slf4j-2.23.1.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\logback-classic-1.5.11.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\logback-core-1.5.11.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\micrometer-commons-1.13.6.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\micrometer-observation-1.13.6.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\slf4j-api-2.0.16.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\snakeyaml-2.2.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-aop-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-beans-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-boot-3.3.5.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-boot-autoconfigure-3.3.5.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-boot-jarmode-tools-3.3.5.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-context-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-core-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-expression-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-jcl-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-web-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\spring-webmvc-6.1.14.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\tomcat-embed-core-10.1.31.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\tomcat-embed-el-10.1.31.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\lib\tomcat-embed-websocket-10.1.31.jar;bench-0.0.1-SNAPSHOT\BOOT-INF\classes;]
> mainClass:
> inputClasses: []
> javaVersion: 8
> prependJVM: false
> allowPhantom: true
> worldBuilderClass: pascal.taie.frontend.soot.SootWorldBuilder
> outputDir: output
> preBuildIR: false
> worldCacheMode: false
> scope: ALL
> nativeModel: true
> planFile: null
> analyses:
> ir-dumper: ""
> onlyGenPlan: false
> keepResult:
> - $KEEP-ALL
> ```
>
> The output will be
>
> ```
> WorldBuilder finishes, elapsed time: 35.47s
> org.apache.catalina.connector.Request
> org.apache.catalina.connector.RequestFacade
> jakarta.servlet.http.HttpServletRequestWrapper
> jakarta.servlet.http.HttpServletRequest
> org.apache.catalina.connector.Request
> org.apache.catalina.connector.RequestFacade
> jakarta.servlet.http.HttpServletRequestWrapper
> org.apache.catalina.core.ApplicationHttpRequest
> org.springframework.web.context.support.ContextExposingHttpServletRequest
> org.springframework.web.multipart.MultipartHttpServletRequest
> org.springframework.web.filter.FormContentFilter$FormContentRequestWrapper
> org.springframework.web.filter.HiddenHttpMethodFilter$HttpMethodRequestWrapper
> org.springframework.web.servlet.handler.HandlerMappingIntrospector$AttributesPreservingRequest
> org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest
> org.springframework.web.multipart.support.StandardMultipartHttpServletRequest
> org.springframework.web.servlet.resource.ResourceUrlEncodingFilter$ResourceUrlEncodingRequestWrapper
> org.springframework.web.filter.ForwardedHeaderFilter$ForwardedHeaderRemovingRequest
> org.springframework.web.filter.ForwardedHeaderFilter$ErrorPathRequest
> org.springframework.web.filter.ForwardedHeaderFilter$ForwardedHeaderExtractingRequest
> org.springframework.web.util.ContentCachingRequestWrapper
> org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest
> org.apache.catalina.filters.RemoteIpFilter$XForwardedRequest
> org.springframework.web.multipart.MultipartHttpServletRequest
> ```
>
> Also note you'd better use `Main.buildWorld` instead of `Main.main`, because the old Soot frontend will be extremly slow dues to the ir-dumper.
>
> ```java
> public static void main(String[] args) {
> Main.buildWorld("--options-file","src/main/resources/options.yml");
> JClass iClass = World.get().getClassHierarchy().getClass("jakarta.servlet.http.HttpServletRequest");
> World.get().getClassHierarchy().getDirectImplementorsOf(iClass).forEach(System.out::println);
> World.get().getClassHierarchy().getAllSubclassesOf(iClass).forEach(System.out::println);
> World.get().getClassHierarchy().getDirectSubinterfacesOf(iClass).forEach(System.out::println);
> }
> ```
|
understood, appreciate your help. |
📝 Overall Description
I'm looking for an implementation class for the interface
jakarta.servlet.http.HttpServletRequest
(located intomcat-embed-core-10.1.31.jar
), which should be implemented by many third-party dependencies, for examplejakarta.servlet.http.HttpServletRequestWrapper
(attomcat-embed-core-10.1.31.jar
)org.apache.catalina.connector.RequestFacade
(attomcat-embed-core:10.1.31.jar
)I have specified the path of the relevant jar to the --classpath option, but Tai-e doesn't seem to read these classes into the
World
, after debugging, I found that the front-end soot also does not read these classes into theScene
, is this a bug generated by soot as a front-end, or is it a bug of tai-e itself?🎯 Expected Behavior
Obtain the implementation class of
HttpServletRequest
, such as the JClass instance ofHttpServletRequestWrapper
.🐛 Current Behavior
Unable to obtain the implementation class of
HttpServletRequest
, such as the JClass instance ofHttpServletRequestWrapper
. And after dumping all the IRs, they can't be found in the TIR file either.🔄 Reproducible Example
I use the following driver to start the analysis
The analysis target is available from the link: bench-0.0.1-SNAPSHOT.zip
⚙️ Tai-e Arguments
🔍 Click here to see Tai-e Options
🔍 Click here to see Tai-e Analysis Plan
📜 Tai-e Log
🔍 Click here to see Tai-e Log
ℹ️ Additional Information
No response
The text was updated successfully, but these errors were encountered: