From: David C. <cre...@gm...> - 2012-05-17 20:28:41
|
On Sun, May 13, 2012 at 12:38:44PM +0300, Nikodemus Siivola wrote: > See: > > sb-introspect:who-calls > sb-introspect:find-function-callees > > The first should be accurate and include inlined call sites. The > latter only knows about full calls. You can also build SBCL with > --fancy to get XREF data for internals as well. Hi Nikodemus, Thanks for that. That did the trick. It looks like Debian has built with --fancy as there is a lot of stuff that comes back from who-calls. I threw together some code that lets me build a call graph, I'm including the guts of it here in case someone else would like to use it or improve it. This will produce a graphviz style call directed graph. For small bits of code, it may be useful. (My code has got quite large, making a very dense, large graph, so I may need to rethink how to do this). Nonetheless, being able to see where stuff is called is very useful to me, so thanks. (defun clean-symbol (sym) (substitute #\2 #\> (remove #\- (format nil "~A" sym)))) (let ((lst ()) (fn-hash (make-hash-table)) (package-name "MY-PACKAGE-NAME")) (do-symbols (jj package-name) (when (eq (find-package package-name) (symbol-package jj)) (progn (mapcar (lambda (n) (if (not (member (car n) (gethash jj fn-hash))) (setf (gethash jj fn-hash) (push (car n) (gethash jj fn-hash))))) (sb-introspect:who-calls jj)) (push jj lst)))) ; (maphash (lambda (fun used) (format t "~A is used in ~A~%" fun used)) fn-hash) (format t "digraph mytest {~%") (maphash (lambda (fun used) (loop for x in used do (format t "~A -> ~A;~%" (clean-symbol x) (clean-symbol fun)))) fn-hash) (format t "}~%")) Cheers David > > Cheers, > > -- nikodemus > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Sbcl-help mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-help |