use of jadx.api.impl.SimpleCodeWriter in project jadx by skylot.
the class DebugUtils method printInsns.
private static void printInsns(MethodNode mth, ICodeWriter cw, String indent, IBlock block) {
for (InsnNode insn : block.getInstructions()) {
try {
MethodGen mg = MethodGen.getFallbackMethodGen(mth);
InsnGen ig = new InsnGen(mg, true);
ICodeWriter code = new SimpleCodeWriter();
ig.makeInsn(insn, code);
String codeStr = code.getCodeStr();
List<String> insnStrings = Stream.of(codeStr.split(ICodeWriter.NL)).filter(StringUtils::notBlank).map(s -> "|> " + s).collect(Collectors.toList());
Iterator<String> it = insnStrings.iterator();
while (true) {
String insnStr = it.next();
if (it.hasNext()) {
cw.startLine(indent).add(insnStr);
} else {
printWithAttributes(cw, indent, insnStr, insn);
break;
}
}
} catch (CodegenException e) {
cw.startLine(indent).add(">!! ").add(insn.toString());
}
}
}
use of jadx.api.impl.SimpleCodeWriter in project jadx by skylot.
the class DebugUtils method printRegion.
public static void printRegion(MethodNode mth, IRegion region, boolean printInsns) {
ICodeWriter cw = new SimpleCodeWriter();
cw.startLine('|').add(mth.toString());
printRegion(mth, region, cw, "| ", printInsns);
LOG.debug("{}{}", ICodeWriter.NL, cw.finish().getCodeStr());
}
Aggregations