From 48ce739de247d0613759bb676ca7e72e687e35b9 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Fri, 4 Aug 2006 14:14:12 +0000 Subject: [PATCH] 0.9.15.9: Changes to DISABLE-DEBUGGER: * Allow disabling the debugger when *INVOKE-DEBUGGER-HOOK* is non-nil, so that --disable-debugger works even when restoring cores where that has been done. * Store the old value of *I-D-H* when disabling the debugger, and restore it back when enabling the debugger. * Fix a bug where LDB wouldn't get disabled by --disable-debugger if the core had been saved from an sbcl instance where the debugger was disabled. --- src/code/cold-init.lisp | 5 +++++ src/code/debug.lisp | 30 ++++++++++++++++++------------ version.lisp-expr | 2 +- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/code/cold-init.lisp b/src/code/cold-init.lisp index fd3ee81..034e5bf 100644 --- a/src/code/cold-init.lisp +++ b/src/code/cold-init.lisp @@ -306,7 +306,12 @@ UNIX-like systems, UNIX-STATUS is used as the status code." (gc-reinit) ;; make sure TIME works correctly from saved cores (setf *internal-real-time-base-seconds* nil) + (setf *gc-run-time* 0) (foreign-reinit) + ;; If the debugger was disabled in the saved core, we need to + ;; re-disable ldb again. + (when (eq *invoke-debugger-hook* 'sb!debug::debugger-disabled-hook) + (sb!debug::disable-debugger)) (dolist (hook *init-hooks*) (with-simple-restart (continue "Skip this initialization hook.") (funcall hook)))) diff --git a/src/code/debug.lisp b/src/code/debug.lisp index c829c18..510501e 100644 --- a/src/code/debug.lisp +++ b/src/code/debug.lisp @@ -647,24 +647,30 @@ reset to ~S." "Argh! error within --disable-debugger error handling")) (failure-quit :recklessly-p t))))) +(defvar *old-debugger-hook* nil) + ;;; halt-on-failures and prompt-on-failures modes, suitable for ;;; noninteractive and interactive use respectively (defun disable-debugger () - ;; Why conditionally? Why not disable it even if user has frobbed - ;; this hook? We could just save the old value in case of a later - ;; ENABLE-DEBUGGER. - (when (eql *invoke-debugger-hook* nil) - ;; *DEBUG-IO* used to be set here to *ERROR-OUTPUT* which is sort - ;; of unexpected but mostly harmless, but then ENABLE-DEBUGGER had - ;; to set it to a suitable value again and be very careful, - ;; especially if the user has also set it. -- MG 2005-07-15 - (setf *invoke-debugger-hook* 'debugger-disabled-hook) - (sb!alien:alien-funcall (sb!alien:extern-alien "disable_lossage_handler" (function sb!alien:void))))) + ;; *DEBUG-IO* used to be set here to *ERROR-OUTPUT* which is sort + ;; of unexpected but mostly harmless, but then ENABLE-DEBUGGER had + ;; to set it to a suitable value again and be very careful, + ;; especially if the user has also set it. -- MG 2005-07-15 + (unless (eq *invoke-debugger-hook* 'debugger-disabled-hook) + (setf *old-debugger-hook* *invoke-debugger-hook* + *invoke-debugger-hook* 'debugger-disabled-hook)) + ;; This is not inside the UNLESS to ensure that LDB is disabled + ;; regardless of what the old value of *INVOKE-DEBUGGER-HOOK* was. + ;; This might matter for example when restoring a core. + (sb!alien:alien-funcall (sb!alien:extern-alien "disable_lossage_handler" + (function sb!alien:void)))) (defun enable-debugger () (when (eql *invoke-debugger-hook* 'debugger-disabled-hook) - (setf *invoke-debugger-hook* nil) - (sb!alien:alien-funcall (sb!alien:extern-alien "enable_lossage_handler" (function sb!alien:void))))) + (setf *invoke-debugger-hook* *old-debugger-hook* + *old-debugger-hook* nil)) + (sb!alien:alien-funcall (sb!alien:extern-alien "enable_lossage_handler" + (function sb!alien:void)))) (defun show-restarts (restarts s) (cond ((null restarts) diff --git a/version.lisp-expr b/version.lisp-expr index 71152e1..12c9857 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.15.8" +"0.9.15.9" -- 1.7.10.4