0.pre7.122:
[sbcl.git] / src / code / debug-int.lisp
index ba25763..69182e8 100644 (file)
   ;; the DEBUG-FUN containing this CODE-LOCATION
   (debug-fun nil :type debug-fun)
   ;; This is initially :UNSURE. Upon first trying to access an
-  ;; :unparsed slot, if the data is unavailable, then this becomes t,
+  ;; :UNPARSED slot, if the data is unavailable, then this becomes T,
   ;; and the code-location is unknown. If the data is available, this
-  ;; becomes nil, a known location. We can't use a separate type
+  ;; becomes NIL, a known location. We can't use a separate type
   ;; code-location for this since we must return code-locations before
   ;; we can tell whether they're known or unknown. For example, when
   ;; parsing the stack, we don't want to unpack all the variables and
 \f
 ;;;; frame utilities
 
-;;; This returns a COMPILED-DEBUG-FUN for code and pc. We fetch the
+;;; This returns a COMPILED-DEBUG-FUN for COMPONENT and PC. We fetch the
 ;;; SB!C::DEBUG-INFO and run down its FUN-MAP to get a
-;;; SB!C::COMPILED-DEBUG-FUN from the pc. The result only needs to
-;;; reference the component, for function constants, and the
+;;; SB!C::COMPILED-DEBUG-FUN from the PC. The result only needs to
+;;; reference the COMPONENT, for function constants, and the
 ;;; SB!C::COMPILED-DEBUG-FUN.
 (defun debug-fun-from-pc (component pc)
   (let ((info (%code-debug-info component)))
      ((eq info :bogus-lra)
       (make-bogus-debug-fun "function end breakpoint"))
      (t
-      (let* ((fun-map (get-debug-info-fun-map info))
+      (let* ((fun-map (sb!c::compiled-debug-info-fun-map info))
             (len (length fun-map)))
        (declare (type simple-vector fun-map))
        (if (= len 1)
 ;;; Return the name of the function represented by DEBUG-FUN. This may
 ;;; be a string or a cons; do not assume it is a symbol.
 (defun debug-fun-name (debug-fun)
+  (declare (type debug-fun debug-fun))
   (etypecase debug-fun
     (compiled-debug-fun
      (sb!c::compiled-debug-fun-name
                     (and (sb!c::compiled-debug-fun-p x)
                          (eq (sb!c::compiled-debug-fun-name x) name)
                          (eq (sb!c::compiled-debug-fun-kind x) nil)))
-                  (get-debug-info-fun-map
+                  (sb!c::compiled-debug-info-fun-map
                    (%code-debug-info component)))))
        (if res
            (make-compiled-debug-fun res component)
           (simple-string name))
   (let ((name-len (length name)))
     (position name variables
-             :test #'(lambda (x y)
-                       (let* ((y (debug-var-symbol-name y))
-                              (y-len (length y)))
-                         (declare (simple-string y))
-                         (and (>= y-len name-len)
-                              (string= x y :end1 name-len :end2 name-len))))
+             :test (lambda (x y)
+                     (let* ((y (debug-var-symbol-name y))
+                            (y-len (length y)))
+                       (declare (simple-string y))
+                       (and (>= y-len name-len)
+                            (string= x y :end1 name-len :end2 name-len))))
              :end (or end (length variables)))))
 
 ;;; Return a list representing the lambda-list for DEBUG-FUN. The
                                                         save-sc-offset)
                                buffer)))))))
 \f
-;;;; unpacking minimal debug functions
-
-;;; Return a FUN-MAP for a given COMPILED-DEBUG-INFO object.
-(defun get-debug-info-fun-map (info)
-  (declare (type sb!c::compiled-debug-info info))
-  (let ((map (sb!c::compiled-debug-info-fun-map info)))
-    ;; The old CMU CL had various hairy possibilities here, but in
-    ;; SBCL we only use this one, right? 
-    (aver (simple-vector-p map))
-    ;; So it's easy..
-    map))
-\f
 ;;;; CODE-LOCATIONs
 
 ;;; If we're sure of whether code-location is known, return T or NIL.
        ;; interpreter.)
        ))
     ;; (There used to be more cases back before sbcl-0.7.0,,
-    ;; when we did special tricks to debug the IR1
-    ;; interpreter.)
+    ;; when we did special tricks to debug IR1-interpreted code.)
     ))
 (defun sub-compiled-code-location= (obj1 obj2)
   (= (compiled-code-location-pc obj1)
                            (declare (ignorable ,n-frame))
                            (symbol-macrolet ,(specs) ,form))
                         'function)))
-       #'(lambda (frame)
-           ;; This prevents these functions from being used in any
-           ;; location other than a function return location, so
-           ;; maybe this should only check whether frame's
-           ;; DEBUG-FUN is the same as loc's.
-           (unless (code-location= (frame-code-location frame) loc)
-             (debug-signal 'frame-fun-mismatch
-                           :code-location loc :form form :frame frame))
-           (funcall res frame))))))
+       (lambda (frame)
+         ;; This prevents these functions from being used in any
+         ;; location other than a function return location, so maybe
+         ;; this should only check whether FRAME's DEBUG-FUN is the
+         ;; same as LOC's.
+         (unless (code-location= (frame-code-location frame) loc)
+           (debug-signal 'frame-fun-mismatch
+                         :code-location loc :form form :frame frame))
+         (funcall res frame))))))
 \f
 ;;;; breakpoints
 
 (defun fun-end-starter-hook (starter-bpt debug-fun)
   (declare (type breakpoint starter-bpt)
           (type compiled-debug-fun debug-fun))
-  #'(lambda (frame breakpoint)
-      (declare (ignore breakpoint)
-              (type frame frame))
-      (let ((lra-sc-offset
-            (sb!c::compiled-debug-fun-return-pc
-             (compiled-debug-fun-compiler-debug-fun debug-fun))))
-       (multiple-value-bind (lra component offset)
-           (make-bogus-lra
-            (get-context-value frame
-                               lra-save-offset
-                               lra-sc-offset))
-         (setf (get-context-value frame
-                                  lra-save-offset
-                                  lra-sc-offset)
-               lra)
-         (let ((end-bpts (breakpoint-%info starter-bpt)))
-           (let ((data (breakpoint-data component offset)))
-             (setf (breakpoint-data-breakpoints data) end-bpts)
-             (dolist (bpt end-bpts)
-               (setf (breakpoint-internal-data bpt) data)))
-           (let ((cookie (make-fun-end-cookie lra debug-fun)))
-             (setf (gethash component *fun-end-cookies*) cookie)
-             (dolist (bpt end-bpts)
-               (let ((fun (breakpoint-cookie-fun bpt)))
-                 (when fun (funcall fun frame cookie))))))))))
+  (lambda (frame breakpoint)
+    (declare (ignore breakpoint)
+            (type frame frame))
+    (let ((lra-sc-offset
+          (sb!c::compiled-debug-fun-return-pc
+           (compiled-debug-fun-compiler-debug-fun debug-fun))))
+      (multiple-value-bind (lra component offset)
+         (make-bogus-lra
+          (get-context-value frame
+                             lra-save-offset
+                             lra-sc-offset))
+       (setf (get-context-value frame
+                                lra-save-offset
+                                lra-sc-offset)
+             lra)
+       (let ((end-bpts (breakpoint-%info starter-bpt)))
+         (let ((data (breakpoint-data component offset)))
+           (setf (breakpoint-data-breakpoints data) end-bpts)
+           (dolist (bpt end-bpts)
+             (setf (breakpoint-internal-data bpt) data)))
+         (let ((cookie (make-fun-end-cookie lra debug-fun)))
+           (setf (gethash component *fun-end-cookies*) cookie)
+           (dolist (bpt end-bpts)
+             (let ((fun (breakpoint-cookie-fun bpt)))
+               (when fun (funcall fun frame cookie))))))))))
 
 ;;; This takes a FUN-END-COOKIE and a frame, and it returns
 ;;; whether the cookie is still valid. A cookie becomes invalid when
 (defun deactivate-compiled-breakpoint (breakpoint)
   (if (eq (breakpoint-kind breakpoint) :fun-end)
       (let ((starter (breakpoint-start-helper breakpoint)))
-       (unless (find-if #'(lambda (bpt)
-                            (and (not (eq bpt breakpoint))
-                                 (eq (breakpoint-status bpt) :active)))
+       (unless (find-if (lambda (bpt)
+                          (and (not (eq bpt breakpoint))
+                               (eq (breakpoint-status bpt) :active)))
                         (breakpoint-%info starter))
          (deactivate-compiled-breakpoint starter)))
       (let* ((data (breakpoint-internal-data breakpoint))