IntelliJ IDEA 2017.1 Help

Breakpoints

Run | View Breakpoints
Ctrl+Shift+F8
/help/img/idea/2017.1/debug_view_breakpoints.gif

In this section:

Toolbar

ItemTooltip and shortcutDescription
/help/img/idea/2017.1/new.pngAdd Breakpoint
Alt+Insert
Click to show the list of available breakpoint types. Select the desired type to create a new breakpoint.
/help/img/idea/2017.1/delete.pngRemove BreakpointClick this button to remove selected breakpoints.
/help/img/idea/2017.1/iconPackage.pngGroup by PackageClick this button to display breakpoints under their respective packages, rather than under their types:
/help/img/idea/2017.1/breakpoint_group_by_package.png
/help/img/idea/2017.1/fileTypeText.pngGroup by FileClick this button to display breakpoints under their respective files, rather than under their types:
/help/img/idea/2017.1/ij_breakpoint_group_by_file.png
/help/img/idea/2017.1/classTypeJavaClass.pngGroup by ClassClick this button to display breakpoints under their respective classes, rather than under their types:
/help/img/idea/2017.1/breakpoint_group_by_class.png

Breakpoint options

The controls of this part of the Breakpoints dialog depend on the type of the selected breakpoint.

OptionDescriptionTypes of breakpoints
SuspendSelect this check box to enable suspend policy for a breakpoint.

For Line/ Method/ Exception breakpoints and Field Watchpoints select one of the radio buttons to specify the way the running of the 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 program execution when the breakpoint is hit.

If the check box is not selected, no threads are suspended.

Suspend policyDescription
AllWhen a breakpoint is hit, all threads are suspended.
ThreadWhen a breakpoint is hit, the thread where the breakpoint is hit, is suspended.
Make defaultClick this button if you want the suspend policy specified for the breakpoint in question to be used as the default one for the subsequently created breakpoints.
  • This feature is useful, for instance, to create a master breakpoint, which, being hit, enables lots of dependent ones. Another way to use is to obtain logging information or calculate some expression at a certain point (to be shown in the console) not interrupting the program execution.
  • There are certain cases when IntelliJ IDEA will not stop at a breakpoint. Consider the following:
    1. Two breakpoints are set at the different methods of a class, and their suspend policy is set to All.
    2. When one of the breakpoints is hit, some step actions are performed.
    3. If at the time of stepping another thread hits the second breakpoint, IntelliJ IDEA will not stop there.
Line/Exception/Field/Method
Condition Select this check box and specify a condition for hitting a breakpoint in the text field.

A condition is a Java Boolean expression (including a method returning true or false), for example, str1.equals(str2).

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 true, user-selected actions are performed.

If the result is false, the breakpoint does not produce any effect. If the Debugger cannot evaluate the expression, it displays the Condition evaluation error message. You can select whether you would like to stop at this breakpoint or ignore it.

Conditions for field/method/exception breakpoints are calculated in the context for the given field/method/exception.

To the right of the Condition field, there is the button /help/img/idea/2017.1/shift-enter-button.png(Shift+Enter) that opens the multiline editor.

Thus it's possible to enter multiline expressions, for example:

if (myvar == expectedVariable) { System.out.println (myvar); anotherVariable = true; } return true;
All types
Log message to console Select this check box if you want a log message to be displayed in the console output when the breakpoint is hit.All types
Evaluate and logSelect this check box if you wish to evaluate a certain expression at this breakpoint and to export result to the console output.

To the right of this field, there is the button /help/img/idea/2017.1/shift-enter-button.png(Shift+Enter) that opens the multiline editor.

Line breakpoints
Remove once hitSelect this check box, if the you want the breakpoint to be deleted after hitting it.All types
Disabled until selected breakpoint is hitFrom the drop-down list, select the breakpoint in question. The option None corresponds to the always enabled breakpoint.

Besides that, you can also choose the behavior of this breakpoint, when the selected one is hit:

  • Disable again
  • Leave enabled
All types
Filters
Catch class filtersSelect this check box if you want to filter out where the exceptions are caught.

Define a catch class filter in two ways:

  • Click the Browse button /help/img/idea/2017.1/browseButton.png and configure the filter in the Class Filters dialog box that opens.
  • Type the filter manually in the text box. Use the following syntax:
    • Use spaces to separate catch class names and patterns from each other.
    • The catch classes to be excluded should have a minus in preposition.

For example, the filter -java.* -sun.* means that the corresponding exception breakpoint should not be triggered for the exceptions caught inside java and sun packages.

Exception
Instance filtersAn 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 filtersSelect this check box 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:

  • Click the Browse button browseButton.png and configure the filter in the Class Filters dialog box that opens.
  • Type the filter manually in the text box. Use the following syntax:
    • Use spaces to separate class names and class patterns from each other.
    • The classes to be excluded should have a minus in preposition.

    For example, the filter package1.Class1 *s2 -package3.Class3 means that the corresponding breakpoint:

    • Should be triggered in the class package1.Class1 and all its subclasses, and also in the classes whose fully qualified class names end in s2.
    • Should not be triggered in the class package3.Class3 and all its subclasses.
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 true, the breakpoint is hit. If it is false, no other actions are performed until the next breakpoint is reached.

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 accessStands for triggering breakpoint every time the field is accessed.Field watchpoints
Field modificationThis check box is selected when simple read attempts shouldn't cause the breakpoint to trigger.Field watchpoints
Method entryStands for triggering breakpoint every time the method is entered.Method breakpoints
Method exitStands for triggering breakpoint every time the method is exited.Method breakpoints
Notifications
Caught exception/Uncaught exceptionSpecify in which cases you will be notified about hitting an exception breakpoint.Exception breakpoints

Context menu commands

CommandDescription
Move to groupPoint 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 descriptionChoose 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:
    /help/img/idea/2017.1/ij_breakpoint_search.png

    IntelliJ IDEA highlights the line with the matching address or description.

See Also

Last modified: 18 July 2017