X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fstep.lisp;h=66a83131ba9b76b40a093bc2a6644feb9818b148;hb=085501b44cc1cbdd9e260139d30b383372ddd1b8;hp=314d10c7fb4e8f38c954e8880cce3cee146cd9eb;hpb=b66385e2031fc2cac17dd129df0af400beb48a22;p=sbcl.git diff --git a/src/code/step.lisp b/src/code/step.lisp index 314d10c..66a8313 100644 --- a/src/code/step.lisp +++ b/src/code/step.lisp @@ -26,8 +26,12 @@ (setf *step-out* nil)) (step-out () :report "Resume stepping after returning from this function" - (disable-stepping) - (setf *step-out* t) + (ecase *step-out* + ((nil) + (error "Can't STEP-OUT: No STEP-IN on the call-stack")) + ((t :maybe) + (disable-stepping) + (setf *step-out* t))) nil) (step-next () :report "Step over call" @@ -41,16 +45,10 @@ (signal 'step-values-condition :form form :result values) (values-list values)) -(defvar *step-help* "The following commands are available at the single -stepper's prompt: - - S: Step into the current expression. - N: Evaluate the current expression without stepping. - C: Evaluate to finish without stepping. - Q: Abort evaluation. - B: Backtrace. - ?: Display this message. -") +(defun step-finished () + (restart-case + (signal 'step-finished-condition) + (continue ()))) (defgeneric single-step (condition)) @@ -76,6 +74,10 @@ stepper's prompt: (let ((*stack-top-hint* (sb-di::find-stepped-frame))) (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 #+sb-doc "Customization hook for alternative single-steppers. *STEPPER-HOOK* is bound to NIL prior to calling the bound function @@ -84,9 +86,10 @@ with the STEP-CONDITION as argument.") (defun invoke-stepper (condition) (when (and (stepping-enabled-p) *stepper-hook*) - (let ((hook *stepper-hook*) - (*stepper-hook* nil)) - (funcall hook condition)))) + (with-stepping-disabled + (let ((hook *stepper-hook*) + (*stepper-hook* nil)) + (funcall hook condition))))) (defmacro step (form) #+sb-doc @@ -95,9 +98,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 to be at least partially steppable." `(locally - (declare (optimize (sb-c:insert-step-conditions 0))) - (format t "Single stepping. Type ? for help.~%") + (declare (optimize debug (sb-c:insert-step-conditions 0))) + ;; Allow stepping out of the STEP form. (let ((*step-out* :maybe)) - (with-stepping-enabled - (locally (declare (optimize (sb-c:insert-step-conditions 3))) - ,form))))) + (unwind-protect + (with-stepping-enabled + (multiple-value-prog1 + (locally (declare (optimize (sb-c:insert-step-conditions 3))) + ,form) + (step-finished))))))) +