CFLOW(1) CFLOW(1) NNAAMMEE cflow - print a function call hierarchy SSYYNNOOPPSSIISS cflow [-Aagivx] [-d n] [-w n] [-r name] [cpp-opts] files DDEESSCCRRIIPPTTIIOONN The ccffllooww command reads _f_i_l_e_s as program source and attempts to print a graph of the program's function call hierarchy to the standard output. Called functions are indented with respect to their calling functions, and printed only once, in the order they occur. The first reference to function _f_u_n_c is printed with the name of the file and line number where it is defined, e.g., func {file.c n}. Subsequent references are printed as: func ... {mm}, where mm is the line number in the graph of _f_u_n_c's first reference. Global variable references appear (if invoked with the _-_v option) as: var {v file.c n}. External functions and variables are printed with a null source, i.e., func {}. An ellipsis precedes the name of a function called recur- sively, e.g., ... func ... {mm} OOPPTTIIOONNSS -a Print a separate call graph for each function. -A Eliminate ansi keywords -P Eliminate POSIX keywords -d _n_n Print the call graph to at most depth _n_n. -g Add to the list of C keywords GNU CC keywords. -i Print an inverted graph of depth 2, i.e., for each function (or variable if used with the _-_v option), print a list of functions which call it. PUBLIC 1 CFLOW(1) CFLOW(1) -r _n_a_m_e Print a call graph with function or variable _n_a_m_e as root (in the case of a variable, this only makes sense if used with the _-_i option). This option may be repeated. -v Print references to global variables. Only functions calls are printed by default. -x Print each sub-graph in full. This overrides the default format where subsequent references are abbreviated as described above. -D_m_a_c_r_o or -U_m_a_c_r_o or -I_d_i_r Invoke cpp with the corresponding options. If there is a makefile, then the command _m_a_k_e _-_n should indicate the proper flags to invoke _c_f_l_o_w with. -X eliminate header files (empty files are made to a temporary location). This often makes better results occur. Files to look at eliminating are: stdio.h errno.h ctypes.h stdlib.h -V Echo commands as they are being executed. AAUUTTHHOORRSS The graph printing command _p_r_c_g is essentially the one in M. M. Taylor's _c_a_l_l_s(1) as posted to the Usenet newsgroup comp.sources.unix. A new parser, _p_r_c_c, is based on Steven Kirkendall's _c_t_a_g_s(1) command which is distributed with the vi-clone _e_l_v_i_s(1). Marty Leisner (leisner@sdsp.mc.xerox.com) got this working on SunOS and Linux, and added a plethora of options to cflow; rewriting cflow to use bash. EENNVVIIRROONNMMEENNTT Uses _$_C_P_P, which is normally $CC -E. If $CC is not define, use gcc. _P_R_C_G is defaulted to be the prcg program. _P_R_C_C is defaulted to be the prcc program. HHIINNTTSS Sometimes redefine CPP as cat will produce output if you see known. BBUUGGSS An extern variable declaration is overridden by an actual (global) variable declaration. A complaint is written to stderr whether there is a conflict or not. PUBLIC 2 CFLOW(1) CFLOW(1) Function parameters are ignored. If these parameters share the names of global variables, then references to them are flagged as external references. The _s_t_a_t_i_c qualifier is ignored. Only the first defini- tion of a function or variable is recognized. It appears a definition like mmaaiinn(()) {{ ffoooo(());; causes problems. PUBLIC 3