Java Doc for JPDADebugger.java in  » IDE » DrJava » edu » rice » cs » drjava » model » debug » jpda » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » DrJava » edu.rice.cs.drjava.model.debug.jpda 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   edu.rice.cs.drjava.model.debug.jpda.JPDADebugger

JPDADebugger
public class JPDADebugger implements Debugger(Code)
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.
version:
   $Id: JPDADebugger.java 4255 2007-08-28 19:17:37Z mgricken $


Field Summary
final  DebugEventNotifier_notifier
     Provides a way for the JPDADebugger to communicate with the view.

Constructor Summary
public  JPDADebugger(GlobalModel model)
     Builds a new JPDADebugger to debug code in the Interactions JVM, using the JPDA/JDI interfaces.

Method Summary
public  voidaddListener(DebugListener listener)
     Adds a listener to this JPDADebugger.
public synchronized  voidaddWatch(String field)
     Adds a watch on the given field or variable.
public  DebugModelCallbackcallback()
    
synchronized  voidcurrThreadDied()
     Notifies all listeners that the current thread has died.
synchronized  voidcurrThreadSuspended()
     Notifies all listeners that the current thread has been suspended.
 voideventHandlerError(Throwable t)
     Records that an error occurred in the EventHandlerThread.
public synchronized  BreakpointgetBreakpoint(int line, String className)
     Gets the Breakpoint object at the specified line in the given class.
 ThreadReferencegetCurrentRunningThread()
     Returns the running thread currently tracked by the debugger.
public synchronized  Vector<DebugStackData>getCurrentStackFrameData()
     Returns a Vector of DebugStackData for the current suspended thread.
 ThreadReferencegetCurrentThread()
     Returns the currently selected thread for the debugger.
public synchronized  Vector<DebugThreadData>getCurrentThreadData()
     Returns a list of all threads being tracked by the debugger.
 EventRequestManagergetEventRequestManager()
     Returns the current EventRequestManager from JDI, or null if startUp() has not been called.
static  StringgetPackageDir(String className)
     Returns the relative directory (from the source root) that the source file with this qualifed name will be in, given its package.
 PendingRequestManagergetPendingRequestManager()
     Returns the pending request manager used by the debugger.
 Vector<ReferenceType>getReferenceTypes(String className)
     Returns a Vector with all the loaded ReferenceTypes for the given class name (empty if the class could not be found).
synchronized  Vector<ReferenceType>getReferenceTypes(String className, int lineNumber)
     Returns a Vector with the loaded ReferenceTypes for the given class name (empty if the class could not be found).
 ThreadReferencegetThreadAt(int i)
     Returns the suspended thread at the current index of the stack.
 VirtualMachinegetVM()
     Accessor for the _vm field.
public  Vector<DebugWatchData>getWatches()
     Returns all currently watched fields and variables.
public synchronized  booleanhasRunningThread()
     Returns whether the thread the debugger is tracking is now running.
public synchronized  booleanhasSuspendedThreads()
     Returns whether the debugger currently has any suspended threads.
public  booleanisAvailable()
     Returns whether the debugger is available in this copy of DrJava.
public synchronized  booleanisCurrentThreadSuspended()
     Returns whether the debugger's current thread is suspended.
public  booleanisReady()
     Returns whether the debugger is currently enabled.
 voidnonCurrThreadDied()
    
public synchronized  voidnotifyBreakpointChange(Breakpoint breakpoint)
     Enable or disable the specified breakpoint.
 voidnotifyDebuggerShutdown()
     Notifies all listeners that the debugger has shut down.
 voidnotifyDebuggerStarted()
     Notifies all listeners that the debugger has started.
 voidnotifyStepRequested()
     Notifies all listeners that a step has been requested.
public  OpenDefinitionsDocumentpreloadDocument(Location location)
     Return the document associated with this location.
 voidprintMessage(String message)
     Prints a message in the Interactions Pane.
