Commit 6fedcdf1 authored by Juho Snellman's avatar Juho Snellman
Browse files

0.9.16.44:

        Stepper tweaks:

        * Inhibit stepping while calling the stepper hook.
        * Make the body of STEP steppable
        * Signal a STEP-FINISHED-CONDITION when STEP returns
parent 9943ee51
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -709,7 +709,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
               "WITH-TIMEOUT" "TIMEOUT"
               "WITH-TIMEOUT" "TIMEOUT"


               ;; stepping interface
               ;; stepping interface
               "STEP-CONDITION" "STEP-FORM-CONDITION"
               "STEP-CONDITION" "STEP-FORM-CONDITION" "STEP-FINISHED-CONDITION"
               "STEP-VALUES-CONDITION" "STEP-VARIABLE-CONDITION"
               "STEP-VALUES-CONDITION" "STEP-VARIABLE-CONDITION"
               "STEP-CONDITION-FORM" "STEP-CONDITION-RESULT"
               "STEP-CONDITION-FORM" "STEP-CONDITION-RESULT"
               "STEP-CONTINUE" "STEP-NEXT" "STEP-INTO"
               "STEP-CONTINUE" "STEP-NEXT" "STEP-INTO"
+9 −0
Original line number Original line Diff line number Diff line
@@ -1226,6 +1226,15 @@ single-stepping information after executing a form.
STEP-CONDITION-FORM holds the form, and STEP-CONDITION-RESULT holds
STEP-CONDITION-FORM holds the form, and STEP-CONDITION-RESULT holds
the values returned by the form as a list. No associated restarts."))
the values returned by the form as a list. No associated restarts."))


(define-condition step-finished-condition (step-condition)
  ()
  (:report
   (lambda (condition stream)
     (declare (ignore condition))
     (format stream "Returning from STEP")))
  #!+sb-doc
  (:documentation "Condition signaled when STEP returns."))



;;;; restart definitions
;;;; restart definitions


+21 −7
Original line number Original line Diff line number Diff line
@@ -41,6 +41,11 @@
  (signal 'step-values-condition :form form :result values)
  (signal 'step-values-condition :form form :result values)
  (values-list values))
  (values-list values))


(defun step-finished ()
  (restart-case
      (signal 'step-finished-condition)
    (continue ())))

(defvar *step-help* "The following commands are available at the single
(defvar *step-help* "The following commands are available at the single
stepper's prompt:
stepper's prompt:


@@ -76,6 +81,10 @@ stepper's prompt:
    (let ((*stack-top-hint* (sb-di::find-stepped-frame)))
    (let ((*stack-top-hint* (sb-di::find-stepped-frame)))
      (invoke-debugger condition))))
      (invoke-debugger condition))))


;;; In the TTY debugger we're not interested in STEP returning
(defmethod single-step ((condition step-finished-condition))
  (values))

(defvar *stepper-hook* 'single-step
(defvar *stepper-hook* 'single-step
  #+sb-doc "Customization hook for alternative single-steppers.
  #+sb-doc "Customization hook for alternative single-steppers.
*STEPPER-HOOK* is bound to NIL prior to calling the bound function
*STEPPER-HOOK* is bound to NIL prior to calling the bound function
@@ -84,9 +93,10 @@ with the STEP-CONDITION as argument.")
(defun invoke-stepper (condition)
(defun invoke-stepper (condition)
  (when (and (stepping-enabled-p)
  (when (and (stepping-enabled-p)
             *stepper-hook*)
             *stepper-hook*)
    (with-stepping-disabled
      (let ((hook *stepper-hook*)
      (let ((hook *stepper-hook*)
            (*stepper-hook* nil))
            (*stepper-hook* nil))
      (funcall hook condition))))
        (funcall hook condition)))))


(defmacro step (form)
(defmacro step (form)
  #+sb-doc
  #+sb-doc
@@ -95,9 +105,13 @@ outside the lexical scope of the form can be stepped into only if the
functions in question have been compiled with sufficient DEBUG policy
functions in question have been compiled with sufficient DEBUG policy
to be at least partially steppable."
to be at least partially steppable."
  `(locally
  `(locally
       (declare (optimize (sb-c:insert-step-conditions 0)))
       (declare (optimize debug (sb-c:insert-step-conditions 0)))
     (format t "Single stepping. Type ? for help.~%")
     (format t "Single stepping. Type ? for help.~%")
     (let ((*step-out* :maybe))
     (let ((*step-out* :maybe))
       (unwind-protect
            (with-stepping-enabled
            (with-stepping-enabled
              (multiple-value-prog1
                  (locally (declare (optimize (sb-c:insert-step-conditions 3)))
                  (locally (declare (optimize (sb-c:insert-step-conditions 3)))
           ,form)))))
                    ,form)
                (step-finished)))))))
+1 −1
Original line number Original line Diff line number Diff line
@@ -17,4 +17,4 @@
;;; checkins which aren't released. (And occasionally for internal
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
"0.9.16.43"
"0.9.16.44"