|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.asm.ClassAdapter
com.futureshocked.classloader.DebuggerClassVisitor
public class DebuggerClassVisitor
An org.objectweb.asm.ClassAdapter that will modify classes as
needed. As a class is loaded the appropriate visit*() methods are called
in this class.
By default, an InterceptedMethod
object that requests a static
debugging call will call StaticDebugger.printDebugInformation().
See also: Visitor design pattern.
Nested Class Summary | |
---|---|
(package private) class |
DebuggerClassVisitor.RecursionLimiterMethodAdapter
Inner class that adds recursion limiting instructions to the end of a method. |
Field Summary | |
---|---|
protected java.lang.String |
className
The name of the class currently being visited. |
protected ClassTransforms |
ct
A ClassTransforms that holds InterceptedMethod objects. |
protected java.lang.String |
message
The message to be printed when the recursion limit is exceeded. |
protected java.lang.String |
staticDebugClass
The name of the class that contains a static method to be called for debugging purposes. |
protected java.lang.String |
staticDebugDescription
The description of the static method to be called for debugging. |
protected java.lang.String |
staticDebugMethod
The name of the static method to be called for debugging purposes. |
protected boolean |
verbose
true if debugging information should be displayed. |
Fields inherited from class org.objectweb.asm.ClassAdapter |
---|
cv |
Fields inherited from interface org.objectweb.asm.Opcodes |
---|
AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, V1_1, V1_2, V1_3, V1_4, V1_5 |
Constructor Summary | |
---|---|
DebuggerClassVisitor(org.objectweb.asm.ClassVisitor cv,
java.lang.String className,
ClassTransforms ct,
boolean verbose)
Constructor that sets the appropriate instance variables. |
Method Summary | |
---|---|
org.objectweb.asm.MethodVisitor |
addRecursionLimiter(org.objectweb.asm.MethodVisitor mv,
InterceptedMethod im,
java.lang.String returnType)
Adds a recursion limit to a recursive limit - keeps recursive methods that are buggy from causing a stack overflow. |
org.objectweb.asm.MethodVisitor |
addStaticDebuggerCall(org.objectweb.asm.MethodVisitor mv,
InterceptedMethod im)
Adds the bytecode to call the static debugger. |
private java.lang.String |
getFieldNameByMethod(java.lang.String method)
Returns the name of the field that holds the current recursion count for the method. |
private java.lang.String |
getReturnTypeFromDescription(java.lang.String desc)
Parses the return type from the method description. |
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
visit() is called when a class is first created. |
org.objectweb.asm.MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
Called for every method in a class. |
Methods inherited from class org.objectweb.asm.ClassAdapter |
---|
visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitOuterClass, visitSource |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String className
protected ClassTransforms ct
ClassTransforms
that holds InterceptedMethod
objects.
protected boolean verbose
protected java.lang.String message
protected java.lang.String staticDebugClass
protected java.lang.String staticDebugMethod
protected java.lang.String staticDebugDescription
ApplicationDebugger
for
an example.
Constructor Detail |
---|
public DebuggerClassVisitor(org.objectweb.asm.ClassVisitor cv, java.lang.String className, ClassTransforms ct, boolean verbose)
cv
- A ClassVisitor or ClassWriter that has already
been created.className
- The name of the class being visited.ct
- Container for InterceptedMethod
objects.verbose
- true if debugging info should be displayed.Method Detail |
---|
public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
visit
in interface org.objectweb.asm.ClassVisitor
visit
in class org.objectweb.asm.ClassAdapter
version
- see ASM documentation.access
- Access flags - see ASM documentation.name
- The name of the class.signature
- The class signature - see ASM documentation.superName
- The name of the parent class - see ASM documentation.interfaces
- Interfaces implemented by this object.public org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
visitMethod
in interface org.objectweb.asm.ClassVisitor
visitMethod
in class org.objectweb.asm.ClassAdapter
access
- Access flags for the method - see ASM documentation.name
- The name of the method.desc
- The description of the method - see ApplicationDebugger
or ASM documentation.signature
- Method signature - see ASM documentation.exceptions
- Exceptions thrown by this method - see ASM documentation.
public org.objectweb.asm.MethodVisitor addStaticDebuggerCall(org.objectweb.asm.MethodVisitor mv, InterceptedMethod im)
mv
- The current MethodVisitorim
- The InterceptedMethod
object that represents the method
that will be modified.
public org.objectweb.asm.MethodVisitor addRecursionLimiter(org.objectweb.asm.MethodVisitor mv, InterceptedMethod im, java.lang.String returnType)
mv
- The current MethodVisitorim
- The InterceptedMethod
object that represents the method
that will be modified.returnType
- The return type of the method being modified - this is
the same type as in ASM description, not full class names such as String.
private java.lang.String getFieldNameByMethod(java.lang.String method)
method
- The method that needs to know it's recursion count.
private java.lang.String getReturnTypeFromDescription(java.lang.String desc)
desc
- The method description - see ApplicationDebugger
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |