Breakpoints provide you with a way of stopping the execution to examine the state of variables, the agenda, and working memory. There are three types of breakpoints that you can set:
To remove all the breakpoints:
-
Click Clear all Breakpoints on the Debug menu, or click the Clear All Breakpoints
button on the Debugger toolbar.
Setting Rule Breakpoints
To set a rule breakpoint, do one of the following:
-
Double-click a rule belonging to the ruleset currently executing, and in the Rule Editor panel, scroll to the action of the rule where you want to set a breakpoint. Right-click the expression you want and then click Set/Unset Breakpoint on the shortcut menu. A red ball appears in the left margin of the Rule Editor and the expression is highlighted in red.
-
Click directly in the left margin of the Rule Editor on the line where you want to set a breakpoint. A breakpoint is set at the first expression of that line.
-
Click the expression, and then click Set/Unset Breakpoint on the Debug menu or click the Set/Unset Breakpoint
button on the Debugger toolbar.
-
Right-click a rule in the Engine Explorer and then click Set\Unset Breakpoint on the shortcut menu. This sets a breakpoint on the first action.
An example of how to set a breakpoint is shown in Figure 16.21.
Figure 16.21 Setting a Rule Breakpoint
Setting Class Breakpoints
Class breakpoints allow you to stop the execution whenever an instance of a class is added, retracted, or updated in the XOM.
To set a class breakpoint:
-
Click Execution Object Model on the View>Debugger Panels menu to open the Execution Object Model panel.
-
Right-click the XOM class where you want to set a breakpoint and on the Set/Unset Breakpoint shortcut menu click one of the following items:
-
Insert
- The execution stops when an instance of the XOM class where you set the breakpoint is added to the working memory.
-
Retract
- The execution stops when an instance of the XOM class where you set the breakpoint is retracted from the working memory.
-
Update
- The execution stops when an update is applied to an instance of the XOM class where you set the breakpoint.
-
All
- The execution stops when any of the three events (insertion, retraction, update) occur.
Depending on which breakpoint you choose, a red ball with the first letter of the breakpoint type, I for Insert, R for Retract, or U for Update, appears on the left of the class name. You can set or unset any combination of the three types of breakpoints as shown in Figure 16.22.
Figure 16.22 Unsetting a Class Breakpoint
You can also set a breakpoint on a field of a class. The execution will stop when this field is modified in any instance of the class, and when the modification occurs inside the action part of a rule by means of an assignment operator.
To set a breakpoint on a field:
-
Double-click the class to expand it and right-click the field.
-
On the shortcut menu that opens, click Set/Unset Modify Field Breakpoint.
A red ball with the letters MF appears on the left of the class name. A second red ball appears on the left of the field name, as shown in Figure 16.23.
Figure 16.23 Unsetting a Class Field Breakpoint
Setting Object Breakpoints
Object breakpoints allow you to stop the execution whenever an object is added, retracted, or updated in the working memory.
To set an object breakpoint:
-
Click Working Memory on the View>Debugger Panels menu to open the Working Memory panel.
-
Right-click the object where you want to set a breakpoint and on the Set/Unset Breakpoint shortcut menu, choose one of the following items:
-
Retract
- The execution stops when the object where you set the breakpoint is retracted from the working memory.
-
Update
- The execution stops when an update is applied to the object where you set the breakpoint.
-
All
- The execution stops when any of the two events (retraction or update) occurs.
Depending on which breakpoint you choose, a red ball with the first letter of the breakpoint type, R for Retract or U for Update, appears on the left of the object name. You can set any combination of the two types of breakpoints.
You can also set a breakpoint on a field of an object. The execution stops when this field is modified inside a rule by means of an assignment operator.
To set a breakpoint on a field:
-
Double-click the object to expand it and right-click the field.
-
On the shortcut menu that opens, click Set/Unset Modify Field Breakpoint.
- A red ball with the letters MF appears on the left of the object name. A second red ball appears on the left of the field name, as shown in Figure 16.24.
-
Figure 16.24 Object Field Breakpoint in Working Memory Panel
See Also
Viewing Breakpoints | Editing Breakpoints | Setting Up the Execution Object Model
|