The Allegro debugger sometimes includes a local variable more than once as a variable in a frame. E.g.
(defun f (x y) (declare (optimize debug)) (zut (bar x) y))
Allegro itself lists the frame variables as:
Compiled lexical environment: 0(required): x: 1 1(required): y: 2 2(local): y: 2
This patch suppresses the duplicates as shown by Slime (which does not show the "required" / "local" labels).
- Willem
--- swank-allegro.lisp 10 Jun 2008 19:55:30 +0200 1.102 +++ swank-allegro.lisp 10 Jun 2008 22:16:09 +0200 @@ -173,11 +173,16 @@ (debugger:output-frame stream frame :moderate))
(defimplementation frame-locals (index) - (let ((frame (nth-frame index))) - (loop for i from 0 below (debugger:frame-number-vars frame) - collect (list :name (debugger:frame-var-name frame i) - :id 0 - :value (debugger:frame-var-value frame i))))) + (let* ((frame (nth-frame index)) + (locals (loop for i from 0 below (debugger:frame-number-vars frame) + collect (cons (debugger:frame-var-name frame i) + (debugger:frame-var-value frame i))))) + ;; Remove e.g. function arguments duplicated as local variables. + (setq locals (delete-duplicates locals :test (lambda (x y) + (and (eq (car x) (car y)) + (eq (cdr x) (cdr y)))))) + (loop for (name . val) in locals + collect (list :name name :id 0 :value val))))
(defimplementation frame-var-value (frame var) (let ((frame (nth-frame frame)))