anchor.diff:      (return-address-to-function return-address)))
   
   (defun read-frame-slot (frame slot &optional (repr :value))
  -  (when (not (integerp slot))
  -    (return-from read-frame-slot
  -      :$inaccessible-value$))
  -  (let ((address (+ (memref-unsigned-byte-64 (second frame) 0)
  -                    (* (- (1+ slot)) 8))))
  -    (case repr
  -      (:value
  -       (memref-t address))
  -      (:single-float
  -       (%integer-as-single-float (memref-unsigned-byte-32 address)))
  -      (:double-float
  -       (%integer-as-double-float (memref-unsigned-byte-64 address)))
  -      (t
  -       :$inaccessible-value$))))
  +  (typecase slot
  +    (integer
  +     ;; Stack frame index.
  +     (let ((address (+ (memref-unsigned-byte-64 (second frame) 0)
  +                       (* (- (1+ slot)) 8))))
  +       (case repr
  +         (:value
  +          (memref-t address))
  +         (:single-float
  +          (%integer-as-single-float (memref-unsigned-byte-32 address)))
  +         (:double-float
  +          (%integer-as-double-float (memref-unsigned-byte-64 address)))
  +         (t
  +          :$inaccessible-value$))))
  +    (cons
  +     ;; Environment vector/index pair.
  +     (if (eql repr :value)
  +         (elt (car slot) (cdr slot))
  +         :$inaccessible-value$))
  +    (t
  +     ;; A register?
  +     :$inaccessible-value$)))
   
   (defun write-frame-slot (frame slot value &optional (repr :value))
  -  (when (not (integerp slot))
  -    (error "Cannot write to this variable. Not on stack."))
  -  (let ((address (+ (memref-unsigned-byte-64 (second frame) 0)
  -                    (* (- (1+ slot)) 8))))
  -    (case repr
  -      (:value
  -       (setf (memref-t address) value))
  -      (:single-float
  -       (setf (memref-unsigned-byte-32 address) (%single-float-as-integer value)))
  -      (:double-float
  -       (setf (memref-unsigned-byte-64 address) (%double-float-as-integer value)))
  -      (t
  -       (error "Cannot write to this variable. Unknown representation ~S." repr)))))
  +  (typecase slot
  +    (integer
  +     ;; Stack frame index.
  +     (let ((address (+ (memref-unsigned-byte-64 (second frame) 0)
  +                       (* (- (1+ slot)) 8))))
  +       (case repr
  +         (:value
  +          (setf (memref-t address) value))
  +         (:single-float
  +          (setf (memref-unsigned-byte-32 address) (%single-float-as-integer value)))
  +         (:double-float
  +          (setf (memref-unsigned-byte-64 address) (%double-float-as-integer value)))
  +         (t
  +          (error "Cannot write to this variable. Unknown representation ~S." repr)))))
  +    (cons
  +     ;; Environment vector/index pair.
  +     (if (eql repr :value)
  +         (elt (car slot) (cdr slot))
  +         (error "Cannot write to this variable. Unsupported representation ~S for environment access" repr)))
  +    (t
  +     ;; A register?
  +     (error "Cannot write to this variable. Unsupported location ~S" slot))))
   
   (defun show-debug-frame ()
     (multiple-value-bind (function offset)
  
positive.code:                   (loop
                       for i from 1
                       for name in level
                       when (and name
                                 (eql (incf var-id) id))
                       do
                         (return-from debugger-read-variable
                           (values (svref env-object i) name)))
                    (setf env-object (svref env-object 0))))))))))
    (format t "Unknown variable id ~S." id))
  
  (defun debugger-write-variable (frame id value)
    (multiple-value-bind (fn offset)
        (function-from-frame frame)
      (let* ((info (function-debug-info fn))
             (var-id 0))
        (loop
           for (name location repr . plist) in (local-variables-at-offset fn offset)
           do (destructuring-bind (&key hidden)
                  plist
                (when (not hidden)
                  (when (eql (incf var-id) id)
                    (write-frame-slot frame location value repr)
                    (return-from debugger-write-variable name)))))
        (multiple-value-bind (env-slot env-layout)
            (sys.int::debug-info-closure-layout info)
          (when env-slot
            (let ((env-object (read-frame-slot frame env-slot)))
              (dolist (level env-layout)
                (loop
                   for i from 1
                   for name in level
                   when (and name
                             (eql (incf var-id) id))
                   do
                     (setf (svref env-object i) value)
                     (return-from debugger-write-variable name))
                (setf env-object (svref env-object 0))))))
        (multiple-value-bind (env-var env-layout)
            (sys.int::debug-info-precise-closure-layout info)
          (when env-var
            (let ((env-slot (second (find env-var (local-variables-at-offset fn offset)
                                          :key #'first))))
              (when env-slot
                (let ((env-object (read-frame-slot frame env-slot)))
                  (dolist (level env-layout)
                    (loop
                       for i from 1
                       for name in level
                       when (and name
                                 (eql (incf var-id) id))
                       do
                         (setf (svref env-object i) value)
                         (return-from debugger-write-variable name))
                    (setf env-object (svref env-object 0))))))))))
    (format t "Unknown variable id ~S." id))
  
  (defun enter-debugger (condition)
    (with-standard-io-syntax
  
negative.code:             (setf last-layout layout))
         finally (return last-layout))))
  
  (defun frame-locals (frame &key show-hidden)
    (multiple-value-bind (fn offset)
        (function-from-frame frame)
      (let* ((info (function-debug-info fn))
             (var-id 0)
             (result '()))
        (loop
           for (name location repr . plist) in (local-variables-at-offset fn offset)
           do (destructuring-bind (&key hidden)
                  plist
                (when (or show-hidden (not hidden))
                  (push (list name (incf var-id) location repr) result))))
        (multiple-value-bind (env-slot env-layout)
            (sys.int::debug-info-closure-layout info)
          (when env-slot
  