Skip to Main Content Skip to Search
Product Documentation

Defining a Breakpoint

What Is a Breakpoint?

In the SimEvents debugger, a breakpoint is a point of interest in the simulation at which the debugger can suspend the simulation and let you enter commands. You decide which points are of interest to you and then use debugger functions to designate those points as debugging breakpoints. After you define one or more breakpoints, you can use them to control the simulation process efficiently. At the sedebug>> prompt, the cont command causes the simulation to proceed until the next breakpoint, bypassing points that you are not interested in and letting you inspect states at a point of interest. To learn more about controlling the simulation after defining breakpoints, see Using Breakpoints During Debugging.

Identifying a Point of Interest

Before defining a breakpoint, you must decide what points in the simulation you want to inspect and then determine a way to refer to the point explicitly when invoking a function to define a breakpoint. The SimEvents debugger supports the following kinds of breakpoints.

Type of BreakpointDebugger Suspends Simulation Upon...When You Might Use Breakpoint Type
Timed breakpointFirst operation whose associated time is equal to or greater than the value of the timed breakpoint
  • You know a time at which something of interest to you occurs

  • You want to proceed in the simulation by a fixed amount of time

  • A point of interest is not associated with an event on the event calendar or a block in the model

  • You do not have an event identifier to use to define an event breakpoint

Event breakpointExecution or cancelation of the specified eventAn event on the event calendar is a point of interest
Block breakpointOperation involving the specified block, for blocks that support block breakpoints
  • You want to understand how a block behaves

  • A block seems to cause or reflect the problem you are investigating

Entity breakpointOperation that involves the specified entityAn operation that involves the entity is a point of interest

You cannot set a breakpoint for a Simulink controlled block. Instead, set the breakpoint in the SimEvents block that initiates the signal execution.

Tips for Identifying Points of Interest

Setting a Breakpoint

After you have identified a point of interest, you can set a breakpoint by entering one of the commands in the table.

Type of BreakpointAt sedebug>> Prompt, Enter...
Timed breakpoint at simulation time T = t0tbreak(t0) or tbreak t0
Event breakpoint at event whose identifier is the string, evidevbreak(evid)
Block breakpoint at block whose identifier is the string, blkid, or whose path name is the string, blknameblkbreak(blkid) or blkbreak(blkname)
Entity breakpoint at entity whose identifier is the string, enidenbreak(enid)

Warning When Setting Certain Breakpoints

The debugger warns you if it determines that it might not hit the breakpoint that you want to define or if it does not recognize an event identifier that you specify. The warning can alert you to a mistake in your command, but might also follow a correct command. For example, suppose you obtain an event identifier during one run of the simulation and set an event breakpoint on that event in a subsequent run of the simulation, before the event has been scheduled. Setting an event breakpoint before the event has been scheduled is legitimate because event identifiers are the same from one debugging session to the next. However, the debugger cannot distinguish this situation from a mistake in your input argument to evbreak.

If you often intentionally set breakpoints that cause this warning and you want to suppress such warnings in the future, enter warning off last immediately after the warning occurs. For more information about this command, see Warning Control.

Viewing All Breakpoints

To see a tabular display of all breakpoints that you have set, at the sedebug>> prompt, enter this command:

breakpoints

The output includes this information about each breakpoint.

LabelDescription
IDA token that uniquely identifies the breakpoint
TypeBlock, Event, Timed, or Entity
ValueThe block identifier of a block breakpoint
The event identifier of an event breakpoint
The time of a timed breakpoint
The ID of the entry
Enabledyes, if the debugger considers the breakpoint when determining where to suspend the simulation
no, if the debugger ignores the breakpoint

The list of breakpoints does not guarantee that the simulation reaches each point before the simulation ends. The sequence of breakpoints in the list does not necessarily represent the sequence in which the simulation reaches each point.

The list of breakpoints does not show a special built-in breakpoint that the debugger always observes at the end of the simulation. You do not set this breakpoint explicitly and you cannot disable or remove it.

Sample Breakpoint List

The sample output of breakpoints shows six breakpoints. Two are timed breakpoints, one is an entity, one is an event breakpoint, and two are block breakpoints. One of the block breakpoints is disabled.

List of Breakpoints: 

 ID        Type        Value       Enabled
 b1        Event       ev4         yes
 b2        Block       blk11       yes
 b3        Timed       100         yes
 b4        Timed       101         yes
 b5        Block       blk15       no
 b6        Entity      en3         yes

To learn how to delete or disable breakpoints in the list, see Ignoring or Removing Breakpoints.

To learn how to enable breakpoints in the list, see Enabling a Disabled Breakpoint.

  


Free SimEvents Evaluation Kit

Learn how you can use SimEvents discrete-event simulation capabilities through these technical resources.

Get free kit

Trials Available

Try the latest version of discrete-event simulation products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS