Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help using Lisp debugger

I'm trying understand how to interpret the output of, and use, the Lisp debugger.

I've got a pretty simple Backtrace for the evaluation of my function, but I cann't seem to work out how to use it to find out in which Lisp 'form' in my function the exception occurred.

I'd appreciate any clues as to what I should be doing, to find where in my code the error originated.

Also - why does the second frame display as "no debug information available for frame"?

I've attached a screen shot with the debugger, and repl (I've also included my function below - I know it's very wrong - but I'm just interested in learning to use the debugger properly). In addition, I hit 'v' on the first frame to go to the source, but this resulted in the error below the repl. (EDIT - the missing source code issue is fixed by downloading & copying it to the correct path)

alt text

(horrible function - no comments please!)

(defun myquicksort2 (lst)
  (if (eql 1 (length lst))
      lst
      (let ((mid (middle lst)))
    (do ((i 0 (+ i 1)))
        ((>= i mid) (append (myquicksort2 (subseq lst 0 mid))
                  (myquicksort2 (subseq lst mid (length lst)))))
      (if (> (ltval i lst) (nth 100 lst))
          (let ((tmp (ltval i lst)))
        (setf (nth i lst) (gtval i lst))
        (setf (nth (- (- (length lst) i) 1) lst)  tmp)))))))

(defun ltval (i lst)
  (nth i lst))

(defun gtval (i lst)
  (nth (- (- (length lst) i) 1) lst))

(defun middle (lst)
  (round (/ (length lst) 2)))
like image 877
Joel Avatar asked Jan 09 '11 17:01

Joel


1 Answers

The error is with > and you have only one > in your source, so that's where the problem is.

edit Built-in CL functions are highly prone to optimization in SBCL, so although the function call in your code is to CL:<, the code that's actually called (and which shows up in the debugger) is from an optimized, specific, SBCL-internal routine. This is less of an issue for user-defined functions, where you will be much more likely to get a useful frame.

like image 58
Xach Avatar answered Sep 22 '22 12:09

Xach