提交 d111fd06 编写于 作者: A Ahmed Ashour 提交者: skylot

feat: add a flag to disable debug info (#276) (PR #502)

上级 eed762df
......@@ -47,6 +47,9 @@ public class JadxCLIArgs {
@Parameter(names = {"--no-imports"}, description = "disable use of imports, always write entire package name")
protected boolean useImports = true;
@Parameter(names = {"--no-debug-info"}, description = "disable debug info")
protected boolean debugInfo = true;
@Parameter(names = "--no-replace-consts", description = "don't replace constant value with matching constant field")
protected boolean replaceConsts = true;
......@@ -160,6 +163,7 @@ public class JadxCLIArgs {
args.setRespectBytecodeAccModifiers(respectBytecodeAccessModifiers);
args.setExportAsGradleProject(exportAsGradleProject);
args.setUseImports(useImports);
args.setDebugInfo(debugInfo);
return args;
}
......@@ -203,6 +207,10 @@ public class JadxCLIArgs {
return useImports;
}
public boolean isDebugInfo() {
return debugInfo;
}
public boolean isDeobfuscationOn() {
return deobfuscationOn;
}
......
......@@ -33,11 +33,14 @@ public class JadxCLIArgsTest {
@Test
public void testOptionsOverride() {
assertThat(override(new JadxCLIArgs(), "--no-imports").isUseImports(), is(false));
assertThat(override(new JadxCLIArgs(), "--no-debug-info").isDebugInfo(), is(false));
assertThat(override(new JadxCLIArgs(), "").isUseImports(), is(true));
JadxCLIArgs args = new JadxCLIArgs();
args.useImports = false;
assertThat(override(args, "--no-imports").isUseImports(), is(false));
args.debugInfo = false;
assertThat(override(args, "--no-debug-info").isDebugInfo(), is(false));
args = new JadxCLIArgs();
args.useImports = false;
......
......@@ -27,6 +27,7 @@ public class JadxArgs {
private boolean showInconsistentCode = false;
private boolean useImports = true;
private boolean debugInfo = true;
private boolean isSkipResources = false;
private boolean isSkipSources = false;
......@@ -133,6 +134,14 @@ public class JadxArgs {
this.useImports = useImports;
}
public boolean isDebugInfo() {
return debugInfo;
}
public void setDebugInfo(boolean debugInfo) {
this.debugInfo = debugInfo;
}
public boolean isSkipResources() {
return isSkipResources;
}
......
......@@ -67,7 +67,9 @@ public class Jadx {
passes.add(new BlockFinish());
passes.add(new SSATransform());
passes.add(new DebugInfoVisitor());
if (args.isDebugInfo()) {
passes.add(new DebugInfoVisitor());
}
passes.add(new TypeInference());
if (args.isRawCFGOutput()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册