Once execution of your program is paused, you have several ways of resuming execution of the code. You can step through the code line by line (Step In) or in greater increments. See Table 7-4 for the commands available for stepping or continuing execution and the following subtopics for a task-based look at the commands.
Executing Code Line by LineYou can have the debugger step a line at a time by choosing Run | Step Into (F7). If you use the Step Into command on a method call, the debugger enters the method and pauses at the first line, unless the method is part of a library that you have not specified for use in the debugger. See Stepping into the JDK and Other Libraries later in this chapter for details on making sources available for use in the debugger. Executing a Method without Stepping into ItYou can execute a method without having the debugger pause within the method by choosing Run | Step Over (F8). After you use the Step Over command, the debugger pauses again at the line after the method call. Resuming Execution through the End of a MethodIf you have stepped into a method that you do not need to continue analyzing, you can have the debugger complete execution of the method and then pause again at the line after the method call. To complete execution of a method in this way, choose Run | Step Out Of (Alt-Shift-F7). Continuing to the Next BreakpointIf you do not need to observe every line of code while you are debugging, you can continue execution until the next breakpoint or until execution is otherwise suspended. To continue execution of a program that has been suspended at a breakpoint, choose Run | Continue or press Ctrl-F5. Continuing to the Cursor PositionWhen execution is suspended, you can continue to a specific line without setting a breakpoint by placing the cursor in that line and choosing Run | Run to Cursor (F4). Stepping into the JDK and Other LibrariesWhen you are debugging, you can step into the code for the JDK and any other libraries if you have the source code that is associated with them registered in the IDE's Library Manager. See Making External Sources and Javadoc Available in the IDE in Chapter 3 for information on associating source code with a library. By default, the IDE does not step into JDK sources when you are debugging. If you use the Step In command on a JDK method call, the IDE executes the method and returns the program counter to the line after the method call (as though you used the Step Over command). To enable stepping into JDK sources for a debugged application:
Limiting the Classes That You Can Step into for a LibraryIf you are using a library for debugging, you can set a filter to exclude some of the sources from being used. To exclude classes from being used in the debugger:
The filter can be
You can create multiple class exclusion filters. To disable the filter, deselect the Use in Debugging checkbox next to the filter in the Sources window. To delete a class exclusion filter, right-click the filter and choose Delete. |