synchronized  voidreachedBreakpoint(BreakpointRequest request)
     Called when a breakpoint is reached.
public synchronized  voidremoveAllWatches()
     Removes all watches on existing fields and variables.
public synchronized  voidremoveBreakpoint(Breakpoint bp)
     Removes a breakpoint.
public  voidremoveListener(DebugListener listener)
     Removes a listener to this JPDADebugger.
public synchronized  voidremoveWatch(String field)
     Removes any watches on the given field or variable.
public synchronized  voidremoveWatch(int index)
     Removes the watch at the given index.
public synchronized  voidresume()
     Resumes the thread currently being debugged, copying back all variables from the current debug interpreter.
public synchronized  voidresume(DebugThreadData threadData)
     Resumes the given thread, copying back any variables from its associated debug interpreter.
public synchronized  voidscrollToSource(DebugStackData stackData)
     Scrolls to the source location specified by the the debug stack data.
public synchronized  voidscrollToSource(Breakpoint bp)
     Scrolls to the source of the given breakpoint.
public synchronized  voidsetBreakpoint(Breakpoint breakpoint)
     Sets a breakpoint.
synchronized  booleansetCurrentThread(ThreadReference thread)
     Sets the debugger's currently active thread. This method assumes that the given thread is already suspended. Returns true if this actually changed the suspended thread by pushing it onto the stack of suspended threads.
public synchronized  voidsetCurrentThread(DebugThreadData threadData)
     Sets the notion of current thread to the one contained in threadData.
public synchronized  voidshutdown()
     Disconnects the debugger from the Interactions JVM and cleans up any state.
public synchronized  voidstartUp()
     Attaches the debugger to the Interactions JVM to prepare for debugging.
public synchronized  voidstep(StepType type)
     Steps the execution of the currently loaded document.
 voidthreadStarted()
     Not synchronized because invokeLater is asynchronous.
public synchronized  voidtoggleBreakpoint(OpenDefinitionsDocument doc, int offset, int lineNum, boolean isEnabled)
     Toggles whether a breakpoint is set at the given line in the given document.

Field Detail
_notifier
final DebugEventNotifier _notifier(Code)
Provides a way for the JPDADebugger to communicate with the view.




Constructor Detail
JPDADebugger
public JPDADebugger(GlobalModel model)(Code)
Builds a new JPDADebugger to debug code in the Interactions JVM, using the JPDA/JDI interfaces. Does not actually connect to the interpreterJVM until startUp().




Method Detail
addListener
public void addListener(DebugListener listener)(Code)
Adds a listener to this JPDADebugger.
Parameters:
  listener - a listener that reacts on events generated by the JPDADebugger



addWatch
public synchronized void addWatch(String field) throws DebugException(Code)
Adds a watch on the given field or variable.
Parameters:
  field - the name of the field we will watch



callback
public DebugModelCallback callback()(Code)



currThreadDied
synchronized void currThreadDied() throws DebugException(Code)
Notifies all listeners that the current thread has died. updateThreads is set to true if the threads and stack tables need to be updated, false if there are no suspended threads



currThreadSuspended
synchronized void currThreadSuspended()(Code)
Notifies all listeners that the current thread has been suspended. Synchronization is necessary because it is called from unsynchronized listeners and other classes (in same package).



eventHandlerError
void eventHandlerError(Throwable t)(Code)
Records that an error occurred in the EventHandlerThread. The next call to _ensureReady() will fail, indicating that the error occurred. Not private because EventHandlerThread accesses it.
Parameters:
  t - Error occurring in the EventHandlerThread



getBreakpoint
public synchronized Breakpoint getBreakpoint(int line, String className)(Code)
Gets the Breakpoint object at the specified line in the given class. If the given data do not correspond to an actual breakpoint, null is returned.
Parameters:
  line - the line number of the breakpoint
Parameters:
  className - the name of the class the breakpoint's in the Breakpoint corresponding to the line and className, or null ifthere is no such breakpoint.



