Commit d111fd06 authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

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

parent eed762df
...@@ -47,6 +47,9 @@ public class JadxCLIArgs { ...@@ -47,6 +47,9 @@ public class JadxCLIArgs {
@Parameter(names = {"--no-imports"}, description = "disable use of imports, always write entire package name") @Parameter(names = {"--no-imports"}, description = "disable use of imports, always write entire package name")
protected boolean useImports = true; 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") @Parameter(names = "--no-replace-consts", description = "don't replace constant value with matching constant field")
protected boolean replaceConsts = true; protected boolean replaceConsts = true;
...@@ -160,6 +163,7 @@ public class JadxCLIArgs { ...@@ -160,6 +163,7 @@ public class JadxCLIArgs {
args.setRespectBytecodeAccModifiers(respectBytecodeAccessModifiers); args.setRespectBytecodeAccModifiers(respectBytecodeAccessModifiers);
args.setExportAsGradleProject(exportAsGradleProject); args.setExportAsGradleProject(exportAsGradleProject);
args.setUseImports(useImports); args.setUseImports(useImports);
args.setDebugInfo(debugInfo);
return args; return args;
} }
...@@ -203,6 +207,10 @@ public class JadxCLIArgs { ...@@ -203,6 +207,10 @@ public class JadxCLIArgs {
return useImports; return useImports;
} }
public boolean isDebugInfo() {
return debugInfo;
}
public boolean isDeobfuscationOn() { public boolean isDeobfuscationOn() {
return deobfuscationOn; return deobfuscationOn;
} }
......
...@@ -33,11 +33,14 @@ public class JadxCLIArgsTest { ...@@ -33,11 +33,14 @@ public class JadxCLIArgsTest {
@Test @Test
public void testOptionsOverride() { public void testOptionsOverride() {
assertThat(override(new JadxCLIArgs(), "--no-imports").isUseImports(), is(false)); 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)); assertThat(override(new JadxCLIArgs(), "").isUseImports(), is(true));
JadxCLIArgs args = new JadxCLIArgs(); JadxCLIArgs args = new JadxCLIArgs();
args.useImports = false; args.useImports = false;
assertThat(override(args, "--no-imports").isUseImports(), is(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 = new JadxCLIArgs();
args.useImports = false; args.useImports = false;
......
...@@ -27,6 +27,7 @@ public class JadxArgs { ...@@ -27,6 +27,7 @@ public class JadxArgs {
private boolean showInconsistentCode = false; private boolean showInconsistentCode = false;
private boolean useImports = true; private boolean useImports = true;
private boolean debugInfo = true;
private boolean isSkipResources = false; private boolean isSkipResources = false;
private boolean isSkipSources = false; private boolean isSkipSources = false;
...@@ -133,6 +134,14 @@ public class JadxArgs { ...@@ -133,6 +134,14 @@ public class JadxArgs {
this.useImports = useImports; this.useImports = useImports;
} }
public boolean isDebugInfo() {
return debugInfo;
}
public void setDebugInfo(boolean debugInfo) {
this.debugInfo = debugInfo;
}
public boolean isSkipResources() { public boolean isSkipResources() {
return isSkipResources; return isSkipResources;
} }
......
...@@ -67,7 +67,9 @@ public class Jadx { ...@@ -67,7 +67,9 @@ public class Jadx {
passes.add(new BlockFinish()); passes.add(new BlockFinish());
passes.add(new SSATransform()); passes.add(new SSATransform());
if (args.isDebugInfo()) {
passes.add(new DebugInfoVisitor()); passes.add(new DebugInfoVisitor());
}
passes.add(new TypeInference()); passes.add(new TypeInference());
if (args.isRawCFGOutput()) { if (args.isRawCFGOutput()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment