diff --git a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java index 4ca94ea9..2d07ee5f 100644 --- a/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java +++ b/baksmali/src/main/java/org/jf/baksmali/Adaptors/MethodDefinition.java @@ -91,7 +91,7 @@ public class MethodDefinition { private static List getParameters(StringTemplateGroup stg, CodeItem codeItem, AnnotationSetRefList parameterAnnotations) { DebugInfoItem debugInfoItem = null; - if (codeItem != null) { + if (baksmali.outputDebugInfo && codeItem != null) { debugInfoItem = codeItem.getDebugInfo(); } @@ -169,7 +169,9 @@ public class MethodDefinition { methodItems.addAll(methodItemList.instructions); methodItems.addAll(methodItemList.blanks); methodItems.addAll(methodItemList.catches); - methodItems.addAll(methodItemList.debugItems); + if (baksmali.outputDebugInfo) { + methodItems.addAll(methodItemList.debugItems); + } Collections.sort(methodItems); return methodItems; diff --git a/baksmali/src/main/java/org/jf/baksmali/baksmali.java b/baksmali/src/main/java/org/jf/baksmali/baksmali.java index b52e9ba0..31ec0fa8 100644 --- a/baksmali/src/main/java/org/jf/baksmali/baksmali.java +++ b/baksmali/src/main/java/org/jf/baksmali/baksmali.java @@ -44,15 +44,17 @@ public class baksmali { public static boolean noParameterRegisters = false; public static boolean useLocalsDirective = false; public static boolean useIndexedLabels = false; + public static boolean outputDebugInfo = true; public static DeodexUtil deodexUtil = null; public static void disassembleDexFile(DexFile dexFile, Deodexerant deodexerant, String outputDirectory, boolean noParameterRegisters, boolean useLocalsDirective, - boolean useIndexedLabels) + boolean useIndexedLabels, boolean outputDebugInfo) { baksmali.noParameterRegisters = noParameterRegisters; baksmali.useLocalsDirective = useLocalsDirective; baksmali.useIndexedLabels = useIndexedLabels; + baksmali.outputDebugInfo = outputDebugInfo; if (deodexerant != null) { baksmali.deodexUtil = new DeodexUtil(deodexerant); diff --git a/baksmali/src/main/java/org/jf/baksmali/main.java b/baksmali/src/main/java/org/jf/baksmali/main.java index a30da920..f03b74d8 100644 --- a/baksmali/src/main/java/org/jf/baksmali/main.java +++ b/baksmali/src/main/java/org/jf/baksmali/main.java @@ -74,6 +74,7 @@ public class main { boolean noParameterRegisters = false; boolean useLocalsDirective = false; boolean useIndexedLabels = false; + boolean outputDebugInfo = true; String outputDirectory = "out"; @@ -140,6 +141,10 @@ public class main { useIndexedLabels = true; } + if (commandLine.hasOption("b")) { + outputDebugInfo = false; + } + if (commandLine.hasOption("x")) { String deodexerantAddress = commandLine.getOptionValue("x"); String[] parts = deodexerantAddress.split(":"); @@ -191,7 +196,7 @@ public class main { if (disassemble) { baksmali.disassembleDexFile(dexFile, deodexerant, outputDirectory, noParameterRegisters, - useLocalsDirective, useIndexedLabels); + useLocalsDirective, useIndexedLabels, outputDebugInfo); } if ((doDump || write) && !dexFile.isOdex()) { @@ -296,7 +301,9 @@ public class main { " rather than the bytecode offset") .create("i"); - OptionGroup dumpCommand = new OptionGroup(); + Option noDebugInfoOption = OptionBuilder.withLongOpt("no-debug-info") + .withDescription("don't write out debug info (.local, .param, .line, etc.)") + .create("b"); options.addOption(versionOption); options.addOption(helpOption); @@ -310,5 +317,6 @@ public class main { options.addOption(deodexerantOption); options.addOption(useLocalsOption); options.addOption(indexedLabelsOption); + options.addOption(noDebugInfoOption); } } \ No newline at end of file