Main Content

Breakpoints List

View, configure, and manage breakpoints for debugging models

Since R2022a

Description

The Breakpoints List provides information about all breakpoints configured in your model, including breakpoints in Stateflow® charts and source code for MATLAB Function blocks. The Breakpoints List displays breakpoints configured throughout the model hierarchy.

Using the Breakpoints List, you can:

  • View all breakpoints in the model along with breakpoint information, such as the breakpoint source.

  • Navigate to the location of each breakpoint in the model hierarchy.

  • Enable and disable individual breakpoints or all breakpoints.

  • Delete breakpoints.

  • Specify when the simulation pauses after encountering the condition for a breakpoint.

By default, the simulation pauses within a time step as soon as the condition for a breakpoint is met. When you pause within time steps, you can step through the simulation one block at a time. Pausing within a time step gives you more granular control over how to progress the simulation and facilitates debugging iterative subsystems.

Breakpoints are not saved as part of the model.

Breakpoints List

Open the Breakpoints List

  • Simulink® Toolstrip: On the Debug tab, click Breakpoints List.

  • Simulink Editor: Click the breakpoint icon on a signal that has a breakpoint.

    When you open the Breakpoints List by clicking a breakpoint, the row for the breakpoint you clicked is highlighted purple in the table.

Examples

expand all

A signal breakpoint causes the simulation to pause when the signal value satisfies the specified condition.

Add a signal breakpoint using the Simulink Toolstrip.

  1. Select a signal in your model.

  2. On the Debug tab, click Add Breakpoint.

  3. In the Add Breakpoint dialog box, specify the condition for the breakpoint. From the drop-down list, select the relational operator for the condition. Then, in the text box, specify the value.

    For example, to pause the simulation when the signal value is equal to 0, select the equals (=) relational operator and enter 0 in the text box.

  4. Click OK.

The red circle on the signal line indicates that a breakpoint is configured for that signal.

A Switch block produces a signal named throttle. The throttle signal is marked for logging, as indicated by the logging badge, and configured with a signal breakpoint, as indicated by a red circle.

Add another breakpoint using the context menu for the signal.

  1. Select a signal in the model.

  2. Right-click the selected signal.

  3. From the context menu, select Add Breakpoint

  4. In the Add Breakpoint dialog box, specify the condition for the breakpoint.

    For example, to pause the simulation when the signal value is greater than 5, select the greater than (>) relational operator and enter 5 in the text box.

  5. Click OK.

After adding breakpoints to your model, you can use the Breakpoints List to view and manage the breakpoints throughout your model.

To open the Breakpoints List, on the Debug tab, click Breakpoints List. The Breakpoints List opens docked at the bottom of the Simulink Editor. The table lists all the breakpoints configured in the model hierarchy, including breakpoints in Stateflow charts, along with information about each breakpoint.

The Breakpoints List displays information about four signal breakpoints and two breakpoints for a Stateflow chart.

Using the Breakpoints List, you can enable and disable individual breakpoints or all breakpoints. The simulation pauses when the condition for an enabled breakpoint is met and ignores disabled breakpoints. You can enable and disable breakpoints during and between debugging sessions. To enable or disable an individual breakpoint, use the check box in the Enabled column of the table. To enable or disable all breakpoints in the model hierarchy, click Enable or disable all breakpoints .

The table summarizes how a breakpoint appears in the block diagram based on its status.

Breakpoint AppearanceBreakpoint Status
Red circle

Enabled

Red circle with a green arrow

Hit

Grey circle

Disabled

Clear circle

Invalid

You can also delete breakpoints.

  • To delete an individual breakpoint, pause on the row for the breakpoint, then click Delete breakpoint .

  • To delete multiple breakpoints, select the breakpoints to delete in the table. Then, click Delete selected breakpoints .

  • To delete all breakpoints, click the Delete selected breakpoints button arrow and select Delete all breakpoints.

Breakpoints are not saved as part of the model.

Using the Breakpoints List, you can navigate easily to each breakpoint in the model and determine which row of the Breakpoints List contains information about a given breakpoint.

To navigate to a specific breakpoint from the Breakpoints List, click the hyperlink for the breakpoint in the table. A new tab opens in the Simulink Editor to show the component that contains the breakpoint. The source for the breakpoint is highlighted purple.

The pointer is positioned over the hyperlink for a breakpoint in the Breakpoints List. The Simulink Editor displays the part of the model that contains the breakpoint, with the source block and signal highlighted purple.

To get more information about a breakpoint you find as you navigate through your model, click the breakpoint Red circle that indicates location of breakpoint in model.. The row for that breakpoint in the Breakpoints List is highlighted purple.

Related Examples

Parameters

expand all

Debugging Behavior

By default, models are configured to enable low-level debugging, where the simulation pauses within a time step, as soon as the condition for a breakpoint is met. When you clear this parameter, the simulation pauses at the end of the time step where the condition for a breakpoint is met.

Low-level debugging is supported only for normal mode simulations. This option has no effect on accelerator and rapid accelerator simulations.

When you enable low-level debugging, you have more options on the Debug tab for controlling how to step through the simulation.

Stepping OptionDescriptionKeyboard ShortcutAvailability

Continue

Run until breakpoint pauses simulation.

Ctrl+T or F5

