- Starting a Debugging Session
- Attaching the Debugger to a Running Application
- Starting the Debugger Outside of the Project's Main Class
- Stepping Through Code
- Setting Breakpoints
- Managing Breakpoints
- Customizing Breakpoint Behavior
- Monitoring Variables and Expressions
- Backing Up from a Method to Its Call
- Monitoring and Controlling Execution of Threads
- Fixing Code During a Debugging Session
- Viewing Multiple Debugger Windows Simultaneously
Monitoring and Controlling Execution of Threads
The IDE's Threads window (Alt-Shift-7), shown in Figure 5-8, enables you to view the status of threads in the currently debugged program. It also enables you to change the thread that is being monitored in other debugger windows (such as Call Stack and Local Variables) and to suspend individual threads. See Table 5-7 for a guide to the icons used in the Threads window.
Figure 5-8 Threads window
Table 5-7. Key to Icons in the Threads Window
Currently monitored thread |
|
Currently monitored thread group |
|
Running thread |
|
Suspended thread |
|
Thread group |
Changing the current thread does not affect the way the program executes.
Switching the Currently Monitored Thread
The contents of the Call Stack and Local Variables windows are dependent on the thread being currently monitored in the debugger (otherwise known as the current thread). To switch the currently monitored thread:
- Open the Threads window by pressing Alt-Shift-7.
- Right-click the thread that you want to monitor and choose Make Current.
Suspending a Single Thread
By default, when your program hits a breakpoint, all threads are suspended. However, you can also configure a breakpoint so that only its thread is suspended when the breakpoint is hit:
- Open the Breakpoints window by pressing Alt-Shift-5.
- In the Breakpoints window, right-click the breakpoint and choose Customize.
- In the Customize Breakpoint dialog box, select Current from the Suspend combo box.
Isolating Debugging to a Single Thread
By default, all threads in the application are executed in the debugger. If you would like to isolate the debugging so that only one thread is run in the debugger:
- Make sure that the thread that you want debugged is designated as the current thread in the Threads window (Alt-Shift-7). The current thread is marked with the icon.
- Open the Sessions window by pressing Alt-Shift-6.
- In the Sessions window, right-click the session's node and choose Scope | Debug Current Thread.