+
+(defun noprogrammer-debugger-hook-fun (condition old-debugger-hook)
+ (declare (ignore old-debugger-hook))
+ (flet ((failure-quit (&key recklessly-p)
+ (quit :unix-status 1 :recklessly-p recklessly-p)))
+ ;; This HANDLER-CASE is here mostly to stop output immediately
+ ;; (and fall through to QUIT) when there's an I/O error. Thus,
+ ;; when we're run under a Perl script or something, we can die
+ ;; cleanly when the script dies (and our pipes are cut), instead
+ ;; of falling into ldb or something messy like that.
+ (handler-case
+ (progn
+ (format *error-output*
+ "~@<unhandled CONDITION (of type ~S): ~2I~_~A~:>~2%"
+ (type-of condition)
+ condition)
+ ;; Flush *ERROR-OUTPUT* even before the BACKTRACE, so that
+ ;; even if we hit an error within BACKTRACE we'll at least
+ ;; have the CONDITION printed out before we die.
+ (finish-output *error-output*)
+ ;; (Where to truncate the BACKTRACE is of course arbitrary, but
+ ;; it seems as though we should at least truncate it somewhere.)
+ (sb!debug:backtrace 128 *error-output*)
+ (finish-output *error-output*)
+ (format *error-output*
+ "~%unhandled CONDITION in --noprogrammer mode, quitting~%")
+ (failure-quit))
+ (condition ()
+ (%primitive print "Argh! error within --noprogrammer error handling")
+ (failure-quit :recklessly-p t)))))