Examples of TraceMethodVisitor


Examples of org.ow2.asm.util.TraceMethodVisitor

        System.err.println("Actual=" + textact);
        assertEquals(textexp, textact);
    }

    private String getText(final MethodNode mn) {
        TraceMethodVisitor tmv = new TraceMethodVisitor(null);
        mn.accept(tmv);

        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < tmv.text.size(); i++) {
            sb.append(tmv.text.get(i));
View Full Code Here

Examples of org.ow2.asm.util.TraceMethodVisitor

                        a.analyze(cn.name, method);
                    } catch (Exception ignored) {
                    }
                    final Frame<?>[] frames = a.getFrames();

                    TraceMethodVisitor mv = new TraceMethodVisitor() {
                        @Override
                        public void visitMaxs(
                            final int maxStack,
                            final int maxLocals)
                        {
                            for (int i = 0; i < text.size(); ++i) {
                                StringBuffer s = new StringBuffer(frames[i] == null
                                        ? "null"
                                        : frames[i].toString());
                                while (s.length() < Math.max(20, maxStack
                                        + maxLocals + 1))
                                {
                                    s.append(' ');
                                }
                                System.err.print(Integer.toString(i + 1000)
                                        .substring(1)
                                        + " " + s + " : " + text.get(i));
                            }
                            System.err.println();
                        }
                    };
                    for (int j = 0; j < method.instructions.size(); ++j) {
                        Object insn = method.instructions.get(j);
                        ((AbstractInsnNode) insn).accept(mv);
                    }
                    mv.visitMaxs(0, 0);
                }
            }
        }
    }
View Full Code Here

Examples of org.ow2.easybeans.asm.util.TraceMethodVisitor

                final Frame[] frames = a.getFrames();

                if (throwE != null) {
                    System.out.println(method.name + method.desc);

                    TraceMethodVisitor mv = new TraceMethodVisitor() {

                        @Override
                        public void visitMaxs(final int maxStack, final int maxLocals) {
                            for (int i = 0; i < text.size(); ++i) {
                                String s;
                                if (frames[i] == null) {
                                        s = "null";
                                } else {
                                    s = frames[i].toString();
                                }
                                while (s.length() < maxStack + maxLocals + 1) {
                                    s += " ";
                                }
                                System.out.print(Integer.toString(i + START_INT).substring(1));
                                System.out.print(" " + s + " : " + text.get(i));
                            }
                            System.out.println();
                        }
                    };
                    for (int j = 0; j < method.instructions.size(); ++j) {
                        method.instructions.get(j).accept(mv);
                    }
                    mv.visitMaxs(method.maxStack, method.maxLocals);
                    throw throwE;
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.