Breakpoints
Ctrl+Shift+F8
Breakpoint options
Use the toolbar buttons to add or remove breakpoints, and group them by package, file or class.
The options depend on the selected breakpoint type:
Option | Description | Types of breakpoints |
---|---|---|
Enabled | Select this option to enable breakpoints. If a breakpoint is disabled, IntelliJ IDEA will skip it during the debugging process. | |
Suspend | Select this option to enable the suspend policy for a breakpoint. For Line, Method, Exception breakpoints and Field Watchpoints, select one of the options to specify the way a program is paused when a breakpoint is reached. If you work with Flex or JavaScript breakpoints, you only need to specify whether you want to suspend the program execution when a breakpoint is hit. If this option is deselected, no threads are suspended.
There are certain situations when the program will not stop at a breakpoint:
| Line/Exception/Field/Method |
Condition | Select this checkbox and specify a condition for hitting the breakpoint. A condition is a Java Boolean expression (including a method returning This expression should be valid at the line where the breakpoint is set, and is evaluated every time the breakpoint is reached. If the evaluation result is If the result is Conditions for field/method/exception breakpoints are calculated in the context for the given field/method/exception. You can enter multiline expressions, for example: if (myvar == expectedVariable) {
System.out.println (myvar);
anotherVariable = true;
}
return true; | All types |
Log to console | Select if you want to log the following events to console:
| All types |
Evaluate and log | Select this checkbox if you wish to evaluate a certain expression at this breakpoint and to export the result to the console output. Press Shift+Enter to open the multiline editor. | Line breakpoints |
Remove once hit | Select if you want the breakpoint to be deleted after it was hit. | All types |
Disable until breakpoint is hit | From the drop-down list, select the breakpoint in question. The None option corresponds to the always enabled breakpoint. Besides that, you can also choose the behavior of this breakpoint, when the selected one is hit:
| All types |
Filters | ||
Catch class filters | Select this checkbox if you want to filter out where the exceptions are caught. Define a catch class filter in two ways:
For example, the filter | Exception |
Instance filters | An instance filter is used to limit breakpoint hits only with particular object instances using instance IDs. The instance ID value can be introduced manually or using the Instance Filters dialog box called by clicking the ellipsis button. Existing instance filters are indicated by the instance ID delimited with spaces. | Line/Exception/Field/Method |
Class filters | Select this checkbox to have the breakpoint behave differently in relation to particular classes. Define the class filter to appoint the classes where you want the breakpoint to be hit and the classes where the breakpoint should not be triggered. Classes in a filter can be identified by their names or by means of class patterns. A class pattern is a string that may start or end with an asterisk (*). The asterisk in a pattern means any number (including zero) of any characters. The patterns are matched against fully qualified class names. The breakpoint behavior is different in relation to classes specified by their names or using class patterns. A filter specified through a class name points at the class itself as well as at all its subclasses (i.e. the classes directly or indirectly extending this one). A filter specified through a class pattern points at the classes whose fully qualified names match the pattern. The subclasses of such classes are selected only if their fully qualified names also match the specified pattern. You can define a class filter in two ways:
| Line/Exception/Field/Method |
Pass count | Specify the integer number, on which hit of the breakpoint it should be triggered. After the specified number of passes, the breakpoint is hit. This function is helpful for debugging loops or methods called several times. When the execution process comes to a breakpoint, where Pass count is set, the debugger reduces the count value by 1 and compares it to zero. If the comparison result is The Pass count condition can be satisfied only once. In other words, if you have a loop inside a method and the Pass count condition has been honored once, the breakpoint will not be hit the next time the said method is called. This option is only enabled, when Condition, Instance filters and Class filters options are disabled. | Line/Exception/Field/Method |
Watch | ||
Field access | Stands for triggering breakpoint every time the field is accessed. | Field watchpoints |
Field modification | This checkbox is selected when simple read attempts shouldn't cause the breakpoint to trigger. | Field watchpoints |
Method entry | Stands for triggering breakpoint every time the method is entered. | Method breakpoints |
Method exit | Stands for triggering breakpoint every time the method is exited. | Method breakpoints |
Notifications | ||
Caught exception/Uncaught exception | Specify in which cases you will be notified about hitting an exception breakpoint. | Exception breakpoints |
Context menu commands
Command | Description |
---|---|
Move to group | Point to this command to move the selected breakpoint to a new group, to one of the existing groups (<group name> ), or out of a group (<no group> ). |
Edit description | Choose this command to enter or change description of a breakpoint. |
Speed search of a breakpoint
To find a particular breakpoint
- Start typing address or description of the target breakpoint.
IntelliJ IDEA highlights the line with the matching address or description.