Skip to content
Small Common Lisp library to debug local variables
Common Lisp
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
debug-locals.asd
debug-locals.lisp
examples.lisp
package.lisp

README.md

debug-locals

Small common lisp library to debug local variables. Solves [No Locals] issue while debugging local variables under SBCL/CCL.

For now it supports local variables defined using:

  • let
  • let*
  • multiple-value-bind
  • destructuring-bind

Sample usage:

(ql:quickload :debug-locals)

In your defpackage form add:

(:import-from #:debug-locals
              #:let
              #:let*
              #:multiple-value-bind
              #:destructuring-bind
              #:with-debug
              #:defun*)

Write function using defun*:

(defun* foo* ()
  (let ((x 5))
    (destructuring-bind (y) '(10)
      (break)
      (format t "~d + ~d = ~d" x y (+ x y)))))

Or using with-debug (remember about (debug 3) declaration):

(defun foo ()
  (declare (optimize (debug 3)))
  (with-debug
    (let ((x 5))
      (break)
      (print x))))

Examples

You can load examples defined at debug-locals/examples package:

(ql:quickload :debug-locals/examples)
(in-package :debug-locals)

And run:

(function-foo)

and

(function-foo*)

To see the difference.

Slime backtrace without debug-locals:

Backtrace:
  0: (FOO)
      [No Locals]
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FOO) #<NULL-LEXENV>)

Slime backtrace with debug-locals:

Backtrace:
  0: (FOO)
      Locals:
        X = 5
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FOO) #<NULL-LEXENV>)
You can’t perform that action at this time.