Adding breakpoints using menu options
Instead of adding the message halt to specify a breakpoint, you can use the Break menu option available in many code browsers. To add a breakpoint:
1. Open a browser such as an Application Browser on your code.
2. Position the cursor where you want to insert a breakpoint.
You cannot insert a breakpoint in a Doit method. Nor can you set a breakpoint on entry to a primitive method; however, breakpoints are supported in primitive fail code.
3. Select Break from the Edit or Breakpoints menu.
4. In the Configure Breakpoints window displayed, specify constraints on the breakpoint. One Shot specifies if the breakpoint should remove itself after the first time it is triggered. Stop in process defines the processes in which the breakpoint should fire. Stop at iteration defines how often many times a breakpoint can be hit in a process before the breakpoint fires. Stop when true defines a Smalltalk expression that causes a breakpoint to fire if it evaluates to true; the expression can use local and temporary variables.
Note:
If a Smalltalk expression normally causes a debugger to open (for example, an object does not understand), the expression is treated as if it evaluates to false.
For most breakpoints, you will likely want to take the defaults of false for one shot, <all> for the process and iteration constraints and true for the expression constraint.
5. Select OK.
The breakpoint is highlighted and a dot appears beside the browser's description pane.
The system might not insert the breakpoint exactly where you placed the cursor. If the statement at the selected cursor position is not a valid breakpoint location, the system tries to find a valid location by searching in the method source starting at the cursor position. The cursor walks forward until the end of the method, and then it walks backward until the beginning of the method. If no valid location is found, the system prints a message to the Transcript. If the statement at the cursor position already contains a breakpoint, a Configure Breakpoints window opens.
Modifying breakpoint constraints
You can change the constraint settings for existing breakpoints. To do so, select a breakpoint and then select
Configure Breakpoint from the
Breakpoints menu. In the dialog that opens, change the constraint settings and select
OK.
Notice that the dialog has three push buttons which are not in the Configure Breakpoints window. The Deactivate (or Activate) button enables you to toggle the activation state of the breakpoint. Clear closes the dialog and removes the breakpoint. Reset Iterations Counter sets the value of the breakpoint's iteration counter to zero. None of the changes you make in this dialog take effect until you select OK.
Browsing breakpoints
To examine all breakpoints in an image, select Browse Breakpoints from the Tools menu of the Transcript. A Breakpoints browser opens, listing all breakpoints in the image. In this browser, you can select multiple breakpoints and act upon them as a group. You cannot change method source in this browser.
Removing breakpoints
To remove a breakpoint, change the method description and save the changes or select Clear Method Breakpoints from the Breakpoints menu.
The system clears all breakpoints automatically before you package an image. This ensures that the breakpoints in the development image do not make their way into the packaged image.
If you have changed a method but have not saved the changes, you can have the breakpoints reappear by selecting Revert from the File menu.
Last modified date: 05/19/2020