mirror of
https://github.com/pxb1988/dex2jar.git
synced 2024-11-23 05:10:11 +00:00
skip exception
This commit is contained in:
parent
1d515072d5
commit
1238d14b14
@ -69,6 +69,11 @@ public class DexFileReader implements BaseDexFileReader {
|
||||
*/
|
||||
public static final int KEEP_CLINIT = 1 << 7;
|
||||
|
||||
/**
|
||||
* keep clinit method when {@link #SKIP_DEBUG}
|
||||
*/
|
||||
public static final int SKIP_EXCEPTION = 1 << 8;
|
||||
|
||||
// private static final int REVERSE_ENDIAN_CONSTANT = 0x78563412;
|
||||
|
||||
static final int DBG_END_SEQUENCE = 0x00;
|
||||
@ -1384,7 +1389,9 @@ public class DexFileReader implements BaseDexFileReader {
|
||||
if ((insns & 0x01) != 0) {// skip padding
|
||||
in.getShort();
|
||||
}
|
||||
findTryCatch(in, dcv, tries_size, insns, labelsMap, handlers);
|
||||
if (0 == (config & SKIP_EXCEPTION)) {
|
||||
findTryCatch(in, dcv, tries_size, insns, labelsMap, handlers);
|
||||
}
|
||||
}
|
||||
// 处理debug信息
|
||||
if (debug_info_off != 0 && (0 == (config & SKIP_DEBUG))) {
|
||||
|
@ -60,6 +60,9 @@ public class Dex2jarCmd extends BaseCmd {
|
||||
@Opt(opt = "os", longOpt = "optmize-synchronized", hasArg = false, description = "optimize-synchronized")
|
||||
private boolean optmizeSynchronized = false;
|
||||
|
||||
@Opt(longOpt = "skip-exceptions", hasArg = false, description = "skip-exceptions")
|
||||
private boolean skipExceptions = false;
|
||||
|
||||
@Opt(opt = "nc", longOpt = "no-code", hasArg = false, description = "")
|
||||
private boolean noCode = false;
|
||||
|
||||
@ -106,7 +109,7 @@ public class Dex2jarCmd extends BaseCmd {
|
||||
BaksmaliBaseDexExceptionHandler handler = notHandleException ? null : new BaksmaliBaseDexExceptionHandler();
|
||||
Dex2jar.from(reader).withExceptionHandler(handler).reUseReg(reuseReg).topoLogicalSort()
|
||||
.skipDebug(!debugInfo).optimizeSynchronized(this.optmizeSynchronized).printIR(printIR)
|
||||
.noCode(noCode).to(file);
|
||||
.noCode(noCode).skipExceptions(skipExceptions).to(file);
|
||||
|
||||
if (!notHandleException) {
|
||||
if (handler.hasException()) {
|
||||
|
@ -298,4 +298,13 @@ public class Dex2jar {
|
||||
this.exceptionHandler = exceptionHandler;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Dex2jar skipExceptions(boolean b) {
|
||||
if (b) {
|
||||
this.readerConfig |= DexFileReader.SKIP_EXCEPTION;
|
||||
} else {
|
||||
this.readerConfig &= ~DexFileReader.SKIP_EXCEPTION;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user