Comment 1 for bug 387357

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

I'm not wild about the names, but I definitely agree with the sentiment. How to display the disassembly of the referenced anon (or just local!) function is a good question, though.

As a stopgap measure here is something I sometimes use:

(defun disassemble-code-object-functions (code-object &key ignore)
  (let ((ep (sb-kernel:%code-entry-points code-object)))
    (loop while ep
          do (unless (member ep ignore)
               (format t "~%===~%~S~%===~%" (sb-kernel:%simple-fun-name ep))
               (disassemble ep))
          (setf ep (sb-kernel:%simple-fun-next ep)))))

(defun disassemble-component (fun &key ignore)
  (disassemble-code-object-functions
   (sb-kernel:fun-code-header (sb-kernel:%fun-fun fun))
   :ignore (mapcar (lambda (name)
                     (sb-kernel:%fun-fun (fdefinition name)))
                   ignore)))

Note that it doesn't really get the elsewhere segment right: the disassembly for (LAMBDA (X Y)) here includes the invalid arg-count traps for both the lambda and the main function. (Which, incidentally, is bad: since the arg count is in ECX in both cases -- like always -- there should be just one trap.)