Java Reference
In-Depth Information
If the debugger shows some of your breakpoints as invalid even though
they're assigned to lines of code you know to be executable, your source
code may be out of sync with the running application. Try recompiling
your application and rerunning the debugger. You can even avoid re-
compiling and restarting your application by using IDEA 's HotSwap fea-
ture, which lets you reload classes within a running debug session (via
the Run | Reload Changed Classes command).
TIP
6.2.3
Working with method breakpoints
Method breakpoints allow you to target your debugging sessions by the method,
rather than by line number, that you wish to investigate. They let you follow pro-
gram flow at the method level as well as check entry and exit conditions. Unfor-
tunately, relying on method breakpoints can slow down the application you're
debugging, so use them sparingly.
Setting a method breakpoint
You create a method breakpoint by placing your cursor inside the method in ques-
tion and selecting Run | Toggle Method Breakpoint from the menu bar. The
method breakpoint icon appears in the gutter area next to the method declaration.
It doesn't matter where inside the method your cursor is when you place the
breakpoint. The breakpoint applies to the method as a whole, and the icon always
appears next to the declaration statement. Left-clicking the icon removes it,
whereas right-clicking brings up a context menu allowing you to modify the
breakpoint's properties.
You can also Alt+Click the gutter area next to the line where the method is
declared, to set a method breakpoint basing on the context of the line.
Breaking on method entry or exit
In the Wat c h group of the Method Breakpoints options panel are two checkbox
options: Method entry and Method exit . These selections control the points in
the method access at which the breakpoint's action is triggered. You must enable
at least one of these method trigger conditions, both of which are on by default.
Select or deselect the boxes as required.
6.2.4
Working with exception breakpoints
Exception breakpoints allow you to tell the debugger to respond to thrown excep-
tions. Unlike the line number and method breakpoints, which require specific
source references, exception breakpoints apply globally to the exception condi-
tion, not to a particular code reference. Exception breakpoints are a great shortcut
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search