Analysis Input
i.e. What should be analyzed. An AnalysisInputLocation
points to code input SootUp can analyze.
We ship multiple Implementations that can handle different input.
Additionally you can specify a SourceType. This determines what is considered e.g. in the CallGraphs generation. Further you can specify a List of BodyInterceptors, which will optimize the raw Jimple IR that was transformed from the input.
Java Runtime
Java <=8
The DefaultRTJaAnalysisInputLocation
points to the rt.jar of the executing JVM.
1 2 |
|
To include a different Java Runtime library point to any rt.jar via a JavaClassPathAnalysisInputLocation
as its a usual .jar file.
Java >=9
The JRTFilesystemAnalysisInputLocation
points to the jigsawed java runtime of the executing JVM.
1 2 |
|
If you have errors like Java.lang.String, Java.lang.Object, ... you are most likely missing this AnalysisInputLocation.
Java Bytecode
File-Extensions: .class, .jar, .war
The JavaClassPathAnalysisInputLocation
is the equivalent of the classpath you would pass to the java executable i.e. point to root(s) of package(s).
1 2 3 |
|
1 2 3 4 5 6 7 |
|
1 2 3 4 5 |
|
1 2 3 |
|
Java Sourcecode
File-Extensions: .java
With the OTFCompileAnalysisInputLocation
you can point directly to .java files or pass a String with Java sourcecode.
The AnalysisInputLocation delegates the data to the JavaCompiler
and transform the bytecode from the compiler to Jimple.
1 2 |
|
1 2 3 |
|
1 2 3 |
|
JavaSourcePathInputLocation
experimental! - points to a directory that is the root source directory (containing the package directory structure).
Jimple
File-Extensions: .jimple
The JimpleAnalysisInputLocation
needs a Path to a .jimple file or a directory.
1 2 3 |
|
Android Bytecode
File-Extensions: .apk
The ApkAnalysisInputLocation
is the APK frontend written for Sootup
1 2 3 |
|
Android Bytecode with Dex2Jar
File-Extensions: .apk
If you prefer to use dex2jar as a base to transform android apps to jimple, you can add the code below to create your own analysis input location. We used the dependency de.femtopedia.dex2jar:dex2jar:2.4.22 in the given example. We recommend to use ApkAnalysisInputLocation
1 2 3 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Combining Multiple AnalysisInputLocations
But what if I want to point to multiple AnalysisInputLocations?
1 2 3 4 5 6 7 |
|
Of course you can combine different types of AnalysisInputLocation
s as well!
Maven Project as Analysis Input in SootUp
This uses mvn compile
+ JavaClassPathAnalysisInputLocation
under the hood to include a maven project.
1 |
|
Unfortunately its harder to extract the path of the binary result of Gradle projects in a unified way for all kinds of models - If you have a solution are looking forward to merge your contribution :-).
Java cli arguments to configure SootUp
We created a Utility that parses a String of java command line arguments and configures SootUp respectively.