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

Debugging inactive lexical closures



Here's a new debugger function I've found useful: (This constitutes my putting
it in the public domain)...

The problem is if you have a lexical closure that is not currently active,
how can you look at it's lexical variables? Well, if you are running 7.1, try
this...

(cp:define-command (com-show-inactive-lexical-frame :command-table "Debugger"
						    :provide-output-destination-keyword nil)
		   ((frame 'lexical-closure))
   (let ((environment-var-names
	    (cdr
	      (assoc :lexical-map
		     (si:compiled-function-debugging-info
		       (sys:lexical-closure-function frame)))))
	 (prinlevel *error-message-prinlevel*)
	 (prinlength *error-message-prinlength*))

     (format t "~&~VLexical Variables in Environment for ~~S" *deemphasis-character-style* frame)
     (mapc #'(lambda (x y)
	       (format t "~& ~S:~@1,8T~S~%" (car x) y))
	   (cl:sort environment-var-names #'< :key #'second)
	   (sys:lexical-closure-environment frame))))


Happy hacks,
Brad Miller
------
miller@cs.rochester.edu
miller@acorn.cs.rochester.edu