You can set a breakpoint in any form which might be evaluated, except for
The breakpoint can be at the start, function call or return point of the form.
For each of the load source, load fasl, compile defun and compile buffer operations, breakpoints are activated only after the operation has finished.
A locatable defining form is a named defining form that can be located by the Dspec system (for example by the Find Dspec
editor command). This includes defun
, defmethod
and all the standard Common Lisp definers. For more information about the Dspec system, see the
LispWorks User Guide and Reference Manual
.
When not at the current stepping position, a breakpoint is highlighted red in the Stepper source area. When the same source code is also visible in an Editor tool, the breakpoint is visible there too.
To set a breakpoint from the Stepper, position the cursor where you want the breakpoint and choose Debug > Stepper > Breakpoint or click in the Stepper toolbar.
Figure 27.5 A breakpoint on the function call +
When you run code, or choose Debug > Stepper > Continue , execution stops if a breakpoint is reached. The Stepper will show the form in the source area with the breakpoint highlighted in yellow.
In the picture above, execution has stopped at the start of the print form and we have just set a breakpoint on the call to +
. Continuing from this point will cause execution to stop just before it calls +
, and the Stepper will display the arguments that are about to be passed to +
.
If you set a breakpoint on the closing parenthesis of a form, then it will cause execution to stop when the form returns and the top backtrace frame will display the values of that form.
To set a breakpoint from the Editor, see Breakpoints.
A breakpoint can be modified to make it effective only when a condition is true.
Suppose that you have reached a breakpoint on the call to +
as set in the example above. To make this breakpoint conditional on a variable *use-my-breakpoints*
(which you should define with defvar
), choose
Conditional...
from the
Breakpoint Options
menu:
Figure 27.6 The Breakpoint Options menu
Select the
Condition
radio button in the
Conditional
tab of the Edit Breakpoint dialog, then enter *use-my-breakpoints*
in the condition area and click
OK
.
Figure 27.7 The Edit Breakpoint dialog
The form defining the breakpoint condition is evaluated in the package where the stepped function was defined. Note that this package is displayed in the
Conditional
tab of the Edit Breakpoint dialog. Therefore, after confirming the dialog shown above, your code breaks at the breakpoint depending on the value of common-lisp-user::*use-my-breakpoints*
.
To make a breakpoint unconditional, select Unconditional in the dialog shown above.
Note: you cannot currently access the values of local variables in the condition expression.
A breakpoint can be modified to make it print an expression and its value when it is reached.
Again suppose that you have reached a breakpoint on the call to +
as set in the example above. To make this breakpoint print, choose
Printing...
from the Breakpoint Options menu, and enter a valid Lisp expression in the
Printing
tab of the Edit Breakpoint dialog, and click OK.
When the breakpoint is reached, the expression and its value are printed like this:
Stepper value (+ 4 4 4 4): 16
The Lisp expression is evaluated in the package where the stepped function was defined. Note that this package is displayed in the Printing tab of the Edit Breakpoint dialog.
If you check the Print without stopping option, then the above line is printed but the code continues to execute and does not stop at the breakpoint.
Note: you cannot currently access the values of local variables in the printed expression.
To edit the Conditional or Printing properties of a breakpoint visible in the source, position the cursor on the breakpoint and proceed as described in Conditional breakpoints or Printing breakpoints.
Where you wish to change the Conditional or Printing properties of a breakpoint without finding it in the source, choose Edit... from the Breakpoint Options menu or the menu command Debug > Stepper > Edit Breakpoints... . Select a breakpoint in the Breakpoints list and click the Edit... button. Choose the Conditional or Printing tab as appropriate and proceed as described in Conditional breakpoints and Printing breakpoints.
To visit the source code where a breakpoint was set, choose Edit... from the Breakpoint Options menu or the menu command Debug > Stepper > Edit Breakpoints... . Select a breakpoint in the Breakpoints list and click the Goto Source button. This cancels the dialog and then displays the source containing the breakpoint.
To remove a breakpoint under the cursor, click in the toolbar. Equivalently you can choose Debug > Stepper > Breakpoint .
Where you wish to remove one or more breakpoints without finding them in the source, choose Edit... from the Breakpoint Options menu or the menu command Debug > Stepper > Edit Breakpoints... , select a breakpoint or breakpoints in the Breakpoints list, and click Remove .
If you remove all breakpoints, then the breakpoints dialog is closed.
LispWorks IDE User Guide (Windows version) - 13 Sep 2017