Changeset 11627


Ignore:
Timestamp:
02/05/09 20:13:27 (6 years ago)
Author:
ehuelsmann
Message:

Make TRACE protect *TRACE-DEPTH* from non-local returns (such as RETURN to TOP-LEVEL restarts).
Also make TRACE no longer invoke CLOS (and thus the compiler,

making it possible to trace the compiler now, instead of getting a stack overflow.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/trace.lisp

    r11391 r11627  
    3636(require "FORMAT")
    3737
    38 (require "CLOS")
     38;;(require "CLOS")
    3939
    4040(defvar *trace-info-hashtable* (make-hash-table :test #'equal))
     
    4242(defstruct trace-info name untraced-function breakp)
    4343
    44 (defmethod make-load-form ((object trace-info) &optional environment)
    45    (make-load-form-saving-slots object :environment environment))
     44;;(defmethod make-load-form ((object trace-info) &optional environment)
     45;;   (make-load-form-saving-slots object :environment environment))
    4646
    4747(defvar *trace-depth* 0)
     
    9090        (let ((*print-readably* nil)
    9191              (*print-structure* nil))
    92           (format *trace-output* (indent "~D: ~S~%") *trace-depth*
     92          (%format *trace-output* (indent "~D: ~S~%") *trace-depth*
    9393                  (cons name args))))
    9494      (when breakp
    9595        (break))
    9696      (incf *trace-depth*)
    97       (let ((results (multiple-value-list (apply untraced-function args))))
    98         (decf *trace-depth*)
     97      (let ((results (multiple-value-list
     98                      (unwind-protect
     99                           (apply untraced-function args)
     100                        (decf *trace-depth*)))))
    99101        (with-standard-io-syntax
    100102          (let ((*print-readably* nil)
    101103                (*print-structure* nil))
    102             (format *trace-output* (indent "~D: ~A returned") *trace-depth* name)
     104            (%format *trace-output* (indent "~D: ~A returned") *trace-depth* name)
    103105            (if results
    104106                (dolist (result results)
    105                   (format *trace-output* " ~S" result))
    106                 (format *trace-output* " no values"))
     107                  (%format *trace-output* " ~S" result))
     108                (%format *trace-output* " no values"))
    107109            (terpri *trace-output*)))
    108110        (values-list results)))))
Note: See TracChangeset for help on using the changeset viewer.