IBM
Contents Index Previous Next



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

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:

  1. Restart the simulator.
  2. 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) .
  3. 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.

  1. 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!
  2. In the SDL Editor, bring up the Game process diagram from the Diagrams menu.
    • If, for some reason, this diagram is not included in the menu, you have to open it explicitly. Either click the Open quick button and select the file Game.spr, or double-click the Game diagram icon in the Organizer window.
  3. 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).
  4. 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.
    A red "stop" sign is added to the task symbol to indicate the breakpoint. Back in the Simulator UI, the definition of the symbol breakpoint is printed.
  5. 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.

  1. 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:
  2. Select the Demon process and click OK:

Figure 101 : Specifying the process

  1. Leave the instance number empty and click OK:

Figure 102 : Leave the instance number empty

  1. Do not specify a service name; simply click OK:

Figure 103 : Do not specify a service name

  1. Select the Generate state and click OK:

Figure 104 : Specifying the state Generate

  1. Select the timer T and click OK:

Figure 105 : Specifying the timer T

  1. Simply click OK in the remaining dialogs:

Figure 106 : Leaving the remaining dialogs empty

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.
  1. To see how the new breakpoint was defined, list all breakpoints with the Show entry in the Breakpoint menu:
    1
    
    Process name    : Demon
    
    Instance        : any
    
    Service name    : any
    
    State           : Generate
    
    Input           : T
    
    Sender name     : any
    
    Sender instance : any
    
    Stop each time
    
    
    
  2. 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 transition
    
    PId    : Demon:1
    
    State  : Generate 
    
    Input  : T
    
    Sender : Demon:1
    
    Now    : 1.0000
    

http://www.ibm.com/rational
Contents Index Previous Next