org.objectweb.asm.util

Class TraceMethodVisitor

Implemented Interfaces:
MethodVisitor

public class TraceMethodVisitor
extends TraceAbstractVisitor
implements MethodVisitor

A MethodVisitor that prints a disassembled view of the methods it visits.
Author:
Eric Bruneton

Field Summary

protected Map
labelNames
The label names.
protected String
ltab
Tab for labels.
protected MethodVisitor
mv
The MethodVisitor to which this visitor delegates calls.
protected String
tab2
Tab for bytecode instructions.
protected String
tab3
Tab for table and lookup switch instructions.

Fields inherited from class org.objectweb.asm.util.TraceAbstractVisitor

CLASS_DECLARATION, CLASS_SIGNATURE, FIELD_DESCRIPTOR, FIELD_SIGNATURE, INTERNAL_NAME, METHOD_DESCRIPTOR, METHOD_SIGNATURE, PARAMETERS_DECLARATION, TYPE_DECLARATION, tab

Fields inherited from class org.objectweb.asm.util.AbstractVisitor

OPCODES, TYPES, buf, text

Constructor Summary

TraceMethodVisitor()
Constructs a new TraceMethodVisitor.
TraceMethodVisitor(MethodVisitor mv)
Constructs a new TraceMethodVisitor.

Method Summary

protected void
appendLabel(Label l)
Appends the name of the given label to buf.
AnnotationVisitor
visitAnnotation(String desc, boolean visible)
AnnotationVisitor
visitAnnotationDefault()
void
visitAttribute(Attribute attr)
void
visitCode()
void
visitEnd()
void
visitFieldInsn(int opcode, String owner, String name, String desc)
void
visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack)
void
visitIincInsn(int var, int increment)
void
visitInsn(int opcode)
void
visitIntInsn(int opcode, int operand)
void
visitJumpInsn(int opcode, Label label)
void
visitLabel(Label label)
void
visitLdcInsn(Object cst)
void
visitLineNumber(int line, Label start)
void
visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index)
void
visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)
void
visitMaxs(int maxStack, int maxLocals)
void
visitMethodInsn(int opcode, String owner, String name, String desc)
void
visitMultiANewArrayInsn(String desc, int dims)
AnnotationVisitor
visitParameterAnnotation(int parameter, String desc, boolean visible)
void
visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels)
void
visitTryCatchBlock(Label start, Label end, Label handler, String type)
void
visitTypeInsn(int opcode, String type)
void
visitVarInsn(int opcode, int var)

Methods inherited from class org.objectweb.asm.util.TraceAbstractVisitor

appendDescriptor, createTraceAnnotationVisitor, visitAnnotation, visitAttribute, visitEnd

Methods inherited from class org.objectweb.asm.util.AbstractVisitor

appendString, getDefaultAttributes, getText, print

Field Details

labelNames

protected final Map labelNames
The label names. This map associate String values to Label keys.

ltab

protected String ltab
Tab for labels.

mv

protected MethodVisitor mv
The MethodVisitor to which this visitor delegates calls. May be null.

tab2

protected String tab2
Tab for bytecode instructions.

tab3

protected String tab3
Tab for table and lookup switch instructions.

Constructor Details

TraceMethodVisitor

public TraceMethodVisitor()

TraceMethodVisitor

public TraceMethodVisitor(MethodVisitor mv)
Constructs a new TraceMethodVisitor.
Parameters:
mv - the MethodVisitor to which this visitor delegates calls. May be null.

Method Details

appendLabel

protected void appendLabel(Label l)
Appends the name of the given label to buf. Creates a new label name if the given label does not yet have one.
Parameters:
l - a label.

visitAnnotation

public AnnotationVisitor visitAnnotation(String desc,
                                         boolean visible)
Specified by:
visitAnnotation in interface MethodVisitor
Overrides:
visitAnnotation in interface TraceAbstractVisitor

visitAnnotationDefault

public AnnotationVisitor visitAnnotationDefault()
Specified by:
visitAnnotationDefault in interface MethodVisitor

visitAttribute

public void visitAttribute(Attribute attr)
Specified by:
visitAttribute in interface MethodVisitor
Overrides:
visitAttribute in interface TraceAbstractVisitor

visitCode

public void visitCode()
Specified by:
visitCode in interface MethodVisitor

visitEnd

public void visitEnd()
Specified by:
visitEnd in interface MethodVisitor
Overrides:
visitEnd in interface TraceAbstractVisitor

visitFieldInsn

public void visitFieldInsn(int opcode,
                           String owner,
                           String name,
                           String desc)
Specified by:
visitFieldInsn in interface MethodVisitor

visitFrame

public void visitFrame(int type,
                       int nLocal,
                       Object[] local,
                       int nStack,
                       Object[] stack)
Specified by:
visitFrame in interface MethodVisitor

visitIincInsn

public void visitIincInsn(int var,
                          int increment)
Specified by:
visitIincInsn in interface MethodVisitor

visitInsn

public void visitInsn(int opcode)
Specified by:
visitInsn in interface MethodVisitor

visitIntInsn

public void visitIntInsn(int opcode,
                         int operand)
Specified by:
visitIntInsn in interface MethodVisitor

visitJumpInsn

public void visitJumpInsn(int opcode,
                          Label label)
Specified by:
visitJumpInsn in interface MethodVisitor

visitLabel

public void visitLabel(Label label)
Specified by:
visitLabel in interface MethodVisitor

visitLdcInsn

public void visitLdcInsn(Object cst)
Specified by:
visitLdcInsn in interface MethodVisitor

visitLineNumber

public void visitLineNumber(int line,
                            Label start)
Specified by:
visitLineNumber in interface MethodVisitor

visitLocalVariable

public void visitLocalVariable(String name,
                               String desc,
                               String signature,
                               Label start,
                               Label end,
                               int index)
Specified by:
visitLocalVariable in interface MethodVisitor

visitLookupSwitchInsn

public void visitLookupSwitchInsn(Label dflt,
                                  int[] keys,
                                  Label[] labels)
Specified by:
visitLookupSwitchInsn in interface MethodVisitor

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Specified by:
visitMaxs in interface MethodVisitor

visitMethodInsn

public void visitMethodInsn(int opcode,
                            String owner,
                            String name,
                            String desc)
Specified by:
visitMethodInsn in interface MethodVisitor

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(String desc,
                                    int dims)
Specified by:
visitMultiANewArrayInsn in interface MethodVisitor

visitParameterAnnotation

public AnnotationVisitor visitParameterAnnotation(int parameter,
                                                  String desc,
                                                  boolean visible)
Specified by:
visitParameterAnnotation in interface MethodVisitor

visitTableSwitchInsn

public void visitTableSwitchInsn(int min,
                                 int max,
                                 Label dflt,
                                 Label[] labels)
Specified by:
visitTableSwitchInsn in interface MethodVisitor

visitTryCatchBlock

public void visitTryCatchBlock(Label start,
                               Label end,
                               Label handler,
                               String type)
Specified by:
visitTryCatchBlock in interface MethodVisitor

visitTypeInsn

public void visitTypeInsn(int opcode,
                          String type)
Specified by:
visitTypeInsn in interface MethodVisitor

visitVarInsn

public void visitVarInsn(int opcode,
                         int var)
Specified by:
visitVarInsn in interface MethodVisitor