[slime-devel] Tracing with slime presentations

Luigi Panzeri matley at member.fsf.org
Thu Mar 9 15:18:02 UTC 2006


Hi. i wrote a snippet to do tracing of functions allowing slime
presentations (thanks to segv for helping me with
present-object). Obviously this code works only on sbcl.

(defun present-object (value &key (showvalue value) (printfun #'prin1) (stream *standard-output*))
  (swank::presenting-object value stream
      (funcall printfun showvalue stream))
  value)

(defmacro present-trace (fun &rest rest)
  `(trace ,fun
	  ;; present input arguments
          :print (present-object (let ((args nil))
                                (handler-case
                                    (loop
                                       for i upfrom 0
                                       do (push (sb-debug::arg i) args))
                                  (sb-kernel::index-too-large-error () args))) 
				 :showvalue '|inspect input|
				 :stream *trace-output*)
	  ;; present return values
          :print-after (present-object sb-debug:*trace-values* 
				       :showvalue '|inspect return values| 
				       :stream *standard-output*)
	  ;; passing other args to trace
	  , at rest))


Maybe an sbcl expert can really improve and beautify this hack.

Sorry if mail is duplicated.

-- 
Luigi Panzeri aka Matley

Chiave pubblica su http://www.imati.cnr.it/~panzeri/matley.asc
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Evaluate Lisp: http://lisp.tech.coop/Evaluate%20Lisp



More information about the slime-devel mailing list