Friday, February 27, 2015

how slime enables debug info in sbcl

This is a copy-and-paste of an old Reddit post of mine.


Peter Keller (psilord) and I were talking about debugging CL and it prompted me to take a quick tour of how SLIME enables debug compilation for SBCL. This appears to be the general flow:
  1. C-u C-c C-k calls slime-compile-and-load-file (slime.el) with the default argument of 4. The default of 4 threw me. I don't know the history behind that.
  2. slime-compile-and-load-file (slime.el) generates a compute policy of '(cl:debug . 3)
  3. slime-compile-and-load-file (slime.el) calls slime-compile-file (slime.el) with arguments of (t '(cl:debug . 3))
  4. slime-compile-file (slime.el) calls the CL function swank:compile-file-for-emacs (swank.lisp)
  5. compile-file-for-emacs (swank.lisp) calls swank-compile-file* (swank.lisp)
  6. swank-compile-file* (swank.lisp) calls swank-compile-file (swank-sbcl.lisp)
  7. swank-compile-file (swank-sbcl.lisp) calls compiler-policy (swank-sbcl.lisp)
  8. compiler-policy (swank-sbcl.lisp) calls (sb-ext:restrict-compiler-policy 'cl:debug 3)

No comments:

Post a Comment