getCurrentRunningThread
ThreadReference getCurrentRunningThread()(Code)
Returns the running thread currently tracked by the debugger.



getCurrentStackFrameData
public synchronized Vector<DebugStackData> getCurrentStackFrameData() throws DebugException(Code)
Returns a Vector of DebugStackData for the current suspended thread.
throws:
  DebugException - if the current thread is running or thereare no suspended threadsTO DO: Config option for hiding DrJava subset of stack trace



getCurrentThread
ThreadReference getCurrentThread()(Code)
Returns the currently selected thread for the debugger.



getCurrentThreadData
public synchronized Vector<DebugThreadData> getCurrentThreadData() throws DebugException(Code)
Returns a list of all threads being tracked by the debugger. Does not return any threads known to be dead.



getEventRequestManager
EventRequestManager getEventRequestManager()(Code)
Returns the current EventRequestManager from JDI, or null if startUp() has not been called.



getPackageDir
static String getPackageDir(String className)(Code)
Returns the relative directory (from the source root) that the source file with this qualifed name will be in, given its package. Returns the empty string for classes without packages. TO DO: Move this to a static utility class
Parameters:
  className - The fully qualified class name



getPendingRequestManager
PendingRequestManager getPendingRequestManager()(Code)
Returns the pending request manager used by the debugger.



getReferenceTypes
Vector<ReferenceType> getReferenceTypes(String className)(Code)
Returns a Vector with all the loaded ReferenceTypes for the given class name (empty if the class could not be found). Makes no attempt to load the class if it is not already loaded.

If custom class loaders are in use, multiple copies of the class may be loaded, so all are returned.




getReferenceTypes
synchronized Vector<ReferenceType> getReferenceTypes(String className, int lineNumber)(Code)
Returns a Vector with the loaded ReferenceTypes for the given class name (empty if the class could not be found). Makes no attempt to load the class if it is not already loaded. If the lineNumber is not DebugAction.ANY_LINE, this method ensures that the returned ReferenceTypes contain the given lineNumber, searching through inner classes if necessary. If no inner classes contain the line number, an empty Vector is returned.

If custom class loaders are in use, multiple copies of the class may be loaded, so all are returned.




getThreadAt
ThreadReference getThreadAt(int i)(Code)
Returns the suspended thread at the current index of the stack.
Parameters:
  i - index into the stack of suspended threads



getVM
VirtualMachine getVM()(Code)
Accessor for the _vm field. Called from DocumentDebugAction and this.



getWatches
public Vector<DebugWatchData> getWatches() throws DebugException(Code)
Returns all currently watched fields and variables. No synchronization required because _watches is final.



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



hasSuspendedThreads
public synchronized boolean hasSuspendedThreads() throws DebugException(Code)
Returns whether the debugger currently has any suspended threads.



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



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



isReady
public boolean isReady()(Code)
Returns whether the debugger is currently enabled.



nonCurrThreadDied
void nonCurrThreadDied()(Code)



notifyBreakpointChange
public synchronized void notifyBreakpointChange(Breakpoint breakpoint)(Code)
Enable or disable the specified breakpoint.
Parameters:
  breakpoint - breakpoint to change



notifyDebuggerShutdown
void notifyDebuggerShutdown()(Code)
Notifies all listeners that the debugger has shut down. updateThreads is set to true if the threads and stack tables need to be updated, false if there are no suspended threads



notifyDebuggerStarted
void notifyDebuggerStarted()(Code)
Notifies all listeners that the debugger has started.



notifyStepRequested
void notifyStepRequested()(Code)
Notifies all listeners that a step has been requested.



preloadDocument
public OpenDefinitionsDocument preloadDocument(Location location)(Code)
Return the document associated with this location. A document is preloaded when a debugger step is made to avoid the deadlock described in [ 1696060 ] Debugger Infinite Loop.



