mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-01 22:54:24 +02:00
Adding debug. Kudos to Ziggy (ziggy@******.com)
This commit is contained in:
parent
1e0a80f9a8
commit
97d8134eb0
@ -95,6 +95,8 @@ public class Main {
|
|||||||
decoder.setDecodeSources(ApkDecoder.DECODE_SOURCES_NONE);
|
decoder.setDecodeSources(ApkDecoder.DECODE_SOURCES_NONE);
|
||||||
} else if ("-d".equals(opt) || "--debug".equals(opt)) {
|
} else if ("-d".equals(opt) || "--debug".equals(opt)) {
|
||||||
decoder.setDebugMode(true);
|
decoder.setDebugMode(true);
|
||||||
|
} else if ("-b".equals(opt) || "--no-debug-info".equals(opt)) {
|
||||||
|
decoder.setBaksmaliDebugMode(false);
|
||||||
} else if ("-t".equals(opt) || "--frame-tag".equals(opt)) {
|
} else if ("-t".equals(opt) || "--frame-tag".equals(opt)) {
|
||||||
i++;
|
i++;
|
||||||
if (i >= args.length) {
|
if (i >= args.length) {
|
||||||
@ -236,6 +238,8 @@ public class Main {
|
|||||||
" Do not decode resources.\n" +
|
" Do not decode resources.\n" +
|
||||||
" -d, --debug\n" +
|
" -d, --debug\n" +
|
||||||
" Decode in debug mode. Check project page for more info.\n" +
|
" Decode in debug mode. Check project page for more info.\n" +
|
||||||
|
" -b, --no-debug-info\n" +
|
||||||
|
" Baksmali -- don't write out debug info (.local, .param, .line, etc.).\n" +
|
||||||
" -f, --force\n" +
|
" -f, --force\n" +
|
||||||
" Force delete destination directory.\n" +
|
" Force delete destination directory.\n" +
|
||||||
" -t <tag>, --frame-tag <tag>\n" +
|
" -t <tag>, --frame-tag <tag>\n" +
|
||||||
|
@ -62,14 +62,14 @@ public class Androlib {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void decodeSourcesSmali(File apkFile, File outDir, boolean debug)
|
public void decodeSourcesSmali(File apkFile, File outDir, boolean debug, boolean bakdeb)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
try {
|
try {
|
||||||
File smaliDir = new File(outDir, SMALI_DIRNAME);
|
File smaliDir = new File(outDir, SMALI_DIRNAME);
|
||||||
OS.rmdir(smaliDir);
|
OS.rmdir(smaliDir);
|
||||||
smaliDir.mkdirs();
|
smaliDir.mkdirs();
|
||||||
LOGGER.info("Baksmaling...");
|
LOGGER.info("Baksmaling...");
|
||||||
SmaliDecoder.decode(apkFile, smaliDir, debug);
|
SmaliDecoder.decode(apkFile, smaliDir, debug, bakdeb);
|
||||||
} catch (BrutException ex) {
|
} catch (BrutException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class ApkDecoder {
|
|||||||
mAndrolib.decodeSourcesRaw(mApkFile, outDir, mDebug);
|
mAndrolib.decodeSourcesRaw(mApkFile, outDir, mDebug);
|
||||||
break;
|
break;
|
||||||
case DECODE_SOURCES_SMALI:
|
case DECODE_SOURCES_SMALI:
|
||||||
mAndrolib.decodeSourcesSmali(mApkFile, outDir, mDebug);
|
mAndrolib.decodeSourcesSmali(mApkFile, outDir, mDebug, mBakDeb);
|
||||||
break;
|
break;
|
||||||
case DECODE_SOURCES_JAVA:
|
case DECODE_SOURCES_JAVA:
|
||||||
mAndrolib.decodeSourcesJava(mApkFile, outDir, mDebug);
|
mAndrolib.decodeSourcesJava(mApkFile, outDir, mDebug);
|
||||||
@ -139,6 +139,10 @@ public class ApkDecoder {
|
|||||||
mDebug = debug;
|
mDebug = debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBaksmaliDebugMode(boolean bakdeb) {
|
||||||
|
mBakDeb = bakdeb;
|
||||||
|
}
|
||||||
|
|
||||||
public void setForceDelete(boolean forceDelete) {
|
public void setForceDelete(boolean forceDelete) {
|
||||||
mForceDelete = forceDelete;
|
mForceDelete = forceDelete;
|
||||||
}
|
}
|
||||||
@ -267,4 +271,5 @@ public class ApkDecoder {
|
|||||||
private boolean mForceDelete = false;
|
private boolean mForceDelete = false;
|
||||||
private String mFrameTag;
|
private String mFrameTag;
|
||||||
private boolean mKeepBrokenResources = false;
|
private boolean mKeepBrokenResources = false;
|
||||||
}
|
private boolean mBakDeb = true;
|
||||||
|
}
|
||||||
|
@ -29,15 +29,16 @@ import org.jf.dexlib.DexFile;
|
|||||||
*/
|
*/
|
||||||
public class SmaliDecoder {
|
public class SmaliDecoder {
|
||||||
|
|
||||||
public static void decode(File apkFile, File outDir, boolean debug)
|
public static void decode(File apkFile, File outDir, boolean debug, boolean bakdeb)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
new SmaliDecoder(apkFile, outDir, debug).decode();
|
new SmaliDecoder(apkFile, outDir, debug, bakdeb).decode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SmaliDecoder(File apkFile, File outDir, boolean debug) {
|
private SmaliDecoder(File apkFile, File outDir, boolean debug, boolean bakdeb) {
|
||||||
mApkFile = apkFile;
|
mApkFile = apkFile;
|
||||||
mOutDir = outDir;
|
mOutDir = outDir;
|
||||||
mDebug = debug;
|
mDebug = debug;
|
||||||
|
mBakDeb = bakdeb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decode() throws AndrolibException {
|
private void decode() throws AndrolibException {
|
||||||
@ -47,7 +48,7 @@ public class SmaliDecoder {
|
|||||||
try {
|
try {
|
||||||
baksmali.disassembleDexFile(mApkFile.getAbsolutePath(),
|
baksmali.disassembleDexFile(mApkFile.getAbsolutePath(),
|
||||||
new DexFile(mApkFile), false, mOutDir.getAbsolutePath(), null,
|
new DexFile(mApkFile), false, mOutDir.getAbsolutePath(), null,
|
||||||
null, null, false, true, true, true, false, false,
|
null, null, false, true, true, mBakDeb, false, false,
|
||||||
mDebug ? main.DIFFPRE: 0, false, false, null);
|
mDebug ? main.DIFFPRE: 0, false, false, null);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
@ -57,4 +58,5 @@ public class SmaliDecoder {
|
|||||||
private final File mApkFile;
|
private final File mApkFile;
|
||||||
private final File mOutDir;
|
private final File mOutDir;
|
||||||
private final boolean mDebug;
|
private final boolean mDebug;
|
||||||
|
private final boolean mBakDeb;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user