Chapter 9. Debugger

Table of Contents

Using the Debugger
Breakpoints
Interactions at a Breakpoint
Stepping and Resuming
Debug Panel
Detachable Debug Panel

DrJava provides advanced tools for debugging your programs in the Interactions Pane. You can set breakpoints in source files in the Definitions Pane, call methods that stop at the breakpoints in the Interactions Pane, and then interact with programs while they are suspended at breakpoints. Once a breakpoint is reached, users can interact with any variables, fields, or methods that are in scope in the suspended method. Users can also resume the method call, or step through it a line at a time. Finally, the values of local variables and fields can be watched in a table as the method call progresses.

Using the Debugger

To use DrJava's debugger, select the "Debug Mode" command from the Debugger menu. An informational panel will be displayed between the Definitions Pane and the Interactions Pane, and several menu items in the Debugger menu will become enabled.

A Note on Modifying Files. When using the debugger, it is essential to remember that any modifications to source files will not be reflected in the behavior of the Interactions Pane or the debugger until the classes are recompiled. Changing a source file while the debugger is running is not recommended, since lines which are highlighted by the debugger may no longer correspond to the lines in the running class file. To help notify you of this danger, DrJava displays a warning message in the Debug Panel if the current document is out of sync with its class file.

Because the debugger depends on the classes used in the Interactions Pane, the debugger is automatically reset each time any files are compiled, or when the Interactions Pane is reset.