mirror of
https://github.com/revanced/smali.git
synced 2025-05-28 03:40:12 +02:00
Add the ability to specify the oat version to use when listing vtables
This commit is contained in:
parent
a54523e080
commit
7cb0937324
@ -46,8 +46,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.jf.dexlib2.analysis.ClassPath.NOT_ART;
|
||||
|
||||
public class AnalysisArguments {
|
||||
@Parameter(names = {"-a", "--api"},
|
||||
description = "The numeric api level of the file being disassembled.")
|
||||
@ -87,7 +85,13 @@ public class AnalysisArguments {
|
||||
|
||||
@Nonnull
|
||||
public ClassPath loadClassPathForDexFile(@Nonnull File dexFileDir, @Nonnull DexFile dexFile,
|
||||
boolean checkPackagePrivateAccess)
|
||||
boolean checkPackagePrivateAccess) throws IOException {
|
||||
return loadClassPathForDexFile(dexFileDir, dexFile, checkPackagePrivateAccess, 0);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ClassPath loadClassPathForDexFile(@Nonnull File dexFileDir, @Nonnull DexFile dexFile,
|
||||
boolean checkPackagePrivateAccess, int oatVersion)
|
||||
throws IOException {
|
||||
ClassPathResolver resolver;
|
||||
|
||||
@ -125,8 +129,7 @@ public class AnalysisArguments {
|
||||
resolver = new ClassPathResolver(filteredClassPathDirectories, bootClassPath, classPath, dexFile);
|
||||
}
|
||||
|
||||
int oatVersion = NOT_ART;
|
||||
if (dexFile instanceof OatDexFile) {
|
||||
if (oatVersion == 0 && dexFile instanceof OatDexFile) {
|
||||
oatVersion = ((OatDexFile)dexFile).getContainer().getOatVersion();
|
||||
}
|
||||
return new ClassPath(resolver.getResolvedClassProviders(), checkPackagePrivateAccess, oatVersion);
|
||||
|
@ -68,6 +68,12 @@ public class ListVtablesCommand extends DexInputCommand {
|
||||
@ExtendedParameter(argumentNames = "classes")
|
||||
private List<String> classes = null;
|
||||
|
||||
@Parameter(names = "--override-oat-version",
|
||||
description = "Uses a classpath for the given oat version, regardless of the actual oat version. This " +
|
||||
"can be used, e.g. to list vtables from a dex file, as if they were in an oat file of the given " +
|
||||
"version.")
|
||||
private int oatVersion = 0;
|
||||
|
||||
public ListVtablesCommand(@Nonnull List<JCommander> commandAncestors) {
|
||||
super(commandAncestors);
|
||||
}
|
||||
@ -139,7 +145,7 @@ public class ListVtablesCommand extends DexInputCommand {
|
||||
|
||||
try {
|
||||
options.classPath = analysisArguments.loadClassPathForDexFile(inputFile.getAbsoluteFile().getParentFile(),
|
||||
dexFile, checkPackagePrivateArgument.checkPackagePrivateAccess);
|
||||
dexFile, checkPackagePrivateArgument.checkPackagePrivateAccess, oatVersion);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("Error occurred while loading class path files.");
|
||||
ex.printStackTrace(System.err);
|
||||
|
Loading…
x
Reference in New Issue
Block a user