use of org.objectweb.asm.util.TraceMethodVisitor in project dex2jar by pxb1988.
the class AsmVerify method printAnalyzerResult.
static void printAnalyzerResult(MethodNode method, Analyzer a, final PrintWriter pw) throws IllegalArgumentException {
Frame[] frames = a.getFrames();
Textifier t = new Textifier();
TraceMethodVisitor mv = new TraceMethodVisitor(t);
String format = "%05d %-" + (method.maxStack + method.maxLocals + 6) + "s|%s";
for (int j = 0; j < method.instructions.size(); ++j) {
method.instructions.get(j).accept(mv);
StringBuffer s = new StringBuffer();
Frame f = frames[j];
if (f == null) {
s.append('?');
} else {
for (int k = 0; k < f.getLocals(); ++k) {
s.append(getShortName(f.getLocal(k).toString()));
}
s.append(" : ");
for (int k = 0; k < f.getStackSize(); ++k) {
s.append(getShortName(f.getStack(k).toString()));
}
}
try {
// mv.text.get(j));
pw.printf(format, j, s, buf.get(t));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
for (TryCatchBlockNode tryCatchBlockNode : method.tryCatchBlocks) {
tryCatchBlockNode.accept(mv);
try {
pw.print(" " + buf.get(t));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
pw.println();
pw.flush();
}
Aggregations