X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdebug.lisp;h=e89d0125137239b6f3c1ec837e8095548be1f4b8;hb=77360ee4a1f94c41b807be7ad0e8687199fceef1;hp=0a6cb5c731ba11217780aa76c30208eff105f68d;hpb=b08344ddbb8d0193054b72c01be7e367422ccf03;p=sbcl.git diff --git a/src/code/debug.lisp b/src/code/debug.lisp index 0a6cb5c..e89d012 100644 --- a/src/code/debug.lisp +++ b/src/code/debug.lisp @@ -595,7 +595,19 @@ Function and macro commands: (let ((*debugger-hook* nil)) (funcall hook condition hook)))) (sb!unix:unix-sigsetmask 0) - (let ((original-package *package*)) ; protected from WITH-STANDARD-IO-SYNTAX + + ;; Elsewhere in the system, we use the SANE-PACKAGE function for + ;; this, but here causing an exception just as we're trying to handle + ;; an exception would be confusing, so instead we use a special hack. + (unless (and (packagep *package*) + (package-name *package*)) + (setf *package* (find-package :cl-user)) + (format *error-output* + "The value of ~S was not an undeleted PACKAGE. It has been +reset to ~S." + '*package* *package*)) + (let (;; Save *PACKAGE* to protect it from WITH-STANDARD-IO-SYNTAX. + (original-package *package*)) (with-standard-io-syntax (let* ((*debug-condition* condition) (*debug-restarts* (compute-restarts condition)) @@ -775,9 +787,7 @@ Function and macro commands: (unless (boundp '*) (setq * nil) (fresh-line) - ;; FIXME: Perhaps this shouldn't be WARN (for fear of complicating - ;; the debugging situation?) but at least it should go to *ERROR-OUTPUT*. - ;; (And probably it should just be WARN.) + ;; FIXME: The way INTERACTIVE-EVAL does this seems better. (princ "Setting * to NIL (was unbound marker).")))) ;;;; debug loop functions @@ -1200,8 +1210,9 @@ Function and macro commands: ;;;; source location printing -;;; We cache a stream to the last valid file debug source so that we won't have -;;; to repeatedly open the file. +;;; We cache a stream to the last valid file debug source so that we +;;; won't have to repeatedly open the file. +;;; ;;; KLUDGE: This sounds like a bug, not a feature. Opening files is fast ;;; in the 1990s, so the benefit is negligible, less important than the ;;; potential of extra confusion if someone changes the source during @@ -1224,16 +1235,17 @@ Function and macro commands: *cached-readtable* nil)) sb!int:*before-save-initializations*) -;;; We also cache the last top-level form that we printed a source for so that -;;; we don't have to do repeated reads and calls to FORM-NUMBER-TRANSLATIONS. +;;; We also cache the last top-level form that we printed a source for +;;; so that we don't have to do repeated reads and calls to +;;; FORM-NUMBER-TRANSLATIONS. (defvar *cached-top-level-form-offset* nil) (declaim (type (or index null) *cached-top-level-form-offset*)) (defvar *cached-top-level-form*) (defvar *cached-form-number-translations*) -;;; Given a code location, return the associated form-number translations and -;;; the actual top-level form. We check our cache --- if there is a miss, we -;;; dispatch on the kind of the debug source. +;;; Given a code location, return the associated form-number +;;; translations and the actual top-level form. We check our cache --- +;;; if there is a miss, we dispatch on the kind of the debug source. (defun get-top-level-form (location) (let ((d-source (sb!di:code-location-debug-source location))) (if (and (eq d-source *cached-debug-source*) @@ -1250,9 +1262,9 @@ Function and macro commands: (sb!di:form-number-translations res offset)) (setq *cached-top-level-form* res)))))) -;;; Locates the source file (if it still exists) and grabs the top-level form. -;;; If the file is modified, we use the top-level-form offset instead of the -;;; recorded character offset. +;;; Locate the source file (if it still exists) and grab the top-level +;;; form. If the file is modified, we use the top-level-form offset +;;; instead of the recorded character offset. (defun get-file-top-level-form (location) (let* ((d-source (sb!di:code-location-debug-source location)) (tlf-offset (sb!di:code-location-top-level-form-offset location))