Java Reference
In-Depth Information
Note that you still have to start a debug session before IDEA begins listening
for debug requests. IDEA is passive in this mode, so you don't need to specify a
hostname. If you're trying to debug an application that is running on several
servers simultaneously (as in a web application cluster), this mode may prove use-
ful, because you can't predict which server your code will execute on. Another
advantage of this model is that in the latest versions of Java, the VM is smart
enough to run at full speed until the exception is thrown, which can speed up
debugging in a performance-critical environment. Otherwise, you should proba-
bly stick with the default Attach mode of operation.
Disconnecting from a remote application
When you're finished with your debugging session, click the Stop icon or press
Ctrl+F2 to disconnect from the remote application. You're given the option to
terminate the remote program as well, if you're finished with it. However, if the
remote application exits on its own for some reason, the debugger will automati-
cally disconnect.
6.3.3
Stepping through the program
Once you hit a breakpoint or otherwise suspend the program, the Debug window
becomes active and you're officially debugging. From this point, you control the
program flow. You decide how and when the next line is executed. You also get to
examine the stack and the current values of any variables in the execution scope.
Often you can solve problems by just observing the program flow (for example,
when it starts going into a code block headed by the comment This should never
happen ). Stepping actions are available through both the Run menu and the
Debug window's toolbar.
The stepping actions are summarized in table 6.3. You use these actions to
advance the current execution point one line at a time, with the option of skip-
ping over methods you aren't interested in. Let's look at each action's function in
more detail.
Table 6.3 The stepping actions allow you to run through the program at your own pace, in order to
trace its execution path.
Default
shortcut
Icon
Description
Step Over. Runs until the next line in this method or file, skipping the methods
referenced at the current execution point (if any).
F8
continued on next page
 
 
 
 
 
 
 
Search WWH ::




Custom Search