0.7.1.1:
[sbcl.git] / src / code / toplevel.lisp
1 ;;;; stuff related to the toplevel read-eval-print loop, plus some
2 ;;;; other miscellaneous functions that we don't have any better place
3 ;;;; for
4
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
13
14 (in-package "SB!IMPL")
15 \f
16 ;;;; magic specials initialized by GENESIS
17
18 ;;; FIXME: The DEFVAR here is redundant with the (DECLAIM (SPECIAL ..))
19 ;;; of all static symbols in early-impl.lisp.
20 (progn
21   (defvar *current-catch-block*)
22   (defvar *current-unwind-protect-block*)
23   (defvar *free-interrupt-context-index*))
24 \f
25 ;;; specials initialized by !COLD-INIT
26
27 ;;; FIXME: These could be converted to DEFVARs.
28 (declaim (special *gc-inhibit* *already-maybe-gcing*
29                   *need-to-collect-garbage*
30                   *gc-notify-stream*
31                   *before-gc-hooks* *after-gc-hooks*
32                   #!+x86 *pseudo-atomic-atomic*
33                   #!+x86 *pseudo-atomic-interrupted*
34                   sb!unix::*interrupts-enabled*
35                   sb!unix::*interrupt-pending*
36                   *type-system-initialized*))
37
38 (defvar *cold-init-complete-p*)
39
40 ;;; counts of nested errors (with internal errors double-counted)
41 (defvar *maximum-error-depth*)
42 (defvar *current-error-depth*)
43 \f
44 ;;;; miscellaneous utilities for working with with TOPLEVEL
45
46 ;;; Execute BODY in a context where any %END-OF-THE-WORLD (thrown e.g.
47 ;;; by QUIT) is caught and any final processing and return codes are
48 ;;; handled appropriately.
49 (defmacro handling-end-of-the-world (&body body)
50   (let ((caught (gensym "CAUGHT")))
51     `(let ((,caught (catch '%end-of-the-world
52                       (/show0 "inside CATCH '%END-OF-THE-WORLD")
53                       ,@body)))
54        (/show0 "back from CATCH '%END-OF-THE-WORLD, flushing output")
55        (flush-standard-output-streams)
56        (/show0 "calling UNIX-EXIT")
57        (sb!unix:unix-exit ,caught))))
58 \f
59 ;;;; working with *CURRENT-ERROR-DEPTH* and *MAXIMUM-ERROR-DEPTH*
60
61 ;;; INFINITE-ERROR-PROTECT is used by ERROR and friends to keep us out
62 ;;; of hyperspace.
63 (defmacro infinite-error-protect (&rest forms)
64   `(unless (infinite-error-protector)
65      (/show0 "back from INFINITE-ERROR-PROTECTOR")
66      (let ((*current-error-depth* (1+ *current-error-depth*)))
67        (/show0 "in INFINITE-ERROR-PROTECT, incremented error depth")
68        #+sb-show (sb-debug:backtrace)
69        ,@forms)))
70
71 ;;; a helper function for INFINITE-ERROR-PROTECT
72 (defun infinite-error-protector ()
73   (/show0 "entering INFINITE-ERROR-PROTECTOR, *CURRENT-ERROR-DEPTH*=..")
74   (/hexstr *current-error-depth*)
75   (cond ((not *cold-init-complete-p*)
76          (%primitive print "Argh! error in cold init, halting")
77          (%primitive sb!c:halt))
78         ((or (not (boundp '*current-error-depth*))
79              (not (realp   *current-error-depth*))
80              (not (boundp '*maximum-error-depth*))
81              (not (realp   *maximum-error-depth*)))
82          (%primitive print "Argh! corrupted error depth, halting")
83          (%primitive sb!c:halt))
84         ((> *current-error-depth* *maximum-error-depth*)
85          (/show0 "*MAXIMUM-ERROR-DEPTH*=..")
86          (/hexstr *maximum-error-depth*)
87          (/show0 "in INFINITE-ERROR-PROTECTOR, calling ERROR-ERROR")
88          (error-error "Help! "
89                       *current-error-depth*
90                       " nested errors. "
91                       "KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.")
92          t)
93         (t
94          (/show0 "returning normally from INFINITE-ERROR-PROTECTOR")
95          nil)))
96
97 ;;; FIXME: I had a badly broken version of INFINITE-ERROR-PROTECTOR at
98 ;;; one point (shown below), and SBCL cross-compiled it without
99 ;;; warning about FORMS being undefined. Check whether that problem
100 ;;; (missing warning) is repeatable in the final system and if so, fix
101 ;;; it.
102 #|
103 (defun infinite-error-protector ()
104   `(cond ((not *cold-init-complete-p*)
105           (%primitive print "Argh! error in cold init, halting")
106           (%primitive sb!c:halt))
107          ((or (not (boundp '*current-error-depth*))
108               (not (realp   *current-error-depth*))
109               (not (boundp '*maximum-error-depth*))
110               (not (realp   *maximum-error-depth*)))
111           (%primitive print "Argh! corrupted error depth, halting")
112           (%primitive sb!c:halt))
113          ((> *current-error-depth* *maximum-error-depth*)
114           (/show0 "in INFINITE-ERROR-PROTECTOR, calling ERROR-ERROR")
115           (error-error "Help! "
116                        *current-error-depth*
117                        " nested errors. "
118                        "KERNEL:*MAXIMUM-ERROR-DEPTH* exceeded.")
119           (progn ,@forms)
120           t)
121          (t
122           (/show0 "in INFINITE-ERROR-PROTECTOR, returning normally")
123           nil)))
124 |#
125 \f
126 ;;;; miscellaneous external functions
127
128 #!-mp ; The multi-processing version is defined in multi-proc.lisp.
129 (defun sleep (n)
130   #!+sb-doc
131   "This function causes execution to be suspended for N seconds. N may
132   be any non-negative, non-complex number."
133   (when (or (not (realp n))
134             (minusp n))
135     (error 'simple-type-error
136            :format-control "invalid argument to SLEEP: ~S"
137            :format-arguments (list n)
138            :datum n
139            :expected-type '(real 0)))
140   (multiple-value-bind (sec usec)
141       (if (integerp n)
142           (values n 0)
143           (multiple-value-bind (sec frac)
144               (truncate n)
145             (values sec (truncate frac 1e-6))))
146     (sb!unix:unix-select 0 0 0 0 sec usec))
147   nil)
148 \f
149 ;;;; SCRUB-CONTROL-STACK
150
151 (defconstant bytes-per-scrub-unit 2048)
152
153 ;;; Zero the unused portion of the control stack so that old objects
154 ;;; are not kept alive because of uninitialized stack variables.
155 ;;;
156 ;;; FIXME: Why do we need to do this instead of just letting GC read
157 ;;; the stack pointer and avoid messing with the unused portion of
158 ;;; the control stack? (Is this a multithreading thing where there's
159 ;;; one control stack and stack pointer per thread, and it might not
160 ;;; be easy to tell what a thread's stack pointer value is when
161 ;;; looking in from another thread?)
162 (defun scrub-control-stack ()
163   (declare (optimize (speed 3) (safety 0))
164            (values (unsigned-byte 20))) ; FIXME: DECLARE VALUES?
165
166   #!-stack-grows-downward-not-upward
167   (labels
168       ((scrub (ptr offset count)
169          (declare (type system-area-pointer ptr)
170                   (type (unsigned-byte 16) offset)
171                   (type (unsigned-byte 20) count)
172                   (values (unsigned-byte 20)))
173          (cond ((= offset bytes-per-scrub-unit)
174                 (look (sap+ ptr bytes-per-scrub-unit) 0 count))
175                (t
176                 (setf (sap-ref-32 ptr offset) 0)
177                 (scrub ptr (+ offset sb!vm:n-word-bytes) count))))
178        (look (ptr offset count)
179          (declare (type system-area-pointer ptr)
180                   (type (unsigned-byte 16) offset)
181                   (type (unsigned-byte 20) count)
182                   (values (unsigned-byte 20)))
183          (cond ((= offset bytes-per-scrub-unit)
184                 count)
185                ((zerop (sap-ref-32 ptr offset))
186                 (look ptr (+ offset sb!vm:n-word-bytes) count))
187                (t
188                 (scrub ptr offset (+ count sb!vm:n-word-bytes))))))
189     (let* ((csp (sap-int (sb!c::control-stack-pointer-sap)))
190            (initial-offset (logand csp (1- bytes-per-scrub-unit))))
191       (declare (type (unsigned-byte 32) csp))
192       (scrub (int-sap (- csp initial-offset))
193              (* (floor initial-offset sb!vm:n-word-bytes) sb!vm:n-word-bytes)
194              0)))
195
196   #!+stack-grows-downward-not-upward
197   (labels
198       ((scrub (ptr offset count)
199          (declare (type system-area-pointer ptr)
200                   (type (unsigned-byte 16) offset)
201                   (type (unsigned-byte 20) count)
202                   (values (unsigned-byte 20)))
203          (let ((loc (int-sap (- (sap-int ptr) (+ offset sb!vm:n-word-bytes)))))
204            (cond ((= offset bytes-per-scrub-unit)
205                   (look (int-sap (- (sap-int ptr) bytes-per-scrub-unit))
206                         0 count))
207                  (t ;; need to fix bug in %SET-STACK-REF
208                   (setf (sap-ref-32 loc 0) 0)
209                   (scrub ptr (+ offset sb!vm:n-word-bytes) count)))))
210        (look (ptr offset count)
211          (declare (type system-area-pointer ptr)
212                   (type (unsigned-byte 16) offset)
213                   (type (unsigned-byte 20) count)
214                   (values (unsigned-byte 20)))
215          (let ((loc (int-sap (- (sap-int ptr) offset))))
216            (cond ((= offset bytes-per-scrub-unit)
217                   count)
218                  ((zerop (sb!kernel::get-lisp-obj-address (stack-ref loc 0)))
219                   (look ptr (+ offset sb!vm:n-word-bytes) count))
220                  (t
221                   (scrub ptr offset (+ count sb!vm:n-word-bytes)))))))
222     (let* ((csp (sap-int (sb!c::control-stack-pointer-sap)))
223            (initial-offset (logand csp (1- bytes-per-scrub-unit))))
224       (declare (type (unsigned-byte 32) csp))
225       (scrub (int-sap (+ csp initial-offset))
226              (* (floor initial-offset sb!vm:n-word-bytes) sb!vm:n-word-bytes)
227              0))))
228 \f
229 ;;;; the default toplevel function
230
231 (defvar / nil
232   #!+sb-doc
233   "a list of all the values returned by the most recent top level EVAL")
234 (defvar //  nil #!+sb-doc "the previous value of /")
235 (defvar /// nil #!+sb-doc "the previous value of //")
236 (defvar *   nil #!+sb-doc "the value of the most recent top level EVAL")
237 (defvar **  nil #!+sb-doc "the previous value of *")
238 (defvar *** nil #!+sb-doc "the previous value of **")
239 (defvar +   nil #!+sb-doc "the value of the most recent top level READ")
240 (defvar ++  nil #!+sb-doc "the previous value of +")
241 (defvar +++ nil #!+sb-doc "the previous value of ++")
242 (defvar -   nil #!+sb-doc "the form currently being evaluated")
243
244 (defun interactive-eval (form)
245   "Evaluate FORM, returning whatever it returns and adjusting ***, **, *,
246    +++, ++, +, ///, //, /, and -."
247   (setf - form)
248   (let ((results (multiple-value-list (eval form))))
249     (setf /// //
250           // /
251           / results
252           *** **
253           ** *
254           * (car results)))
255   (setf +++ ++
256         ++ +
257         + -)
258   (unless (boundp '*)
259     ;; The bogon returned an unbound marker.
260     ;; FIXME: It would be safer to check every one of the values in RESULTS,
261     ;; instead of just the first one.
262     (setf * nil)
263     (cerror "Go on with * set to NIL."
264             "EVAL returned an unbound marker."))
265   (values-list /))
266
267 ;;; Flush anything waiting on one of the ANSI Common Lisp standard
268 ;;; output streams before proceeding.
269 (defun flush-standard-output-streams ()
270   (dolist (name '(*debug-io*
271                   *error-output*
272                   *query-io*
273                   *standard-output*
274                   *trace-output*))
275     (finish-output (symbol-value name)))
276   (values))
277
278 ;;; the default system top level function
279 (defun toplevel-init ()
280
281   (/show0 "entering TOPLEVEL-INIT")
282   
283   (let ((sysinit nil)        ; value of --sysinit option
284         (userinit nil)       ; value of --userinit option
285         (reversed-evals nil) ; values of --eval options, in reverse order; and
286                              ; also --load options, translated into --eval
287         (noprint nil)        ; Has a --noprint option been seen?
288         (noprogrammer nil)   ; Has a --noprogrammer option been seen?
289         (options (rest *posix-argv*))) ; skipping program name
290
291     (/show0 "done with outer LET in TOPLEVEL-INIT")
292   
293     ;; FIXME: There are lots of ways for errors to happen around here
294     ;; (e.g. bad command line syntax, or READ-ERROR while trying to
295     ;; READ an --eval string). Make sure that they're handled
296     ;; reasonably. Also, perhaps all errors while parsing the command
297     ;; line should cause the system to QUIT, instead of trying to go
298     ;; into the Lisp debugger, since trying to go into the debugger
299     ;; gets into various annoying issues of where we should go after
300     ;; the user tries to return from the debugger.
301     
302     ;; Parse command line options.
303     (loop while options do
304           (/show0 "at head of LOOP WHILE OPTIONS DO in TOPLEVEL-INIT")
305           (let ((option (first options)))
306             (flet ((pop-option ()
307                      (if options
308                          (pop options)
309                          (error "unexpected end of command line options"))))
310               (cond ((string= option "--sysinit")
311                      (pop-option)
312                      (if sysinit
313                          (error "multiple --sysinit options")
314                          (setf sysinit (pop-option))))
315                     ((string= option "--userinit")
316                      (pop-option)
317                      (if userinit
318                          (error "multiple --userinit options")
319                          (setf userinit (pop-option))))
320                     ((string= option "--eval")
321                      (pop-option)
322                      (let ((eval-as-string (pop-option)))
323                        (with-input-from-string (eval-stream eval-as-string)
324                          (let* ((eof-marker (cons :eof :eof))
325                                 (eval (read eval-stream nil eof-marker))
326                                 (eof (read eval-stream nil eof-marker)))
327                            (cond ((eq eval eof-marker)
328                                   (error "unable to parse ~S"
329                                          eval-as-string))
330                                  ((not (eq eof eof-marker))
331                                   (error "more than one expression in ~S"
332                                          eval-as-string))
333                                  (t
334                                   (push eval reversed-evals)))))))
335                     ((string= option "--load")
336                      (pop-option)
337                      (push `(load ,(pop-option)) reversed-evals))
338                     ((string= option "--noprint")
339                      (pop-option)
340                      (setf noprint t))
341                     ((string= option "--noprogrammer")
342                      (pop-option)
343                      (setf noprogrammer t))
344                     ((string= option "--end-toplevel-options")
345                      (pop-option)
346                      (return))
347                     (t
348                      ;; Anything we don't recognize as a toplevel
349                      ;; option must be the start of user-level
350                      ;; options.. except that if we encounter
351                      ;; "--end-toplevel-options" after we gave up
352                      ;; because we didn't recognize an option as a
353                      ;; toplevel option, then the option we gave up on
354                      ;; must have been an error. (E.g. in
355                      ;;  "sbcl --eval '(a)' --eval'(b)' --end-toplevel-options"
356                      ;; this test will let us detect that the string
357                      ;; "--eval(b)" is an error.)
358                      (if (find "--end-toplevel-options" options
359                                :test #'string=)
360                          (error "bad toplevel option: ~S" (first options))
361                          (return)))))))
362     (/show0 "done with LOOP WHILE OPTIONS DO in TOPLEVEL-INIT")
363
364     ;; Excise all the options that we processed, so that only
365     ;; user-level options are left visible to user code.
366     (setf (rest *posix-argv*) options)
367
368     ;; Handle --noprogrammer option. We intentionally do this
369     ;; early so that it will affect the handling of initialization
370     ;; files and --eval options.
371     (/show0 "handling --noprogrammer option in TOPLEVEL-INIT")
372     (when noprogrammer
373       (setf *debugger-hook* 'noprogrammer-debugger-hook-fun
374             *debug-io* *error-output*))
375
376     ;; Handle initialization files.
377     (/show0 "handling initialization files in TOPLEVEL-INIT")
378     (flet (;; If any of POSSIBLE-INIT-FILE-NAMES names a real file,
379            ;; return its truename.
380            (probe-init-files (&rest possible-init-file-names)
381              (/show0 "entering PROBE-INIT-FILES")
382              (prog1
383                  (find-if (lambda (x)
384                             (and (stringp x) (probe-file x)))
385                           possible-init-file-names)
386                (/show0 "leaving PROBE-INIT-FILES"))))
387       (let* ((sbcl-home (posix-getenv "SBCL_HOME"))
388              (sysinit-truename (if sbcl-home
389                                    (probe-init-files sysinit
390                                                      (concatenate 'string
391                                                                   sbcl-home
392                                                                   "/sbclrc"))
393                                    (probe-init-files sysinit
394                                                      "/etc/sbclrc"
395                                                      "/usr/local/etc/sbclrc")))
396              (user-home (or (posix-getenv "HOME")
397                             (error "The HOME environment variable is unbound, ~
398                                     so user init file can't be found.")))
399              (userinit-truename (probe-init-files userinit
400                                                   (concatenate 'string
401                                                                user-home
402                                                                "/.sbclrc"))))
403
404         ;; We wrap all the pre-REPL user/system customized startup code 
405         ;; in a restart.
406         ;;
407         ;; (Why not wrap everything, even the stuff above, in this
408         ;; restart? Errors above here are basically command line or
409         ;; Unix environment errors, e.g. a missing file or a typo on
410         ;; the Unix command line, and you don't need to get into Lisp
411         ;; to debug them, you should just start over and do it right
412         ;; at the Unix level. Errors below here are generally errors
413         ;; in user Lisp code, and it might be helpful to let the user
414         ;; reach the REPL in order to help figure out what's going
415         ;; on.)
416         (restart-case
417             (progn
418               (flet ((process-init-file (truename)
419                        (when truename
420                          (unless (load truename)
421                            (error "~S was not successfully loaded." truename))
422                          (flush-standard-output-streams))))
423                 (process-init-file sysinit-truename)
424                 (process-init-file userinit-truename))
425
426               ;; Process --eval options.
427               (/show0 "handling --eval options in TOPLEVEL-INIT")
428               (dolist (eval (reverse reversed-evals))
429                 (/show0 "handling one --eval option in TOPLEVEL-INIT")
430                 (eval eval)
431                 (flush-standard-output-streams)))
432           (continue ()
433             :report
434             "Continue anyway (skipping to toplevel read/eval/print loop)."
435             (/show0 "CONTINUEing from pre-REPL RESTART-CASE")
436             (values)) ; (no-op, just fall through)
437           (quit ()
438             :report "Quit SBCL (calling #'QUIT, killing the process)."
439             (/show0 "falling through to QUIT from pre-REPL RESTART-CASE")
440             (quit))))
441
442       ;; one more time for good measure, in case we fell out of the
443       ;; RESTART-CASE above before one of the flushes in the ordinary
444       ;; flow of control had a chance to operate
445       (flush-standard-output-streams)
446
447       (/show0 "falling into TOPLEVEL-REPL from TOPLEVEL-INIT")
448       (toplevel-repl noprint)
449       ;; (classic CMU CL error message: "You're certainly a clever child.":-)
450       (critically-unreachable "after TOPLEVEL-REPL"))))
451
452 ;;; read-eval-print loop for the default system toplevel
453 (defun toplevel-repl (noprint)
454   (/show0 "entering TOPLEVEL-REPL")
455   (let ((* nil) (** nil) (*** nil)
456         (- nil)
457         (+ nil) (++ nil) (+++ nil)
458         (/// nil) (// nil) (/ nil))
459     ;; WITH-SIMPLE-RESTART doesn't actually restart its body as some
460     ;; (like WHN for an embarrassingly long time ca. 2001-12-07) might
461     ;; think, but instead drops control back out at the end. So when a
462     ;; TOPLEVEL or outermost-ABORT restart happens, we need this outer
463     ;; LOOP wrapper to grab control and start over again. (And it also
464     ;; wraps CATCH 'TOPLEVEL-CATCHER for similar reasons.)
465     (loop
466      (/show0 "about to set up restarts in TOPLEVEL-REPL")
467      ;; There should only be one TOPLEVEL restart, and it's here, so
468      ;; restarting at TOPLEVEL always bounces you all the way out here.
469      (with-simple-restart (toplevel
470                            "Restart at toplevel READ/EVAL/PRINT loop.")
471        ;; We add a new ABORT restart for every debugger level, so 
472        ;; restarting at ABORT in a nested debugger gets you out to the
473        ;; innermost enclosing debugger, and only when you're in the
474        ;; outermost, unnested debugger level does restarting at ABORT 
475        ;; get you out to here.
476        (with-simple-restart
477            (abort
478             "Reduce debugger level (leaving debugger, returning to toplevel).")
479          (catch 'toplevel-catcher
480            #!-sunos (sb!unix:unix-sigsetmask 0) ; FIXME: What is this for?
481            (repl noprint)
482            (critically-unreachable "after REPL")))))))
483
484 (defun repl (noprint)
485   (/show0 "entering REPL")
486   (let ((eof-marker (cons :eof nil)))
487     (loop
488      ;; FIXME: It seems bad to have GC behavior depend on scrubbing the
489      ;; control stack before each interactive command. Isn't there some
490      ;; way we can convince the GC to just ignore dead areas of the
491      ;; control stack, so that we don't need to rely on this half-measure?
492      (scrub-control-stack)
493      (unless noprint
494        (fresh-line)
495        (write-string "* ") ; arbitrary but customary REPL prompt
496        (flush-standard-output-streams))
497      (let ((form (read *standard-input* nil eof-marker)))
498        (cond ((eq form eof-marker)
499               (/show0 "doing QUIT for EOF in REPL")
500               (quit))
501              (t
502               (let ((results (multiple-value-list (interactive-eval form))))
503                 (unless noprint
504                   (dolist (result results)
505                     (fresh-line)
506                     (prin1 result))))))))))
507
508 (defun noprogrammer-debugger-hook-fun (condition old-debugger-hook)
509   (declare (ignore old-debugger-hook))
510   (flet ((failure-quit (&key recklessly-p)
511            (/show0 "in FAILURE-QUIT (in noprogrammer debugger hook)")
512            (quit :unix-status 1 :recklessly-p recklessly-p)))
513     ;; This HANDLER-CASE is here mostly to stop output immediately
514     ;; (and fall through to QUIT) when there's an I/O error. Thus,
515     ;; when we're run under a shell script or something, we can die
516     ;; cleanly when the script dies (and our pipes are cut), instead
517     ;; of falling into ldb or something messy like that.
518     (handler-case
519         (progn
520           (format *error-output*
521                   "~&~@<unhandled condition (of type ~S): ~2I~_~A~:>~2%"
522                   (type-of condition)
523                   condition)
524           ;; Flush *ERROR-OUTPUT* even before the BACKTRACE, so that
525           ;; even if we hit an error within BACKTRACE (e.g. a bug in
526           ;; the debugger's own frame-walking code, or a bug in a user
527           ;; PRINT-OBJECT method) we'll at least have the CONDITION
528           ;; printed out before we die.
529           (finish-output *error-output*)
530           ;; (Where to truncate the BACKTRACE is of course arbitrary, but
531           ;; it seems as though we should at least truncate it somewhere.)
532           (sb!debug:backtrace 128 *error-output*)
533           (format *error-output*
534                   "~%unhandled condition in --noprogrammer mode, quitting~%")
535           (finish-output *error-output*)
536           (failure-quit))
537       (condition ()
538         ;; We IGNORE-ERRORS here because even %PRIMITIVE PRINT can
539         ;; fail when our output streams are blown away, as e.g. when
540         ;; we're running under a Unix shell script and it dies somehow
541         ;; (e.g. because of a SIGINT). In that case, we might as well
542         ;; just give it up for a bad job, and stop trying to notify
543         ;; the user of anything.
544         ;;
545         ;; Actually, the only way I've run across to exercise the
546         ;; problem is to have more than one layer of shell script.
547         ;; I have a shell script which does
548         ;;   time nice -10 sh make.sh "$1" 2>&1 | tee make.tmp
549         ;; and the problem occurs when I interrupt this with Ctrl-C
550         ;; under Linux 2.2.14-5.0 and GNU bash, version 1.14.7(1).
551         ;; I haven't figured out whether it's bash, time, tee, Linux, or
552         ;; what that is responsible, but that it's possible at all
553         ;; means that we should IGNORE-ERRORS here. -- WHN 2001-04-24
554         (ignore-errors
555          (%primitive print "Argh! error within --noprogrammer error handling"))
556         (failure-quit :recklessly-p t)))))
557 \f
558 ;;; a convenient way to get into the assembly-level debugger
559 (defun %halt ()
560   (%primitive sb!c:halt))