Add support for the -b option for baksmali, to suppress the output of debug info

git-svn-id: https://smali.googlecode.com/svn/trunk@522 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-12-25 23:05:20 +00:00
parent 3ce2b6fcee
commit 630f5dc2dc
3 changed files with 17 additions and 5 deletions

View File

@ -91,7 +91,7 @@ public class MethodDefinition {
private static List<StringTemplate> 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;

View File

@ -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);

View File

@ -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);
}
}