|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rice.cs.drjava.model.debug.jpda.JPDADebugger
public class JPDADebugger
An integrated debugger which attaches to the Interactions JVM using Sun's Java Platform Debugger Architecture (JPDA/JDI) interface. Every public method in this class throws an llegalStateException if it is called while the debugger is not active, except for isAvailable, isReady, and startUp. Public methods also throw a DebugException if the EventHandlerThread has caught an exception.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface edu.rice.cs.drjava.model.debug.Debugger |
---|
Debugger.StepType |
Constructor Summary | |
---|---|
JPDADebugger(GlobalModel model)
Builds a new JPDADebugger to debug code in the Interactions JVM, using the JPDA/JDI interfaces. |
Method Summary | |
---|---|
void |
addListener(DebugListener listener)
Adds a listener to this JPDADebugger. |
void |
addWatch(String field)
Adds a watch on the given field or variable. |
DebugModelCallback |
callback()
|
Breakpoint |
getBreakpoint(int line,
String className)
Gets the Breakpoint object at the specified line in the given class. |
ArrayList<DebugStackData> |
getCurrentStackFrameData()
Returns a Vector of DebugStackData for the current suspended thread. |
ArrayList<DebugThreadData> |
getCurrentThreadData()
Returns a list of all threads being tracked by the debugger. |
ArrayList<DebugWatchData> |
getWatches()
Returns all currently watched fields and variables. |
boolean |
hasRunningThread()
Returns whether the thread the debugger is tracking is now running. |
boolean |
hasSuspendedThreads()
Returns whether the debugger currently has any suspended threads. |
boolean |
isAvailable()
Returns whether the debugger is available in this copy of DrJava. |
boolean |
isCurrentThreadSuspended()
Returns whether the debugger's current thread is suspended. |
boolean |
isReady()
Returns whether the debugger is currently enabled. |
void |
notifyBreakpointChange(Breakpoint breakpoint)
Enable or disable the specified breakpoint. |
OpenDefinitionsDocument |
preloadDocument(com.sun.jdi.Location location)
Return the document associated with this location. |
void |
removeAllWatches()
Removes all watches on existing fields and variables. |
void |
removeBreakpoint(Breakpoint bp)
Removes a breakpoint. |
void |
removeListener(DebugListener listener)
Removes a listener to this JPDADebugger. |
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 the thread currently being debugged, copying back all variables from the current debug interpreter. |
void |
resume(DebugThreadData threadData)
Resumes the given thread, copying back any variables from its associated debug interpreter. |
void |
scrollToSource(Breakpoint bp)
Scrolls to the source of the given breakpoint. |
void |
scrollToSource(DebugStackData stackData)
Scrolls to the source location specified by the the debug stack data. |
void |
setBreakpoint(Breakpoint breakpoint)
Sets a breakpoint. |
void |
setCurrentThread(DebugThreadData threadData)
Sets the notion of current thread to the one contained in threadData. |
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(Debugger.StepType type)
Steps the execution of the currently loaded document. |
boolean |
toggleBreakpoint(OpenDefinitionsDocument doc,
int offset,
int lineNum,
boolean isEnabled)
Toggles whether a breakpoint is set at the given line in the given document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JPDADebugger(GlobalModel model)
Method Detail |
---|
public void addListener(DebugListener listener)
addListener
in interface Debugger
listener
- a listener that reacts on events generated by the JPDADebuggerpublic void removeListener(DebugListener listener)
removeListener
in interface Debugger
listener
- listener to removepublic boolean isAvailable()
isAvailable
in interface Debugger
public DebugModelCallback callback()
callback
in interface Debugger
public boolean isReady()
isReady
in interface Debugger
public void startUp() throws DebugException
startUp
in interface Debugger
DebugException
public void shutdown()
shutdown
in interface Debugger
IllegalStateException
- if debugger is not readypublic void setCurrentThread(DebugThreadData threadData) throws DebugException
setCurrentThread
in interface Debugger
threadData
- The Thread to set as current.
IllegalStateException
- if debugger is not ready
IllegalArgumentException
- if threadData is null or not suspended
DebugException
public boolean hasSuspendedThreads() throws DebugException
hasSuspendedThreads
in interface Debugger
DebugException
public boolean isCurrentThreadSuspended() throws DebugException
isCurrentThreadSuspended
in interface Debugger
DebugException
public boolean hasRunningThread() throws DebugException
hasRunningThread
in interface Debugger
DebugException
public void resume() throws DebugException
resume
in interface Debugger
DebugException
public void resume(DebugThreadData threadData) throws DebugException
resume
in interface Debugger
threadData
- Thread to resume
DebugException
public void step(Debugger.StepType type) throws DebugException
step
in interface Debugger
DebugException
public void addWatch(String field) throws DebugException
addWatch
in interface Debugger
field
- the name of the field we will watch
DebugException
public void removeWatch(String field) throws DebugException
removeWatch
in interface Debugger
field
- the name of the field we will watch
DebugException
public void removeWatch(int index) throws DebugException
removeWatch
in interface Debugger
index
- Index of the watch to remove
DebugException
public void removeAllWatches() throws DebugException
removeAllWatches
in interface Debugger
DebugException
public void notifyBreakpointChange(Breakpoint breakpoint)
breakpoint
- breakpoint to changepublic boolean toggleBreakpoint(OpenDefinitionsDocument doc, int offset, int lineNum, boolean isEnabled) throws DebugException
toggleBreakpoint
in interface Debugger
doc
- Document in which to set or remove the breakpointoffset
- Start offset on the line to set the breakpointlineNum
- Line on which to set or remove the breakpoint, >=1isEnabled
- true
if this breakpoint should be enabled
DebugException
public void setBreakpoint(Breakpoint breakpoint) throws DebugException
setBreakpoint
in interface Debugger
breakpoint
- The new breakpoint to set
DebugException
public void removeBreakpoint(Breakpoint bp) throws DebugException
removeBreakpoint
in interface Debugger
bp
- The breakpoint to remove.
DebugException
public ArrayList<DebugWatchData> getWatches() throws DebugException
getWatches
in interface Debugger
DebugException
public ArrayList<DebugThreadData> getCurrentThreadData() throws DebugException
getCurrentThreadData
in interface Debugger
DebugException
public ArrayList<DebugStackData> getCurrentStackFrameData() throws DebugException
getCurrentStackFrameData
in interface Debugger
DebugException
- if the current thread is running or there
are no suspended threads
TO DO: Config option for hiding DrJava subset of stack tracepublic OpenDefinitionsDocument preloadDocument(com.sun.jdi.Location location)
public void scrollToSource(DebugStackData stackData) throws DebugException
scrollToSource
in interface Debugger
stackData
- Stack data containing location to display
DebugException
- if current thread is not suspendedpublic void scrollToSource(Breakpoint bp)
scrollToSource
in interface Debugger
bp
- the breakpointpublic Breakpoint getBreakpoint(int line, String className)
getBreakpoint
in interface Debugger
line
- The line number of the breakpointclassName
- The name of the class the breakpoint's in
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |