[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
code walkers or inverse who-calls
Date: Fri, 18 Oct 1991 10:59 EDT
From: dmitchell@trc.amoco.com (Donald H. Mitchell)
Is there anyway to generate a call tree (graph) for a function? I certainly
realize that I could read through the source code and generate a database;
however, the compiled code represents a ready database if only I could figure
out how to access the compiled code to find all the functional objects.
On a Genera development system? You can use SI:MAP-OVER-COMPILED-FUNCTION-CALLEES.
(si:map-over-compiled-function-callees
#'sct:find-system-named
#'(lambda (caller callee how-called)
(format t "~&~S ~S ~S" (sys:function-name caller) callee how-called))
:external-references t)
==>
SCT:FIND-SYSTEM-NAMED SCT:SYSTEM :CONSTANT
SCT:FIND-SYSTEM-NAMED SI:TYPEP-FLAVOR :FUNCTION
SCT:FIND-SYSTEM-NAMED SCT:SUBSYSTEM :CONSTANT
SCT:FIND-SYSTEM-NAMED SCT:UNDEFINED-SYSTEM :CONSTANT
SCT:FIND-SYSTEM-NAMED SCT:CANONICALIZE-SYSTEM-NAME :FUNCTION
SCT:FIND-SYSTEM-NAMED SCT:*ALL-SYSTEMS-TABLE* :VARIABLE
SCT:FIND-SYSTEM-NAMED CLI::FAST-TABLE-GET :FUNCTION
SCT:FIND-SYSTEM-NAMED :NEWEST :CONSTANT
SCT:FIND-SYSTEM-NAMED SCT:LOAD-SYSTEM-DECLARATION-IF-NECESSARY :FUNCTION
SCT:FIND-SYSTEM-NAMED SCT:FIND-SYSTEM-NAMED :FUNCTION
SCT:FIND-SYSTEM-NAMED SCT:SYSTEM-NOT-FOUND :CONSTANT
SCT:FIND-SYSTEM-NAMED :SYSTEM-NAME :CONSTANT
SCT:FIND-SYSTEM-NAMED SIGNAL :FUNCTION
I do realize the metering system generates a call tree as it meters a
function; however, that requires invoking the function (which is not terrible
but it would be nice to generate the tree without having to successfully
execute down through all branches).
I also realize that I could map over the functional symbols in a package, use
the who calls database to see who calls them, and create an inverted database;
however, that sounds like overkill for just showing the call tree for a
specific function.
Don Mitchell dmitchell@trc.amoco.com
Amoco Production Company (918) 660-4270
Tulsa Research Center
P.O. Box 3385, Tulsa, OK 74102