feat(gui): improve smali printer to show bytecode (#1114) (PR #1126)

* improve smali printer to show bytecode
* set insnStart position before start decoding
* swithed line 62 and line 63, to get the proper bytes, insnStart must to be set before start to decode.

Co-authored-by: tobias <tobias.hotmail.com>
This commit is contained in:
LBJ-the-GOAT
2021-03-02 21:02:56 +08:00
committed by GitHub
parent 3a69ac23c0
commit 650863836c
20 changed files with 1174 additions and 18 deletions
@@ -576,6 +576,29 @@ public class ClassNode extends NotificationAttrNode implements ILoadable, ICodeN
sb.append(this.clsData.getDisassembledCode());
}
public String getSmaliV2() {
StringBuilder sb = new StringBuilder();
getSmaliV2(sb);
sb.append(System.lineSeparator());
Set<ClassNode> allInlinedClasses = new LinkedHashSet<>();
getInnerAndInlinedClassesRecursive(allInlinedClasses);
for (ClassNode innerClass : allInlinedClasses) {
innerClass.getSmaliV2(sb);
sb.append(System.lineSeparator());
}
return sb.toString();
}
private void getSmaliV2(StringBuilder sb) {
if (this.clsData == null) {
sb.append(String.format("###### Class %s is created by jadx", getFullName()));
return;
}
sb.append(String.format("###### Class %s (%s)", getFullName(), getRawName()));
sb.append(System.lineSeparator());
sb.append(this.clsData.getDisassembledCodeV2());
}
public ProcessState getState() {
return state;
}