test: print smali code for debug purpose

This commit is contained in:
Skylot
2019-10-30 13:18:52 +00:00
parent 8321d5e380
commit 1b60c1d1a8
@@ -86,6 +86,7 @@ public abstract class IntegrationTest extends TestUtils {
private boolean allowWarnInCode;
private boolean printLineNumbers;
private boolean printSmali;
private DynamicCompiler dynamicCompiler;
@@ -156,7 +157,7 @@ public abstract class IntegrationTest extends TestUtils {
}
protected JadxDecompiler loadFiles(List<File> inputFiles) {
JadxDecompiler d = null;
JadxDecompiler d;
try {
args.setInputFiles(inputFiles);
d = new JadxDecompiler(args);
@@ -188,11 +189,21 @@ public abstract class IntegrationTest extends TestUtils {
}
System.out.println("-----------------------------------------------------------");
if (printSmali) {
clsList.forEach(this::printSmali);
}
clsList.forEach(this::checkCode);
compile(clsList);
clsList.forEach(this::runAutoCheck);
}
private void printSmali(ClassNode cls) {
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println(cls.getSmali());
System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
}
private void printCodeWithLineNumbers(ICodeInfo code) {
String codeStr = code.getCodeStr();
Map<Integer, Integer> lineMapping = code.getLineMapping();
@@ -488,6 +499,12 @@ public abstract class IntegrationTest extends TestUtils {
this.args.setRawCFGOutput(true);
}
// Use only for debug purpose
@Deprecated
protected void printSmali() {
this.printSmali = true;
}
// Use only for debug purpose
@Deprecated
protected void outputRawCFG() {