|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.futureshocked.classloader.ApplicationDebugger
public class ApplicationDebugger
ApplicationDebugger provides an easy way to intercept and modify
classes for debugging purposes.
To debug an application, a class name and a String array of
arguments are passed in the constuctor, methods to intercept are specified
using the addMethod() methods, and finally run() is called, which will
invoke main() on the user specified class.
Field Summary | |
---|---|
protected java.lang.String[] |
args
The String array passed to the main method of className |
protected java.lang.ClassLoader |
cl
An instance of DebuggerClassLoader |
protected java.lang.String |
className
The name of the class which contains the main() method to be invoked |
protected ClassTransforms |
ct
Collection of InterceptedMethod |
protected static int |
defaultDebugDepth
The default maximum recursive depth for StaticDebugger.printDebugInformation |
protected static int |
defaultRecursionDepth
The default maximum recursive depth for limited recursion |
protected int |
maxDebugDepth
The maximum recursive depth when StaticDebugger.printDebugInformation is called |
protected int |
maxRecursionDepth
The maximum recursive depth when the limited recursion feature is used |
protected boolean |
verbose
Prints debugging information when set to true |
Constructor Summary | |
---|---|
ApplicationDebugger(java.lang.String name,
java.lang.String[] args)
Constructor that will set maxDebugDepth and maxRecursiveDepth to their defaults. |
|
ApplicationDebugger(java.lang.String name,
java.lang.String[] args,
int maxDebugDepth,
int maxRecursionDepth)
Constructor that will set maxDebugDepth and maxRecursiveDepth to user specified values. |
Method Summary | |
---|---|
InterceptedMethod |
addCodeStyleMethod(java.lang.String code,
boolean callStatic,
boolean limitRecursion)
An easier way to add a method to be intercepted by DebuggerClassLoader. |
InterceptedMethod |
addMethod(java.lang.String clazz,
java.lang.String method,
boolean callStatic,
boolean limitRecursion)
Adds a method to be intercepted by DebuggerClassLoader. |
InterceptedMethod |
addMethod(java.lang.String clazz,
java.lang.String method,
java.lang.String desc,
boolean callStatic,
boolean limitRecursion)
Adds a method to be intercepted by DebuggerClassLoader. |
int |
getMaxDebugDepth()
|
int |
getMaxRecursionDepth()
|
boolean |
getVerbose()
|
static void |
main(java.lang.String[] args)
|
void |
run()
Creates a new classloader and invokes main on ApplicationDebugger.className. |
void |
setMaxDebugDepth(int depth)
|
void |
setMaxRecursionDepth(int depth)
|
void |
setVerbose(boolean verbose)
|
void |
unloadClassLoader()
Unloads the classloader - this will unload all classes loaded by the classloader, allowing any recompiled classes to be reloaded back into memory without restarting the application. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.ClassLoader cl
protected ClassTransforms ct
protected java.lang.String className
protected java.lang.String[] args
protected int maxDebugDepth
protected static final int defaultDebugDepth
protected int maxRecursionDepth
protected static final int defaultRecursionDepth
protected boolean verbose
Constructor Detail |
---|
public ApplicationDebugger(java.lang.String name, java.lang.String[] args)
name
- Class name to be loaded, must contain a main method.args
- Arguments to be passed to the main method.public ApplicationDebugger(java.lang.String name, java.lang.String[] args, int maxDebugDepth, int maxRecursionDepth)
name
- Class name to be loaded, must contain a main method.args
- Arguments to be passed to the main method.maxDebugDepth
- Maximum depth for StaticDebugger.maxRecursionDepth
- Maximum recusion depth for limited recursion.Method Detail |
---|
public void run() throws java.lang.Exception
java.lang.Exception
- Most likely from the user specified application, though
it might be a ClassNotFound exception.public void unloadClassLoader()
public InterceptedMethod addMethod(java.lang.String clazz, java.lang.String method, boolean callStatic, boolean limitRecursion)
InterceptedMethod
will match
all overloaded methods that match this method name.
clazz
- The name of the class the method belongs to. Should include
full package name too.method
- The name of the method to be intercepted.callStatic
- true to add a call to
StaticDebugger.printDebugInformation.limitRecursion
- true to limit the amount of times this
method may call itself.
InterceptedMethod
that will match these values.public InterceptedMethod addMethod(java.lang.String clazz, java.lang.String method, java.lang.String desc, boolean callStatic, boolean limitRecursion)
clazz
- The name of the class the method belongs to. Should include
full package name too.method
- The name of the method to be intercepted.desc
- The description of the method, per ASM specs.callStatic
- true to add a call to
StaticDebugger.printDebugInformation.limitRecursion
- true to limit the amount of times this
method may call itself.
InterceptedMethod
that will match these values.public InterceptedMethod addCodeStyleMethod(java.lang.String code, boolean callStatic, boolean limitRecursion)
code
- A method declaration as taken from the code, but with package
names added for all Objects. callStatic
- callStatic true to add a call to
StaticDebugger.printDebugInformation.limitRecursion
- true to limit the amount of times this
method may call itself.
InterceptedMethod
that will match these values.public int getMaxDebugDepth()
public void setMaxDebugDepth(int depth)
public int getMaxRecursionDepth()
public void setMaxRecursionDepth(int depth)
public void setVerbose(boolean verbose)
public boolean getVerbose()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |