mirror of
https://github.com/revanced/smali.git
synced 2025-05-04 08:34:25 +02:00
Added an option to only read the dex file then exit (mostly for profiling)
git-svn-id: https://smali.googlecode.com/svn/trunk@224 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
dd5fc67202
commit
9293a116b3
@ -62,6 +62,7 @@ public class main {
|
||||
boolean write = false;
|
||||
boolean sort = false;
|
||||
boolean fixRegisters = false;
|
||||
boolean readOnly = false;
|
||||
|
||||
String outputDirectory = "out";
|
||||
String dumpFileName = null;
|
||||
@ -87,6 +88,10 @@ public class main {
|
||||
|
||||
inputDexFileName = remainingArgs[0];
|
||||
|
||||
if (commandLine.hasOption("r")) {
|
||||
readOnly = true;
|
||||
}
|
||||
|
||||
if (commandLine.hasOption("d")) {
|
||||
doDump = true;
|
||||
dumpFileName = commandLine.getOptionValue("d", inputDexFileName + ".dump");
|
||||
@ -125,6 +130,10 @@ public class main {
|
||||
//Read in and parse the dex file
|
||||
DexFile dexFile = new DexFile(dexFileFile, !fixRegisters);
|
||||
|
||||
if (readOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (disassemble) {
|
||||
baksmali.disassembleDexFile(dexFile, outputDirectory);
|
||||
}
|
||||
@ -177,6 +186,10 @@ public class main {
|
||||
.withDescription("prints the help message then exits")
|
||||
.create("?");
|
||||
|
||||
Option readonlyOption = OptionBuilder.withLongOpt("read-only")
|
||||
.withDescription("reads in the dex file and then exits")
|
||||
.create("r");
|
||||
|
||||
Option dumpOption = OptionBuilder.withLongOpt("dump-to")
|
||||
.withDescription("dumps the given dex file into a single annotated dump file named FILE (<dexfile>.dump by default), along with the normal disassembly.")
|
||||
.hasOptionalArg()
|
||||
@ -212,6 +225,7 @@ public class main {
|
||||
OptionGroup dumpCommand = new OptionGroup();
|
||||
dumpCommand.addOption(dumpOption);
|
||||
dumpCommand.addOption(dumpOnlyOption);
|
||||
dumpCommand.addOption(readonlyOption);
|
||||
|
||||
options.addOption(versionOption);
|
||||
options.addOption(helpOption);
|
||||
|
Loading…
x
Reference in New Issue
Block a user