printMessage
void printMessage(String message)(Code)
Prints a message in the Interactions Pane. Not synchronized on this on this because no local state is accessed.
Parameters:
  message - Message to display



reachedBreakpoint
synchronized void reachedBreakpoint(BreakpointRequest request)(Code)
Called when a breakpoint is reached. The Breakpoint object itself should be stored in the "debugAction" property on the request.
Parameters:
  request - The BreakPointRequest reached by the debugger



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



removeBreakpoint
public synchronized void removeBreakpoint(Breakpoint bp) throws DebugException(Code)
Removes a breakpoint. Called from toggleBreakpoint -- even with BPs that are not active.
Parameters:
  breakpoint - The breakpoint to remove.



removeListener
public void removeListener(DebugListener listener)(Code)
Removes a listener to this JPDADebugger.
Parameters:
  listener - listener to remove



removeWatch
public synchronized void removeWatch(String field) throws DebugException(Code)
Removes any watches on the given field or variable. Has no effect if the given field is not being watched.
Parameters:
  field - the name of the field we will watch



removeWatch
public synchronized void removeWatch(int index) throws DebugException(Code)
Removes the watch at the given index.
Parameters:
  index - Index of the watch to remove



resume
public synchronized void resume() throws DebugException(Code)
Resumes the thread currently being debugged, copying back all variables from the current debug interpreter.



resume
public synchronized void resume(DebugThreadData threadData) throws DebugException(Code)
Resumes the given thread, copying back any variables from its associated debug interpreter.
Parameters:
  threadData - Thread to resume



scrollToSource
public synchronized void scrollToSource(DebugStackData stackData) throws DebugException(Code)
Scrolls to the source location specified by the the debug stack data.
Parameters:
  stackData - Stack data containing location to display
throws:
  DebugException - if current thread is not suspended



scrollToSource
public synchronized void scrollToSource(Breakpoint bp)(Code)
Scrolls to the source of the given breakpoint.
Parameters:
  bp - the breakpoint



setBreakpoint
public synchronized void setBreakpoint(Breakpoint breakpoint) throws DebugException(Code)
Sets a breakpoint.
Parameters:
  breakpoint - The new breakpoint to set



setCurrentThread
synchronized boolean setCurrentThread(ThreadReference thread)(Code)
Sets the debugger's currently active thread. This method assumes that the given thread is already suspended. Returns true if this actually changed the suspended thread by pushing it onto the stack of suspended threads. Returns false if this thread was already selected. The return value fixes a bug that occurs if the user steps into a breakpoint.
throws:
  IllegalArgumentException - if thread is not suspended.



setCurrentThread
public synchronized void setCurrentThread(DebugThreadData threadData) throws DebugException(Code)
Sets the notion of current thread to the one contained in threadData. The thread must be suspended. (Note: the intention is for this method to suspend the thread if necessary, but this is not yet implemented. The catch is that any manually suspended threads won't cooperate with the debug interpreters; the thread must be suspended by a breakpoint or step.)
Parameters:
  threadData - Thread to set as current
throws:
  IllegalStateException - if debugger is not ready
throws:
  IllegalArgumentException - if threadData is null or not suspended



shutdown
public synchronized void shutdown()(Code)
Disconnects the debugger from the Interactions JVM and cleans up any state.
throws:
  IllegalStateException - if debugger is not ready



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



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



threadStarted
void threadStarted()(Code)
Not synchronized because invokeLater is asynchronous.



toggleBreakpoint
public synchronized void toggleBreakpoint(OpenDefinitionsDocument doc, int offset, int lineNum, boolean isEnabled) throws DebugException(Code)
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
Parameters:
  offset - Start offset on the line to set the breakpoint
Parameters:
  lineNum - Line on which to set or remove the breakpoint, >=1
Parameters:
  isEnabled - true if this breakpoint should be enabled



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

w___ww__.___j__a__va__2s__.___com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.