XEROX GRAPHCALLS 2 4 1 GRAPHCALLS 1 4 By: Christopher Lane (Lane@Sumex-Aim.Stanford.Edu) Requires: GRAPHER, MSANALYZE (WHEREIS & HELPSYS optional) GRAPHCALLS is an extended graphical interface to the Interlisp CALLS function. It is to CALLS what BROWSER is to SHOW PATHS in MASTERSCOPE. It allows fast graphing of the calling hierarchy of both interpreted and compiled code, whether or not the source is available (see the CALLS function in the Interlisp manual), allowing examination of both user and system functions. The sources of the functions do not have to be analyzed by MASTERSCOPE first. Additionally, buttoning a function on the graph brings up a menu of operations that can be done with the function, such as editing, inspecting, further graphing etc. (GRAPHCALLS FUNCTION &REST OPTIONS) [Function] Graphs the calling hierarchy of FUNCTION. Terminal nodes on the graph (those which call no other functions or are undefined) are printed in a bold version of the graph's font indicating that they cannot be graphed further: (( FIELDS ( SIDESFLG T) IDS 14 DATE \UNPACKDATE DAYTIME IMOD \DTSCAN \ISDST? \OUTDATE \LISPERROR NTH SUBSTRING NCHARS ALLOCSTRING \RPLRIGHT RPLSTRING FONTS 2 (GACHA 8) (GACHA 8 BRR) NODES ( (1 DATE (11 . 76) 1 NIL NIL (2 7 ) NIL) (2 \UNPACKDATE (80 . 111) 1 NIL NIL (3 4 5 6 ) (1 )) (3 DAYTIME (157 . 129) 1 NIL NIL NIL (2 )) (4 IMOD (150 . 117) 2 NIL NIL NIL (2 )) (5 \DTSCAN (157 . 105) 2 NIL NIL NIL (2 )) (6 \ISDST? (157 . 93) 1 NIL NIL NIL (2 )) (7 \OUTDATE (73 . 41) 1 NIL NIL (8 9 10 11 12 13 14 ) (1 )) (8 \LISPERROR (150 . 77) 1 NIL NIL NIL (7 )) (9 NTH (132 . 65) 2 NIL NIL NIL (7 )) (10 SUBSTRING (147 . 53) 1 NIL NIL NIL (7 )) (11 NCHARS (140 . 41) 1 NIL NIL NIL (7 )) (12 ALLOCSTRING (152 . 29) 1 NIL NIL NIL (7 )) (13 \RPLRIGHT (147 . 17) 2 NIL NIL NIL (7 )) (14 RPLSTRING (147 . 5) 1 NIL NIL NIL (7 )) )) 0 0) The remainder of the arguments, in keyword format, make up OPTIONS eg. (GRAPHCALLS 'DATE :FONT '(GACHA 10) :DEPTH 4 :FILTER 'FGETD). Options include: :STREAM An image stream to display the graph on. The options list is saved on the stream. :FILTER A predicate to apply to the functions when building the graph to test their eligibility to appear on the graph. The filter can be any defined function; the default is not to filter. Interesting filters include: WHEREIS Limits the tree to only functions the user as has loaded and prunes out Interlisp functions and SYSLOADed files. Quite useful. FGETD Limits the tree to only functions that are actually defined. Thus if you are perusing the tree for BITBLT and don't have and are not interested in the color code, FGETD will remove all of the undefined color bitmap functions. EXPRP Limits the tree to interpreted functions. Useful for graphing functions in the development stage. CCODEP Limits the tree to compiled functions. NO\ Keeps low level functions starting with \ (i.e. \OUTDATE) off of the graph. Useful for getting an overview of system functions and when advising system functions (as \'ed functions should probably not be advised). :DEPTH The calling hierarchy is graphed to depth levels (defaults to 2). :FORMAT Passed to LAYOUTGRAPH and can be any format specification (LATTICE, VERTICAL, REVERSE etc.); defaults to (HORIZONTAL COMPACT REVERSE/DAUGHTERS). In the forest format multiple instances of a function appear on the graph after every calling function and a boxed node indicates the function appears elsewhere on the graph, possibly graphed further. In the lattice format each function gets placed on the graph only once (particularly useful for for the Dynamic Graphing described below), and boxed nodes indicate recursive functions calls. :SEARCHFN A function to use to generate the children of a given node. It should return a list whose first item is a list of the children, the other items in the list are ignored currently. Using this feature, it is possible to graph things other than functions. To graph what files load other files, supply a search function of (LAMBDA (FILE) (LIST (FILECOMSLST FILE 'FILES))) and a file name for the function argument. :ADVISE Advises the functions after they are graphed (see Dynamic Graphing below); recognized values are one or both of the following: INVERT Sets up graph to visually track a running program . COUNT Sets up graph to count function calls in a running program. :DELAY The delay to use in advised graphs, default to 500 milliseconds. :NAMEFN A function to use to generate the node labels on the graph. :FONT The font to use to display the graph; defaults to GACHA 8. :SHAPE A boolean that indicates if the graph window should be shaped to fit the graph; defaults to NIL. :PRIN2FLG A boolean that indicates to use PRIN2 when printing node labels, defaults to NIL. :SUBFNDEFFLG A boolean that enables graphing of compiler generated functions; defaults to T. :TOPJUSTIFYFLG Passed to SHOWGRAPH; defaults to NIL. :ALLOWEDITFLG Passed to SHOWGRAPH; defaults to NIL. GRAPH MENUS The menu that pops up when you left button a function on the graph contains the following items: ?= Print the arguments to the function, if available. HELP Calls HELPSYS on the function. FNTYP Print the function's FNTYP. WHERE Do a WHEREIS (with FILES = T) on the function. EDIT Calls the editor on the function if available for editing. TYPEIN BKSYSBUF's the name of the function into the typein buffer. BREAK Applies BREAK to the function. Its subitems are BREAKIN Breaks the function only in the context of a particular calling function. In lattice format, if the function has more than one function calling it on the graph, the user is prompted to indicate the caller in which to break the function. UNBREAKIN Undoes BREAKIN. UNBREAK Applies UNBREAK to the function. TRACE Applies TRACE to the function. TRACEIN Traces the function only when called from inside a particular function, like BREAKIN above. Use UNBREAKIN to remove the trace, or else UNBREAK on the window menu. CCODE Calls INSPECTCODE on the function if it is compiled code. GRAPH Calls GRAPHCALLS to make a new graph starting with function, inherits the original graph's options. FRAME Inspect the local, free and global variables of the function. These are the last three lists of the CALLS function placed into INSPECT windows. Its subitems are >FRAME Like FRAME but for all of the functions on the sub-tree starting at the selected node and only for FREEVARS and GLOBALVARS. FRAME but for all of the functions above the function in the graph, i.e. the FREEVARS and GLOBALVARS in the function's scope. Buttoning the graph outside a node give you a menu with these options: UNBREAK Does an (UNBREAK), unbreaking all broken functions. RESET Resets the counters for the COUNT option and redisplays the graph. DYNAMIC GRAPHING When the ADVISE option is specified with the value(s) of INVERT and/or COUNT, GRAPHCALLS will advise all of the functions on the graph (in the context of their parent) to invert their corresponding node on the graph (as well as delay some to allow it to be seen) and/or follow each function name by a count of the number of times it has been executed. In invert mode, a node remains inverted as long as control is inside its corresponding function and it returns to normal when the function is exited. The lattice format is best when using the invert feature. Closing the graph window UNADVISEs the functions on the graph. An example of this is (GRAPHCALLS 'DATE :ADVISE 'INVERT) and then evaluate (DATE). GRAPHCALLS will not graph or advise any function in the (system) list UNSAFE.TO.MODIFY.FNS when the advise option is used. Functions which are unsafe to advise should be added to this list. CAVEAT PROGRAMMER! This feature must be used with caution. As a rule, one should not do this to system functions, but only one's own, use WHEREIS as a filter for this. Advising system code indiscriminately will probably crash the machine unrecoverablely. You can, at some risk, interactively break and edit functions on the graph while the code is executing. Also, creating subgraphs of advised graphs will show the generated advice functions not the original functions called, as will creating new graphs of functions in advised graphs. You can create advised graphs of functions already graphed normally on the screen. COMMAND WINDOW );;tΙ;hpWggom6fݝgnonooomvooou_ooomvͽooou_gowmvݽono{xxxwvoqpχw?{{wL:<_Lx}F{;{3fm۟ۻ+۷7S6};sv{wnۃ|7w}{wY{wnۿٷvm}{w7Y{{wn۟ۻ{۷7v{;wwχwn+_|XwG>;y    ?  @" 8 0 @  D 0f, K/8p D >f͙05" LH5"D D 0f́0! HE!r"@ D 0f́0! HE!"@ D 0f͙0B!" HB!"D D 0>0B  HB 8p 8         > x@  ! @  $#砀!xGYÄ x $$d@ !ĂH"j$D@  $$'y !>A@  $$$  !H @$@  $dd@! H"B$D@  # xxtbGAÄ@          !"?8 "  D #Ѐ"p!8q DI P!""&D  B rC"@9?  B B"@ DI" "$"D@ #!8u|         <|   8  B!B   D 8@B xBΐ  "D@!#"B  CQ$  >@!!>|  "   d@!! @  $   "DB!!#"@  $ D :<@  8           >#   1  !"#   0>q # !-.#Ŝ#@ ( 30 $! !51&$D@ ( 1y0 $ >!! >#@ H 1ٛ0 @ !! D | 3ٛ0d !! B$"$D@  }0# !!>B#@      ????? ? ? ? ????   8  D  @  x  D  D  D  8      |   @              8  D  D  8  D  D  D  8      8  D  D  D  <    D  8     8 C  D @