edu.rice.cs.drjava.model.debug
Interface Debugger

All Known Implementing Classes:
JPDADebugger, NoDebuggerAvailable

public interface Debugger

Interface for any debugger implementation to be used by DrJava.

Version:
$Id: Debugger.java 4691 2008-12-02 23:33:27Z dlsmith $

Nested Class Summary
static class Debugger.StepType
           
 
Method Summary
 void addListener(DebugListener listener)
          Adds a listener to this Debugger.
 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 StackData for the current thread.
 ArrayList<DebugThreadData> getCurrentThreadData()
          Returns a Vector of ThreadData.
 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()
           
 boolean isAvailable()
          Returns whether the debugger can be used in this copy of DrJava.
 boolean isCurrentThreadSuspended()
          Returns whether the debugger's current thread is suspended.
 boolean isReady()
          Returns whether the debugger is enabled.
 void removeAllWatches()
          Removes all watches on existing fields and variables.
 void removeBreakpoint(Breakpoint breakpoint)
          Removes a breakpoint.
 void removeListener(DebugListener listener)
          Removes a listener to this Debugger.
 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.
 void resume(DebugThreadData data)
          Resumes execution of the given thread.
 void scrollToSource(Breakpoint bp)
          Scrolls to the source indicated by the given Breakpoint
 void scrollToSource(DebugStackData data)
          Scrolls to the source indicated by the given DebugStackData
 void setBreakpoint(Breakpoint breakpoint)
          Sets a breakpoint.
 void setCurrentThread(DebugThreadData d)
          Sets the current thread we are debugging to the thread referenced by d.
 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.
 

Method Detail

addListener

void addListener(DebugListener listener)
Adds a listener to this Debugger.

Parameters:
listener - a listener that reacts on events generated by the Debugger

removeListener

void removeListener(DebugListener listener)
Removes a listener to this Debugger.

Parameters:
listener - listener to remove

isAvailable

boolean isAvailable()
Returns whether the debugger can be used in this copy of DrJava. This does not indicate whether it is ready to be used, which is indicated by isReady().


callback

DebugModelCallback callback()

startUp

void startUp()
             throws DebugException
Attaches the debugger to the Interactions JVM to prepare for debugging.

Throws:
DebugException

shutdown

void shutdown()
Disconnects the debugger from the Interactions JVM and cleans up any state.


isReady

boolean isReady()
Returns whether the debugger is enabled.


setCurrentThread

void setCurrentThread(DebugThreadData d)
                      throws DebugException
Sets the current thread we are debugging to the thread referenced by d.

Throws:
DebugException

resume

void resume()
            throws DebugException
Resumes execution of the currently loaded document.

Throws:
DebugException

resume

void resume(DebugThreadData data)
            throws DebugException
Resumes execution of the given thread.

Parameters:
data - the DebugThreadData representing the thread to resume
Throws:
DebugException

step

void step(Debugger.StepType type)
          throws DebugException
Steps the execution of the currently loaded document.

Throws:
DebugException

addWatch

void addWatch(String field)
              throws DebugException
Adds a watch on the given field or variable.

Parameters:
field - the name of the field we will watch
Throws:
DebugException

removeWatch

void removeWatch(String field)
                 throws DebugException
Removes any watches on the given field or variable.

Parameters:
field - the name of the field we will watch
Throws:
DebugException

removeWatch

void removeWatch(int index)
                 throws DebugException
Removes the watch at the given index.

Parameters:
index - Index of the watch to remove
Throws:
DebugException

removeAllWatches

void removeAllWatches()
                      throws DebugException
Removes all watches on existing fields and variables.

Throws:
DebugException

toggleBreakpoint

boolean toggleBreakpoint(OpenDefinitionsDocument doc,
                         int offset,
                         int lineNum,
                         boolean isEnabled)
                         throws DebugException
Toggles whether a breakpoint is set at the given line in the given document.

Parameters:
doc - Document in which to set or remove the breakpoint
offset - Start offset on the line to set the breakpoint
lineNum - Line on which to set or remove the breakpoint, >=1
isEnabled - true if this breakpoint should be enabled
Throws:
DebugException

setBreakpoint

void setBreakpoint(Breakpoint breakpoint)
                   throws DebugException
Sets a breakpoint.

Parameters:
breakpoint - The new breakpoint to set
Throws:
DebugException

removeBreakpoint

void removeBreakpoint(Breakpoint breakpoint)
                      throws DebugException
Removes a breakpoint. Called from ToggleBreakpoint -- even with BPs that are not active.

Parameters:
breakpoint - The breakpoint to remove.
Throws:
DebugException

getWatches

ArrayList<DebugWatchData> getWatches()
                                     throws DebugException
Returns all currently watched fields and variables.

Throws:
DebugException

getCurrentThreadData

ArrayList<DebugThreadData> getCurrentThreadData()
                                                throws DebugException
Returns a Vector of ThreadData.

Throws:
DebugException

getCurrentStackFrameData

ArrayList<DebugStackData> getCurrentStackFrameData()
                                                   throws DebugException
Returns a Vector of StackData for the current thread.

Throws:
DebugException

hasSuspendedThreads

boolean hasSuspendedThreads()
                            throws DebugException
Returns:
true if there are any threads in the program currently being debugged which have been suspended (by the user or by hitting a breakpoint).
Throws:
DebugException

hasRunningThread

boolean hasRunningThread()
                         throws DebugException
Returns whether the thread the debugger is tracking is now running.

Throws:
DebugException

isCurrentThreadSuspended

boolean isCurrentThreadSuspended()
                                 throws DebugException
Returns whether the debugger's current thread is suspended.

Throws:
DebugException

scrollToSource

void scrollToSource(DebugStackData data)
                    throws DebugException
Scrolls to the source indicated by the given DebugStackData

Parameters:
data - the DebugStackData representing the source location
Throws:
DebugException

scrollToSource

void scrollToSource(Breakpoint bp)
Scrolls to the source indicated by the given Breakpoint

Parameters:
bp - the Breakpoint representing the source location

getBreakpoint

Breakpoint getBreakpoint(int line,
                         String className)
                         throws DebugException
Gets the Breakpoint object at the specified line in the given class. If the given datThe name of the class the breakpoint's in

Returns:
the Breakpoint corresponding to the line and className, or null if there is no such breakpoint.
Throws:
DebugException