A breakpoint suspends the execution of a model at the location where the breakpoint is set. Breakpoints can be enabled and disabled via the context menu in the Breakpoints view, or via the context menu in the code editor ruler.
An enabled breakpoint causes a model to suspend whenever the breakpoint is encountered. Enabled breakpoints are drawn with a blue circle [] and have a checkmark overlay once successfully installed.
A disabled breakpoint will not cause model to suspend. Disabled breakpoints are drawn with a white circle [].
Breakpoints are displayed in the vertical editor ruler and in the Breakpoints view.
The Breakpoints view lists all the breakpoints currently set in your workspace. You can double-click a breakpoint to display its location in the editor (if applicable). You can also enable or disable breakpoints, delete them, add new ones, or set hit counts.
To show/hide the Breakpoints view
- Choose View > Breakpoints from the main menu.
The Breakpoints view provides a set of toolbar buttons enabling the user to manage the breakpoints listed in the view:
Command | Action |
---|---|
Remove Breakpoint | Removes the selected breakpoint. |
Remove All | Removes all breakpoints from the view. |
Show Supported Breakpoints | Toggles the view to show all breakpoints or only breakpoints supported by current target. |
Go to File for Breakpoint | Opens the Java editor and selects there the line that corresponds to the selected breakpoint. In case the breakpoint was originally set in the code of Java class or interface, this class/interface code is shown in the Java editor, and the corresponding line is selected. In case the breakpoint was set in the properties of some model element, the code generated for the agent — owner of this element — is shown in the editor and the particular line containing this breakpoint is selected. |
Skip All | Sets all breakpoints to be skipped. |
Expand All | Expands all items in the view. |
Collapse All | Collapses all items in the view. |
Link with Debug View | Toggles the view contents to be synced with the Debug view. |
Add Java Exception Breakpoint | Opens the Add Java Exception Breakpoint dialog, which allows to create exception breakpoints. Thread execution can be suspended at locations where the exception is not caught, caught, or both. |
Breakpoints are set on an executable line of a model.
To add a breakpoint
- In the code editor, directly to the left of the line where you want to add the breakpoint, right-click (macOS: Ctrl click) the marker bar (vertical ruler) and select Toggle Breakpoint from the popup menu. You can also double-click on the marker bar — this action also toggles a breakpoint. In the Properties view, the same actions are applicable, but first you have to place the cursor in the corresponding code field.
- A new breakpoint marker appears on the marker bar, directly to the left of the line where you added the breakpoint.
Also, the new breakpoint appears in the Breakpoints view list.
While the breakpoint is enabled, model thread execution suspends before that line of code is executed. The debugger selects the thread that has suspended and displays the thread's stack frames. The line where the breakpoint was set is highlighted in the code editor.
Breakpoints can be easily removed when you no longer need them.
To remove a breakpoint
- In the Properties view or in the code editor, directly to the left of the line where you want to remove the breakpoint, right-click (macOS: Ctrl click) the marker bar (vertical ruler) and select Toggle Breakpoint from the popup menu. The breakpoint is removed from the workbench. You can also double-click directly on the breakpoint icon to remove it.
Breakpoints can also be removed in the Breakpoints view. Select the breakpoint to be removed and from the context menu select Remove Breakpoint. The breakpoint selected in the Breakpoints view can be also removed using the Remove Breakpoint toolbar button of this view.
If you find yourself frequently adding and removing a breakpoint in the same place, consider disabling the breakpoint when you don't need it and enabling it when needed again.
Breakpoints can be enabled and disabled as needed.
When a breakpoint is enabled, thread execution suspends before that line of code is executed. The debugger selects the thread that has suspended and displays the thread's stack frames. The line where the breakpoint was set is highlighted in the code editor.
When a breakpoint is disabled, thread execution is not suspended by the presence of the breakpoint.
To disable a breakpoint
- In the Properties view, click into the line where the breakpoint is set.
- Press Ctrl + J (macOS: Cmd + J) to open code editor. The code editor will be opened with the line of code corresponding to the one selected in the Properties highlighted.
- Right-click (macOS: Ctrl + click) the breakpoint you want to disable in the marker bar (vertical ruler) and select Disable Breakpoint from the popup menu. The breakpoint image will change to a white circle and its checkbox in the Breakpoints view will be empty.
To enable a breakpoint
- In the Properties view, click into the line where the breakpoint is set.
- Press Ctrl + J (macOS: Cmd + J) to open code editor. The code editor will be opened with the line of code corresponding to the one selected in the Properties highlighted.
- Right-click (macOS: Ctrl + click) the breakpoint you want to enable in the marker bar (vertical ruler) and select Enable Breakpoint from the popup menu. The breakpoint image will change to a blue circle and its checkbox in the Breakpoints view will be checked.
A hit count can be applied to breakpoints. When a hit count is applied to a breakpoint, the breakpoint suspends execution of a thread the nth time it is hit, but never again, until it is re-enabled or the hit count is changed or disabled.
To set a hit count on a breakpoint
- In the Properties view, click into the line where the breakpoint is set.
- Press Ctrl + J (macOS: Cmd + J) to open code editor. The code editor will be opened with the line of code corresponding to the one selected in the Properties highlighted. Right-click (macOS: Ctrl click) the breakpoint to which a hit count is to be added in the marker bar (vertical ruler) and select Breakpoint Properties from the popup menu.
- The Properties for... dialog box will be displayed.
- Select the Hit Count check box.
- In the edit box to the right, type the number of times you want to hit the breakpoint before suspending execution.
- Click OK to close the dialog and commit the changes.
An enabling condition can be applied to a breakpoint such that the breakpoint suspends execution of a thread in one of these cases:
- when the enabling condition is true
- when the enabling condition changes
To set a condition on a breakpoint
- In the Properties view, click into the line where the breakpoint is set.
- Press Ctrl + J (macOS: Cmd + J) to open code editor. The code editor will be opened with the line of code corresponding to the one selected in the Properties highlighted. Right-click (macOS: Ctrl click) the breakpoint to which a hit count is to be added in the marker bar (vertical ruler) and select Breakpoint Properties from the popup menu.
- The Properties for... dialog box will be displayed.
- In the properties dialog, check the Enable Condition (code assist not available) checkbox.
- Enter the expression for the breakpoint condition in the field below.
-
Do one of the following:
- If you want the breakpoint to stop every time the condition evaluates to true, select the condition is 'true' option. The expression provided must be a boolean expression.
- If you want the breakpoint to stop only when the result of the condition changes, select the value of condition changes option.
- Click OK to close the dialog and commit the changes. While the breakpoint is enabled, thread execution suspends before that line of code is executed if the breakpoint condition evaluates to true.
A conditional breakpoint has a question mark overlay on the breakpoint icon: .
-
How can we improve this article?
-