![]() |
![]() |
![]() |
![]() |
![]() |
Using Breakpoints
The facility of a simulator demonstrated in this exercise is the breakpoint. A breakpoint can be used to stop the execution and activate the monitor system at a certain point of interest. There are four kinds of breakpoints; symbol, transition, output and variable. The first two kinds will be explained in the following.
What You Will Learn
- To set a breakpoint on an SDL symbol
- To set a breakpoint on a transition
- To list all defined breakpoints
- To graphically trace each executed SDL symbol
- To get a textual SDT reference to an SDL symbol
- To continuously execute the system
Setting Up the System
To see where a breakpoint is reached, you will start the execution of the system with the Go command. This command continuously executes transitions until an error occurs, a breakpoint is reached, or the system is completely idle. You should first set up the system in a way suitable for continuous execution:
- Restart the simulator.
- Set the trace value for the system to 0 to avoid trace information being printed during execution (you may use the Text level : Set entry from the Trace menu to do this) .
- Set the GR trace value for the system to 2. Each SDL symbol will then be selected in the SDL Editor as it is executed, allowing you to follow the execution even though no trace is printed.
Setting a Symbol Breakpoint
A symbol breakpoint is set at a specific SDL symbol in the process diagrams. Symbol breakpoints are checked before symbols are executed, i.e. the symbol is not executed when the breakpoint is reached. We will now show how to set a breakpoint on the first task symbol in the Game process, i.e. the initializing of the variable Count to 0.
- First, send the signal Newgame (using the new button). This is very important, as otherwise the Game process will not be created and the breakpoint will never be reached!
- In the SDL Editor, bring up the Game process diagram from the Diagrams menu.
- In the Simulator UI, choose Connect sdle in the Breakpoint menu (you may have to resize the window to see the menu). This establishes a connection between the Simulator and the SDL Editor. As a consequence, a new menu Breakpoints appears in the SDL Editor's menu bar (you may have to resize the window to see the menu).
- Go back to the SDL diagram and select the task symbol "Count:=0". Then, select the second command Set Breakpoint from the new Breakpoints menu in the editor (the one without trailing dots). The symbol breakpoint is now defined.
- Start executing the system by pressing the Go button in the Execute module. Note how the SDL symbols are selected in rapid succession as they are executed. Finally, the breakpoint is reached and the execution stops. The symbol where the breakpoint was set is next to be executed.
Setting a Transition Breakpoint
A transition breakpoint is set at a specific transition in the system. Transition breakpoints are checked before transitions are executed, i.e. the transition is not executed when the breakpoint is reached. We will set a breakpoint in the Demon process, when it is in the state Generate and receives the timer T.
- To define the breakpoint, choose Transition in the Breakpoint menu of the Simulator UI. This command takes a number of parameters. In the dialogs that appear:
- Select the Demon process and click OK:
- To omit selecting a parameter value is interpreted so that any value, name or number, will match this parameter. In this case, any instance of Demon and any sender will match the breakpoint.
- To see how the new breakpoint was defined, list all breakpoints with the Show entry in the Breakpoint menu:
1Process name : DemonInstance : anyService name : anyState : GenerateInput : TSender name : anySender instance : anyStop each time- Resume execution of transitions by clicking the Go button. When the breakpoint is reached, you can see that the current state of the system matches the breakpoint definition:
Breakpoint matched by transitionPId : Demon:1State : GenerateInput : TSender : Demon:1Now : 1.0000
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |