[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tracing a method



Rich lynch@ils.nwu.edu writes...

>What is the correct syntax to put a step-point on a method?

The following code will allow tracing of methods to be 
enabled/disabled using the generic function inspector.

No need to remember the syntax :-)

Ralf


;;;; inspector extensions

(in-package inspector)

(defmethod inspector-commands ((f gf-inspector))
  (let* ((commands (call-next-method f))
         (function (inspector-object f))
         (methods (generic-function-methods (inspector-object f)))
         (view (inspector-view f))
         (selection (selection view)))
    (append
     commands
     (list
      `("-" nil)
      `("Remove method"
        ,(and selection (> selection 3)
              #'(lambda ()
                  (remove-method function (elt methods (- selection 4)))
                  (resample-it))))
      `("Trace method"
        ,(and selection (> selection 3)
              #'(lambda ()
                  (let ((method (elt methods (- selection 4))))
                    (ccl::%trace-0 
                     `(((:method ,(method-name method)
                                 ,@(method-qualifiers method)
                                 ,(mapcar #'class-name
                                          (method-specializers
method))))))))))
      `("Untrace method"
        ,(and selection (> selection 3)
              #'(lambda ()
                  (let ((method (elt methods (- selection 4))))
                    (ccl::%untrace-0 
                     `((:method ,(method-name method)
                                 ,@(method-qualifiers method)
                                 ,(mapcar #'class-name
                                          (method-specializers
                                                method)))))))))))))