Java Reference
In-Depth Information
Table 6.2
The Debug tool window provides several buttons that are used to control program execution.
Icon
Default shortcut
Description
Rerun Debugger. Launches the program in the debugger again. Available
when your application has stopped and you haven't closed the Debug window.
Ctrl+F5
Resume Program. Continues running the program following a suspension in
execution. The program will continue to run until it hits another breakpoint,
exits, or is paused.
F9
Pause Program. Suspends program execution immediately, without the need
for a breakpoint.
Stop Program. Causes the program to exit. If desired, you can restart the
program by clicking the Rerun action.
Ctrl+F2
Close Debug Window. If the program is still running in the debugger, you'll be
warned, and you'll have the option to cancel your action.
Ctrl+Shift+F4
execution. The first, by using a breakpoint, is the most common. The second is to
click the debugger's Pause Program button or select the Run | Pause Program
menu item.
Both approaches have the same end result, although if you suspend execution
with a breakpoint, the debugger can more easily give you an appropriate refer-
ence point—especially in multithreaded applications where you may otherwise
end up looking at the inside of a background event-handling thread.
Once suspended, the program remains idle until you use a stepping action to
advance the execution (we'll get to that later) or click Resume Program to exe-
cute until the next breakpoint is encountered. Until then, you can take all the
time you need to examine the state of things and think about the problem at
hand. (You can even go eat breakfast, if you want; rest assured that your bug will
be waiting for you when you get back.)
Stopping program execution
Beyond suspending execution, IDEA also lets you stop a program running in the
debugger at any time. Perhaps you found the bug, or maybe you're giving up on
the whole thing. Whatever the case, if you want to stop the program, click the
Stop icon or press Ctrl+F2 . Note that you're stopping the program, not just the
debugger, unless you're debugging a remote application as described in the
next section.
Once stopped, you lose any debugging information visible in the Debug win-
dow—there's no going back. You can click the Rerun Debugger icon to rerun
 
 
Search WWH ::




Custom Search