On macOS, press command (⌘) instead of Ctrl.

Always available

Step Forward

Progress simulation to the end of the next time step.

Step Back

Step simulation to the start of the previous time step.

To use this option, you must enable stepping back before starting the simulation. For more information, see Simulation Stepping Options.

Available only when you enable stepping back using the Simulation Stepping Options

Step Over

Step simulation to just before the next block output method executes.

F10 (since R2023b)

On macOS, press Shift+Command+O.

Available only when paused within a time step

Step In

Step into Model block, atomic subsystem, MATLAB Function block, or Stateflow chart.

When the next block to execute is not a Model block, atomic subsystem, or MATLAB Function block and the simulation is not paused on a Stateflow chart, the Step In button takes the same action as the Step Over button.

F11 (since R2023b)

On macOS, press Shift+Command+I.

Step Out

Steps out of Model block, atomic subsystem, or Stateflow chart.

When the next block to execute is not a Model block or atomic subsystem and the simulation is not paused on a Stateflow chart, the Step In button takes the same action as the Step Over button.

Shift+F11 (since R2023b)

On macOS, press Shift+Command+U.

Using the check box next to each breakpoint in the Breakpoints List, you can enable and disable individual breakpoints during and between debugging sessions. When the check box is selected, the breakpoint is active, and the simulation pauses when the condition for the breakpoint is met. When the check box is cleared, the breakpoint is inactive, and the simulation does not pause because of that breakpoint.

To enable or disable all breakpoints configured in the model, click Enable or disable all breakpoints .

Signal Breakpoints

The Breakpoints List contains a row for each signal breakpoint you configure in the model. Each signal breakpoint has a condition, and the simulation pauses when the signal value satisfies that condition. The condition consists of a relational operator, such as equals (=) or greater than (>), and a value. For example, for a signal breakpoint condition of > 1, the simulation pauses when the signal value is greater than one.

Signal breakpoints do not support specifying the condition using variables, expressions, or symbols such as π (pi).

Signal breakpoints are supported for only Simulink signals and are not supported for other types of signals, such as Simscape™ signals.

Signal breakpoints are supported only for real scalar signals with these data types:

  • double

  • single

  • int

  • Boolean

  • Fixed-point

    For fixed-point signals, the software uses the converted double signal value to check for the breakpoint condition.

These additional limitations for port value labels also apply for signal breakpoints Additional Considerations for Using Port Value Labels.

Model Breakpoints

By default, no model breakpoints are configured for a model. To add the zero-crossing breakpoint to a model, on the Debug tab, click the button arrow next to Add Breakpoint and select Zero Crossing. After you add the zero-crossing breakpoint, you can enable and disable the zero-crossing breakpoint from the Breakpoints List during and between debugging sessions for the model.

When the simulation pauses due to an active zero-crossing breakpoint, the Simulink Editor opens a tab to display the subsystem or model that contains the block where the zero crossing occurred and highlights the block in green.

By default, no model breakpoints are configured for a model. To add the NaN or Inf value breakpoint to a model, on the Debug tab, click the button arrow next to Add Breakpoint and select NaN or Inf Value. After you add the NaN or Inf value breakpoint, you can enable and disable the NaN or Inf value breakpoint from the Breakpoints List during and between debugging sessions for the model.

When the NaN or Inf value breakpoint is enabled for a model, the simulation pauses when a computation results in a NaN or Inf value. NaN or Inf values can occur when the computation result is infinite or outside of the range of values supported by the machine running the simulation.

When the simulation pauses due to an active NaN or Inf breakpoint, the Simulink Editor opens a tab to display the subsystem or model that contains the block where the NaN or Inf value occurred and highlights the block in green.

Use the NaN or Inf value breakpoint to help locate the site of computational errors in a model.

Tips

  • For debugging in simulation, use normal mode.

  • To view signal values in the model while debugging, use port value labels. To add a port value label for a signal, select the signal. Then, on the Debug tab, in the Tools section, next to Output Values, click Show Output Value of selected signal . For more information, see View Signal Values Using Port Value Labels.

  • To save time when iteratively debugging, consider enabling fast restart. With fast restart enabled, the model compiles only the first time you simulate. Subsequent simulations take less time by skipping the compilation phase. While fast restart is enabled, you can modify the model only in ways that do not require compiling the model. For more information, see How Fast Restart Improves Iterative Simulations.

  • While paused within a time step, you can use some of the programmatic debugging functions, including the disp function, to get more information about the system behavior.

  • By default, the Breakpoints List opens as a pane at the bottom of the Simulink Editor. You can reposition the Breakpoints List to suit your workflow.

    • To dock the Breakpoints List to a different part of the Simulink Editor, drag the pane to another part of the window.

    • To minimize the Breakpoints List, click the arrow in the upper right and select Minimize.

    • To use the Breakpoints List as a separate window, drag the pane out of the Simulink Editor or click the arrow in the upper right and select Undock.

  • The stepping and breakpoint options in the Simulink Editor do not have a programmatic equivalent available in the software. The Simulink debugging programmatic interface includes options for setting breakpoints and stepping through simulations. However, the behavior of these functions is not identical to the behavior of the stepping options in the Simulink Editor. For more information about programmatic debugging, see Simulink Debugging Programmatic Interface.

Version History

Introduced in R2022a