X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdebug.lisp;h=b7709e1fe6e042d7205e83451d72acb0d8ef1a6f;hb=f392742d2781f42b3bb15b637e5008e10fbbe092;hp=a8cb1215d8768f75ac4727586b50a082b2009406;hpb=8c66abea806a03de36af37eb6068718799617b92;p=sbcl.git diff --git a/src/code/debug.lisp b/src/code/debug.lisp index a8cb121..b7709e1 100644 --- a/src/code/debug.lisp +++ b/src/code/debug.lisp @@ -637,13 +637,17 @@ reset to ~S." (*print-pretty* t) (*package* original-package)) + ;; Before we start our own output, finish any pending output. + ;; Otherwise, if the user tried to track the progress of + ;; his program using PRINT statements, he'd tend to lose + ;; the last line of output or so, and get confused. + (flush-standard-output-streams) + ;; The initial output here goes to *ERROR-OUTPUT*, because the ;; initial output is not interactive, just an error message, ;; and when people redirect *ERROR-OUTPUT*, they could ;; reasonably expect to see error messages logged there, ;; regardless of what the debugger does afterwards. - #!+sb-show (sb!conditions::show-condition *debug-condition* - *error-output*) (format *error-output* "~2&debugger invoked on condition of type ~S:~% " (type-of *debug-condition*)) @@ -660,11 +664,11 @@ reset to ~S." (let (;; FIXME: The first two bindings here seem wrong, ;; violating the principle of least surprise, and making ;; it impossible for the user to do reasonable things - ;; like using PRINT to send output to the program's - ;; ordinary (possibly redirected-to-a-file) - ;; *STANDARD-OUTPUT*, or using PEEK-CHAR or some such - ;; thing on the program's ordinary (possibly also - ;; redirected) *STANDARD-INPUT*. + ;; like using PRINT at the debugger prompt to send output + ;; to the program's ordinary (possibly + ;; redirected-to-a-file) *STANDARD-OUTPUT*, or using + ;; PEEK-CHAR or some such thing on the program's ordinary + ;; (possibly also redirected) *STANDARD-INPUT*. (*standard-input* *debug-io*) (*standard-output* *debug-io*) ;; This seems reasonable: e.g. if the user has redirected @@ -674,10 +678,11 @@ reset to ~S." (*error-output* *debug-io*)) (unless (typep condition 'step-condition) (format *debug-io* - "~%~@~2%" + "~%~@~2%" '*debug-condition*) (show-restarts *debug-restarts* *debug-io*) (terpri *debug-io*)) @@ -709,7 +714,7 @@ reset to ~S." ;;; This calls DEBUG-LOOP, performing some simple initializations ;;; before doing so. INVOKE-DEBUGGER calls this to actually get into -;;; the debugger. SB!CONDITIONS::ERROR-ERROR calls this in emergencies +;;; the debugger. SB!KERNEL::ERROR-ERROR calls this in emergencies ;;; to get into a debug prompt as quickly as possible with as little ;;; risk as possible for stepping on whatever is causing recursive ;;; errors.