mirror of
https://github.com/revanced/smali.git
synced 2025-05-16 22:17:07 +02:00
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:
parent
3ce2b6fcee
commit
630f5dc2dc
@ -91,7 +91,7 @@ public class MethodDefinition {
|
|||||||
private static List<StringTemplate> getParameters(StringTemplateGroup stg, CodeItem codeItem,
|
private static List<StringTemplate> getParameters(StringTemplateGroup stg, CodeItem codeItem,
|
||||||
AnnotationSetRefList parameterAnnotations) {
|
AnnotationSetRefList parameterAnnotations) {
|
||||||
DebugInfoItem debugInfoItem = null;
|
DebugInfoItem debugInfoItem = null;
|
||||||
if (codeItem != null) {
|
if (baksmali.outputDebugInfo && codeItem != null) {
|
||||||
debugInfoItem = codeItem.getDebugInfo();
|
debugInfoItem = codeItem.getDebugInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +169,9 @@ public class MethodDefinition {
|
|||||||
methodItems.addAll(methodItemList.instructions);
|
methodItems.addAll(methodItemList.instructions);
|
||||||
methodItems.addAll(methodItemList.blanks);
|
methodItems.addAll(methodItemList.blanks);
|
||||||
methodItems.addAll(methodItemList.catches);
|
methodItems.addAll(methodItemList.catches);
|
||||||
methodItems.addAll(methodItemList.debugItems);
|
if (baksmali.outputDebugInfo) {
|
||||||
|
methodItems.addAll(methodItemList.debugItems);
|
||||||
|
}
|
||||||
Collections.sort(methodItems);
|
Collections.sort(methodItems);
|
||||||
|
|
||||||
return methodItems;
|
return methodItems;
|
||||||
|
@ -44,15 +44,17 @@ public class baksmali {
|
|||||||
public static boolean noParameterRegisters = false;
|
public static boolean noParameterRegisters = false;
|
||||||
public static boolean useLocalsDirective = false;
|
public static boolean useLocalsDirective = false;
|
||||||
public static boolean useIndexedLabels = false;
|
public static boolean useIndexedLabels = false;
|
||||||
|
public static boolean outputDebugInfo = true;
|
||||||
public static DeodexUtil deodexUtil = null;
|
public static DeodexUtil deodexUtil = null;
|
||||||
|
|
||||||
public static void disassembleDexFile(DexFile dexFile, Deodexerant deodexerant, String outputDirectory,
|
public static void disassembleDexFile(DexFile dexFile, Deodexerant deodexerant, String outputDirectory,
|
||||||
boolean noParameterRegisters, boolean useLocalsDirective,
|
boolean noParameterRegisters, boolean useLocalsDirective,
|
||||||
boolean useIndexedLabels)
|
boolean useIndexedLabels, boolean outputDebugInfo)
|
||||||
{
|
{
|
||||||
baksmali.noParameterRegisters = noParameterRegisters;
|
baksmali.noParameterRegisters = noParameterRegisters;
|
||||||
baksmali.useLocalsDirective = useLocalsDirective;
|
baksmali.useLocalsDirective = useLocalsDirective;
|
||||||
baksmali.useIndexedLabels = useIndexedLabels;
|
baksmali.useIndexedLabels = useIndexedLabels;
|
||||||
|
baksmali.outputDebugInfo = outputDebugInfo;
|
||||||
|
|
||||||
if (deodexerant != null) {
|
if (deodexerant != null) {
|
||||||
baksmali.deodexUtil = new DeodexUtil(deodexerant);
|
baksmali.deodexUtil = new DeodexUtil(deodexerant);
|
||||||
|
@ -74,6 +74,7 @@ public class main {
|
|||||||
boolean noParameterRegisters = false;
|
boolean noParameterRegisters = false;
|
||||||
boolean useLocalsDirective = false;
|
boolean useLocalsDirective = false;
|
||||||
boolean useIndexedLabels = false;
|
boolean useIndexedLabels = false;
|
||||||
|
boolean outputDebugInfo = true;
|
||||||
|
|
||||||
|
|
||||||
String outputDirectory = "out";
|
String outputDirectory = "out";
|
||||||
@ -140,6 +141,10 @@ public class main {
|
|||||||
useIndexedLabels = true;
|
useIndexedLabels = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (commandLine.hasOption("b")) {
|
||||||
|
outputDebugInfo = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (commandLine.hasOption("x")) {
|
if (commandLine.hasOption("x")) {
|
||||||
String deodexerantAddress = commandLine.getOptionValue("x");
|
String deodexerantAddress = commandLine.getOptionValue("x");
|
||||||
String[] parts = deodexerantAddress.split(":");
|
String[] parts = deodexerantAddress.split(":");
|
||||||
@ -191,7 +196,7 @@ public class main {
|
|||||||
|
|
||||||
if (disassemble) {
|
if (disassemble) {
|
||||||
baksmali.disassembleDexFile(dexFile, deodexerant, outputDirectory, noParameterRegisters,
|
baksmali.disassembleDexFile(dexFile, deodexerant, outputDirectory, noParameterRegisters,
|
||||||
useLocalsDirective, useIndexedLabels);
|
useLocalsDirective, useIndexedLabels, outputDebugInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((doDump || write) && !dexFile.isOdex()) {
|
if ((doDump || write) && !dexFile.isOdex()) {
|
||||||
@ -296,7 +301,9 @@ public class main {
|
|||||||
" rather than the bytecode offset")
|
" rather than the bytecode offset")
|
||||||
.create("i");
|
.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(versionOption);
|
||||||
options.addOption(helpOption);
|
options.addOption(helpOption);
|
||||||
@ -310,5 +317,6 @@ public class main {
|
|||||||
options.addOption(deodexerantOption);
|
options.addOption(deodexerantOption);
|
||||||
options.addOption(useLocalsOption);
|
options.addOption(useLocalsOption);
|
||||||
options.addOption(indexedLabelsOption);
|
options.addOption(indexedLabelsOption);
|
||||||
|
options.addOption(noDebugInfoOption);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user