|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.rice.cs.drjava.model.debug.DebugManager
An integrated debugger which attaches to the Interactions JVM using Sun's Java Platform Debugger Architecture (JPDA/JDI) interface.
Inner Class Summary | |
protected class |
DebugManager.EventNotifier
Class model for notifying listeners of an event. |
class |
DebugManager.StackData
|
class |
DebugManager.ThreadData
|
class |
DebugManager.WatchData
Class for keeping track of watched fields and variables. |
static class |
DebugManager.WatchUndefinedValue
|
Field Summary | |
private gj.util.Vector |
_breakpoints
Vector of all current Breakpoints, with and without EventRequests. |
private com.sun.jdi.request.EventRequestManager |
_eventManager
Manages all event requests in JDI. |
private LinkedList |
_listeners
Provides a way for the DebugManager to communicate with the view. |
private GlobalModel |
_model
Reference to DrJava's model. |
private PendingRequestManager |
_pendingRequestManager
Keeps track of any DebugActions whose classes have not yet been loaded, so that EventRequests can be created when the correct ClassPrepareEvent occurs. |
private com.sun.jdi.ThreadReference |
_thread
The Thread that the DebugManager is currently analyzing. |
private com.sun.jdi.VirtualMachine |
_vm
VirtualMachine of the interactions JVM. |
private gj.util.Vector |
_watches
Vector of all current Watches |
static int |
STEP_INTO
|
static int |
STEP_OUT
|
static int |
STEP_OVER
|
Constructor Summary | |
DebugManager(GlobalModel model)
Builds a new DebugManager to debug code in the Interactions JVM, using the JPDA/JDI interfaces. |
Method Summary | |
private void |
_attachToVM()
Handles the details of attaching to the InteractionsJVM. |
private String |
_getValue(com.sun.jdi.Value value)
Takes a jdi Value and gets its String representation |
private void |
_updateWatches()
|
void |
addListener(DebugListener listener)
Adds a listener to this DebugManager. |
void |
addWatch(String field)
Adds a watch on the given field or variable. |
void |
clearCurrentStepRequest()
Called from interactionsEnded in MainFrame in order to clear any current StepRequests that remain. |
(package private) void |
currThreadDied()
Notifies all listeneres that the current thread has died. |
(package private) void |
currThreadResumed()
Notifies all listeners that the current thread has been resumed. |
(package private) void |
currThreadSuspended()
Notifies all listeners that the current thread has been suspended. |
gj.util.Vector |
getBreakpoints()
Returns a Vector |
gj.util.Vector |
getCurrentStackFrameData()
Returns a Vector of StackData for the current thread or null if the current thread is null TO DO: Config option for hiding DrJava subset of stack trace |
(package private) com.sun.jdi.ThreadReference |
getCurrentThread()
Returns the debugger's currently active thread. |
gj.util.Vector |
getCurrentThreadData()
Returns a Vector of ThreadData or null if the vm is null |
(package private) com.sun.jdi.request.EventRequestManager |
getEventRequestManager()
Returns the current EventRequestManager from JDI, or null if startup() has not been called. |
(package private) String |
getPackageDir(String className)
Returns the relative directory (from the source root) that the source file with this qualifed name will be in, given its package. |
(package private) PendingRequestManager |
getPendingRequestManager()
Returns the pending request manager used by the debugger. |
(package private) gj.util.Vector |
getReferenceTypes(String className)
Returns the loaded ReferenceTypes for the given class name, or null if the class could not be found. |
(package private) gj.util.Vector |
getReferenceTypes(String className,
int lineNumber)
Returns the loaded ReferenceTypes for the given class name, or null if the class could not be found. |
gj.util.Vector |
getWatches()
Returns all currently watched fields and variables. |
boolean |
isReady()
Returns the status of the debugger |
(package private) void |
notifyDebuggerShutdown()
Notifies all listeneres that the debugger has shut down. |
(package private) void |
notifyDebuggerStarted()
Notifies all listeneres that the debugger has started. |
protected void |
notifyListeners(DebugManager.EventNotifier n)
Lets the listeners know some event has taken place. |
(package private) void |
notifyStepRequested()
Notifies all listeneres that a step has been requested. |
void |
printBreakpoints()
Prints the list of breakpoints in the current session of DrJava, both pending resolved Breakpoints are listed |
(package private) void |
printMessage(String message)
Prints a message in the Interactions Pane. |
(package private) void |
reachedBreakpoint(com.sun.jdi.request.BreakpointRequest request)
Called when a breakpoint is reached. |
void |
removeAllBreakpoints()
Removes all the breakpoints from the manager's vector of breakpoints. |
void |
removeAllWatches()
Removes all watches on existing fields and variables. |
void |
removeBreakpoint(Breakpoint breakpoint)
Removes a breakpoint. |
void |
removeListener(DebugListener listener)
|
void |
removeWatch(int index)
Removes the watch at the given index. |
void |
removeWatch(String field)
Removes any watches on the given field or variable. |
void |
resume()
Resumes execution of the currently loaded document. |
(package private) void |
scrollToSource(com.sun.jdi.event.LocatableEvent e)
Takes the location of event e, opens the document corresponding to its class and centers the definition pane's view on the appropriate line number |
void |
setBreakpoint(Breakpoint breakpoint)
Sets a breakpoint. |
(package private) void |
setCurrentThread(com.sun.jdi.ThreadReference thread)
Sets the debugger's currently active thread. |
void |
shutdown()
Disconnects the debugger from the Interactions JVM and cleans up any state. |
void |
startup()
Attaches the debugger to the Interactions JVM to prepare for debugging. |
void |
step(int flag)
Steps into the execution of the currently loaded document. |
void |
suspend()
Suspends execution of the currently running document. |
void |
toggleBreakpoint(OpenDefinitionsDocument doc,
int offset,
int lineNum)
Toggles whether a breakpoint is set at the given line in the given document. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int STEP_INTO
public static final int STEP_OVER
public static final int STEP_OUT
private GlobalModel _model
private com.sun.jdi.VirtualMachine _vm
private com.sun.jdi.request.EventRequestManager _eventManager
private gj.util.Vector _breakpoints
private gj.util.Vector _watches
private PendingRequestManager _pendingRequestManager
private LinkedList _listeners
private com.sun.jdi.ThreadReference _thread
Constructor Detail |
public DebugManager(GlobalModel model)
Method Detail |
public void startup() throws DebugException
private void _attachToVM() throws DebugException
public void shutdown()
public boolean isReady()
com.sun.jdi.request.EventRequestManager getEventRequestManager()
PendingRequestManager getPendingRequestManager()
void setCurrentThread(com.sun.jdi.ThreadReference thread)
com.sun.jdi.ThreadReference getCurrentThread()
gj.util.Vector getReferenceTypes(String className)
If custom class loaders are in use, multiple copies of the class may be loaded, so all are returned.
gj.util.Vector getReferenceTypes(String className, int lineNumber)
If custom class loaders are in use, multiple copies of the class may be loaded, so all are returned.
public void suspend()
public void resume()
public void step(int flag) throws DebugException
public void clearCurrentStepRequest()
public void addWatch(String field)
field
- the name of the field we will watchpublic void removeWatch(String field)
field
- the name of the field we will watchpublic void removeWatch(int index)
index
- Index of the watch to removepublic void removeAllWatches()
public void toggleBreakpoint(OpenDefinitionsDocument doc, int offset, int lineNum) throws DebugException
doc
- Document in which to set or remove the breakpointoffset
- Start offset on the line to set the breakpointlineNumber
- Line on which to set or remove the breakpointpublic void setBreakpoint(Breakpoint breakpoint)
breakpoint
- The new breakpoint to setpublic void removeBreakpoint(Breakpoint breakpoint)
breakpoint
- The breakpoint to remove.className
- the name of the class the BP is being removed from.public void removeAllBreakpoints()
void reachedBreakpoint(com.sun.jdi.request.BreakpointRequest request)
request
- The BreakPointRequest reached by the debuggerpublic gj.util.Vector getBreakpoints()
public void printBreakpoints()
public gj.util.Vector getWatches()
public gj.util.Vector getCurrentThreadData()
public gj.util.Vector getCurrentStackFrameData()
void scrollToSource(com.sun.jdi.event.LocatableEvent e)
e
- should be a LocatableEventString getPackageDir(String className)
className
- The fully qualified class namevoid printMessage(String message)
message
- Message to displayprivate void _updateWatches()
private String _getValue(com.sun.jdi.Value value)
value
- the Value whose value is requestedvoid currThreadSuspended()
void currThreadResumed()
void currThreadDied()
void notifyDebuggerShutdown()
void notifyDebuggerStarted()
void notifyStepRequested()
public void addListener(DebugListener listener)
listener
- a listener that reacts on events generated by the DebugManagerpublic void removeListener(DebugListener listener)
protected void notifyListeners(DebugManager.EventNotifier n)
EventNotifier
- n tells the listener what happened
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |