5 min. reading time

When testing code, breakpoints are of a great help and most of you are probably using them on a daily basis in their IDE. An executable graphical model, like a state machine, is just a different view on the code it represents; and sooner or later you will need to debug it, too. With the Professional Edition of YAKINDU Statechart Tools it is now possible to set breakpoints directly on the graphical model in order to control the simulation.

How to Use Breakpoints

You can set a breakpoint either on a state or on a transition via the element's context menu (Toggle Breakpoint). In order to activate breakpoints you need to run the statechart simulation in debug mode (Rightclick -> Debug As -> Statechart Simulation). Once a breakpoint is reached, the simulation stops and highlights the active element with a green colored border.

The Breakpoints view lists all created breakpoints. There, you can enable or disable breakpoints individually or skip them all. You can also provide a conditional expression for each breakpoint. This allows for a more fine-grained definition of when to pause a simulation. The simulation only suspends at such a breakpoint when its conditional expression is fulfilled. A content assistant (Ctrl+Space) and an automatic validation help to avoid syntax errors when typing conditional expressions.

This is illustrated in the example below. The transition breakpoint has a conditional expression counter == 3. As a result, the simulation only pauses when the transition is to be traversed the third time.

Breakpoint Semantics

With breakpoints it is possible to define when the simulation should automatically halt for you. Breakpoints can be set either on a state or on a transition.

For a state breakpoint the simulation suspends when the corresponding state is entered. This means in particular that the state's entry actions get already executed before the breakpoint is reached, but none of its local or exit actions.

For a transition breakpoint, the simulation halts when the transition is to be taken because trigger and guard expressions are fulfilled, but before any transition action or the source state's exit action is executed. This is illustrated in the following example:

Breakpoint Order

When the simulation stops at the transition breakpoint, the variable x has value 2 because state A's exit action is not yet performed. When the simulation stops at the state breakpoint, x is 5 because state B's entry action is already executed before the breakpoint is reached.

Your Feedback Counts

You can try out the YAKINDU Statechart Tools Professional Edition for free. All we want from you is your feedback which you can send us directly per mail (sct-pro@itemis.de) or via the Mail Support function in the tool.

Download and try  YAKINDU Statechart Tools