All Manuals > LispWorks IDE User Guide > 2 A Short Tutorial

NextPrevUpTopContentsIndex

2.3 Using the Debugger

A debugger tool is provided to help track down the cause of problems in your source code. This section introduces you to some of the ways in which it can be used.

  1. Enter the following definition in the Listener:
  2. (defun test () 
      (let ((total 0)) 
        (loop for i below 100 do 
          (incf total i) when (= i 50) do 
          (break "We've reached fifty"))))

    This function counts from 0 to 100, accumulating the total as it progresses, and forces entry into the debugger when the count has reached 50.

  3. Next, call the function by entering (test) into the Listener.
  4. Initially, the command line debugger is entered. This is a debugger which can be used from within the Listener itself. More details about what you can do in the command line debugger can be found by typing :? at the debugger prompt.

  5. To enter the debugger tool at this point, choose the menu command Debug > Start GUI Debugger or press in the Listener toolbar.
  6. The debugger tool appears, as shown in Debugger tool.

    Figure 2.4 Debugger tool

    The debugger tool gives a view of the backtrace (in the Backtrace: pane), showing the functions that are on the stack, and their internal variables (including any arguments) at the point that the error occurred.

  7. In the Backtrace: pane, notice that there is a right-pointing triangle to the left of the word TEST . This indicates an expandable node. Click on this to open up the tree display, showing the local variables used in function test . Notice that the value for i is 50, as you would expect.
  8. There is a row of toolbar buttons at the top of the debugger which let you perform a number of different actions.

  9. Choose Restarts > (continue) Return from break. or click on the Continue icon from the toolbar to exit the Debugger and continue execution.

The debugger disappears from the screen, and the command line debugger in the Listener is exited, leaving you at the Lisp prompt in the Listener.


LispWorks IDE User Guide (Unix version) - 25 Nov 2011

NextPrevUpTopContentsIndex