Does the :WHEREIN option of TRACE work?  If you cut and paste the code below
into a CMUCL REPL, you'll get a warning message and be thrown into the
debugger.

I'm using cmucl-19a-x86-linux.

Best,

-cph



(defclass babu () ())

(defmethod call-x ((babu babu))
  (x babu))

(defun x (babu)
  (when babu
    (random 1000)))

(setf tmp (make-instance 'babu))

(trace call-x x)

(call-x tmp)

;; Output:
;;   0: (CALL-X #<BABU {58BB3005}>)
;;     1: (X #<BABU {58BB3005}>)
;;     1: X returned 528
;;   0: CALL-X returned 528

(untrace x)


;; The following will give you a warning and throw you into the debugger.
(trace x :wherein (method call-x (babu)))

;; Output:
;;   Warning:  :WHEREIN name is not a defined global function: METHOD
;;
;;   Invalid function name: (BABU)
;;      [Condition of type SIMPLE-TYPE-ERROR]
;;
;;   Restarts:
;;     0: [ABORT] Return to Top-Level.
;;
;;   Debug  (type H for help)
;;
;;   (LISP::FDEFINITION-OBJECT (BABU) NIL)
;;   Source:
;;   ; File: target:code/fdefinition.lisp
;;
;;   ; File has been modified since compilation:
;;   ;   target:code/fdefinition.lisp
;;   ; Using form offset instead of character position.
;;   (ERROR 'SIMPLE-TYPE-ERROR :DATUM NAME :EXPECTED-TYPE ...)
;;   0]


Reply via email to