Common LispWorks User Guide, Liquid Common Lisp Version 5.0
12 The Debugger Tool
When developing source code, mistakes may prevent your programs from working properly, or even at all. Sometimes you can see what is causing a bug in a program immediately, and correcting it is trivial. For example, you might make a spelling mistake while typing, which you may instantly notice and correct. More often, however, you need to spend time studying the program and the errors it caused before you can debug it. This is especially likely when you are developing large or complex programs.
A debugger tool is provided to make this process easier. This tool is a graphical front-end to the command line debugger which is supplied with your Lisp image. In order to get the best use from the debugger tool, it is helpful if you are familiar with the command line debugger supplied.
The debugger tool can be used to inspect the behavior of programs which behave in unexpected ways, and to analyze programs which cause unreasonable conditions when they are run, or which contain Common Lisp forms which are syntactically incorrect.
The command line debugger is invoked automatically whenever errors occur.
There are two ways that you can invoke the debugger:
- If you have entered the command line debugger by evaluating code in the listener that contains bugs, choose Debug > Debugger to invoke the debugger tool.
- If code containing bugs has been run from another source (for example, as a result of running a windowed application, or compiling code in a file of source code), a notifier window is created. Click on the Debug button in this notifier to invoke the debugger tool.
The command line debugger can be entered by signaling an error in interpretation or execution of a Common Lisp form. For each error signaled, a further level of the debugger is entered. Thus, if, while in the debugger, you execute code which signals an error, a lower level of the debugger is entered. The number in the debugger prompt is incremented to reflect this. For example:
- 1. Define the following function in the listener.
(defun thing (number)
(/ number 0))
This function which attempts to divide a number given as an argument by zero.
- 2. Now call this function as follows:
(thing 12)
The call tothing
invokes the command line debugger.
- 3. Choose Debug > Debugger from the listener to invoke the debugger tool.
- 4. For now, click Abort at the bottom of the debugger tool to return to the top level event loop in the listener.
Note that you can also invoke the command line debugger by tracing a function and forcing a break on entry to or exit from that function. See Section 3.10 on page 48 for details. - 12.1 - Description of the debugger
-
- 12.2 - What the debugger tool does
-
- 12.3 - Simple use of the debugger tool
-
- 12.4 - The stack in the debugger
-
- 12.5 - An example debugging session
-
- 12.6 - Performing operations on the error condition
-
- 12.7 - Performing operations on frames in the stack
-
- 12.8 - Performing operations on variables in a frame
-
- 12.9 - Configuring the debugger tool
-
Common LispWorks User Guide, Liquid Common Lisp Version 5.0 - 18 OCT 1996 Generated with Harlequin WebMaker