13 May 2012 10:58
Drawing a call graph of a block of lisp code (general lisp question)
David Creelman <creelman.david <at> gmail.com>
2012-05-13 08:58:54 GMT
2012-05-13 08:58:54 GMT
Hi,
I have a bunch of lisp code that I want to draw the call graph of (I'm
thinking of generating something with graphviz).
Has someone written something that will look for all of the function
calls in a defun? I imagine a recursive function called from a macro
could do this. I've had a go at writing it with loop, but I'm not sure
how to get it to recurse over subtrees of calls. Small confession, I'm
not real good at recursive functions. The recursive function I wrote
seemed to always end up working like flatten.
It would be nice to be able to do something like
(callgraph graph1
(defun caller (a b)
(fun1 a)
(fun2 b))
(defun fun1 (a)
(print a))
(defun fun2 (a)
(print a)))
Which would generate
digraph graph1 {
caller -> fun1
caller -> fun2 }
... I'm away from graphviz doco as I write this, so I may have got the
(Continue reading)
RSS Feed