From ef04b756fea49f03ce543873b4606bac0a31badf Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Sun, 25 Nov 2001 23:21:05 +0000 Subject: [PATCH] 0.pre7.86.flaky7.11: (now bootstraps successfully, at least when :SB-SHOW to enable the new unbound-PRINT-OBJECT recovery stuff) added #!+SB-SHOW mechanism to catch and recover from unbound-PRINT-OBJECT gotchas in PCL bootstrapping --- src/code/print.lisp | 22 +++++++++++++++++++++- src/pcl/print-object.lisp | 8 +++++++- version.lisp-expr | 2 +- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/code/print.lisp b/src/code/print.lisp index 92d66f9..77ad049 100644 --- a/src/code/print.lisp +++ b/src/code/print.lisp @@ -429,6 +429,10 @@ (/show0 "in don't-bother-after-all case") (print-it stream))))) +;;; a hack for debugging +#!+sb-show +(defvar *print-object-is-disabled-p*) + ;;; Output OBJECT to STREAM observing all printer control variables ;;; except for *PRINT-PRETTY*. Note: if *PRINT-PRETTY* is non-NIL, ;;; then the pretty printer will be used for any components of OBJECT, @@ -464,7 +468,23 @@ (output-list object stream))) (instance (/show0 "in PRINT-OBJECT case") - (print-object object stream)) + #!-sb-show + (print-object object stream) + + ;; After being bitten several times by the difficulty of + ;; debugging problems around DEFGENERIC PRINT-OBJECT when the old + ;; placeholder printer is disabled by FMAKUNBOUND 'PRINT-OBJECT + ;; and/or DEFGENERIC has already executed but DEFMETHODs haven't, + ;; I added this workaround to allow output during that + ;; interval... -- WHN 2001-11-25 + #!+sb-show + (cond ((not (and (boundp '*print-object-is-disabled-p*) + *print-object-is-disabled-p*)) + (print-object object stream)) + ((typep object 'structure-object) + (default-structure-print object stream *current-level*)) + (t + (write-string "#")))) (function (unless (and (funcallable-instance-p object) (printed-as-funcallable-standard-class object stream)) diff --git a/src/pcl/print-object.lisp b/src/pcl/print-object.lisp index f3a8960..6436c3d 100644 --- a/src/pcl/print-object.lisp +++ b/src/pcl/print-object.lisp @@ -33,16 +33,22 @@ ;;; by the printer doing bootstrapping, and immediately replace it ;;; with some new printing logic, so that the Lisp printer stays ;;; crippled only for the shortest necessary time. +(/show0 "about to replace placeholder PRINT-OBJECT with DEFGENERIC") (let (;; (If we don't suppress /SHOW printing while the printer is ;; crippled here, it becomes really easy to crash the bootstrap ;; sequence by adding /SHOW statements e.g. to the compiler, ;; which kinda defeats the purpose of /SHOW being a harmless ;; tracing-style statement.) - #+sb-show (*/show* nil)) + #+sb-show (*/show* nil) + ;; (another workaround for the problem of debugging while the + ;; printer is disabled here) + #+sb-show + (sb-impl::*print-object-is-disabled-p* t)) (fmakunbound 'print-object) (defgeneric print-object (object stream)) (defmethod print-object ((x t) stream) (print-unreadable-object (x stream :type t :identity t)))) +(/show0 "done replacing placeholder PRINT-OBJECT with DEFGENERIC") ;;;; a hook called by the printer to take care of dispatching to PRINT-OBJECT ;;;; for appropriate FUNCALLABLE-INSTANCE objects diff --git a/version.lisp-expr b/version.lisp-expr index 88e5200..858e47b 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -18,4 +18,4 @@ ;;; for internal versions, especially for internal versions off the ;;; main CVS branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.pre7.86.flaky7.8" +"0.pre7.86.flaky7.11" -- 1.7.10.4