Search code examples
emacslispcommon-lispslimesbcl

Debugging Lisp & SLIME, error "Cannot find source location"


I am wrote the code with bugs.

Example:

(print (/ 1 0))

I am trying compile with C-c C-c. And catch the error with stack frame.

I want see line in the code where an error occured. Clicked 'v' on line in stack frame and catched error.

Error: Cannot find source location for: #<COMPILED-CODE-LOCATION 
(SB-C::VARARGS-ENTRY /)>  

How can I go to the line in my code?

Screenshot: enter image description here


Solution

  • As you can see from the error, the line you want to jump to, is somewhere in package SB-C, which is part of SBCL. If you don't have SBCL sources (you've installed a binary or deleted them), you should get them (relevant to your current SBCL version) and then link them up in .sbclrc like this (according to http://www.cliki.net/SLIME%20Features):

    (setf (logical-pathname-translations "SYS") 
          '(("SYS:SRC;**;*.*.*" #P"/opt/sbcl/src/**/*.*")
            ("SYS:CONTRIB;**;*.*.*" #P"/opt/sbcl/contrib/**/*.*")))
    

    Or just compile SBCL from source and it will know, where they are.