cflow(1) — Commands
OSF
NAME
cflow − Generates a C language flow graph of external references
SYNOPSIS
cflow [-dnumber] [-i_] [-ip] [-ix] [-MA] [-Ndnumber] [-Nlnumber] [-Nnnumber]
[-Ntnumber] [-r] file ...
The cflow command analyzes C, yacc, lex, assembler, and object files and writes a chart of their external references to standard output.
FLAGS
-dnumber
Sets to a decimal integer the depth at which the flow graph is cut off. By default this is a large number. Do not set the cutoff depth to a nonpositive integer.
-i_Includes names that begin with an underline character. The default excludes these functions (and corresponding data if -ix is used).
-ipDisables ANSI function prototypes. The default option is to fill in undefined function information with available prototype declarations.
-ixIncludes external and static data symbols. The default includes only functions.
-MASpecifies that the first pass of the modified lint command is operated in ANSI mode. The default mode of operation is extended mode.
-Ndnumber
Changes the dimension table size to number. The default value of number is 2000.
-Nlnumber
Changes the number of type nodes to number. The default value of number is 8000.
-Nnnumber
Changes the symbol table size to number. The default value of number is 1500.
-Ntnumber
Changes the number of tree nodes to number. The default value of number is 1000.
-rProduces an inverted listing that shows the callers of each function, sorted by called function.
In addition, the lint command recognizes the following flags of the cpp macro preprocessor:
-I directory
Adds directory to the list of directories in which the lint program searches for #include files.
-D name[=definition]
Defines name, as if by #define. The default definition is 1.
-U name
Removes any initial definition of name, where name is a reserved symbol that is predefined by the particular preprocessor.
DESCRIPTION
The cflow command sends files with suffixes .y to yacc, .l to lex, and .c to the cpp macro preprocessor for processing. A modified first pass of the lint command then processes the yacc, lex, and cpp output, or any .i files. The cflow command assembles files with suffix .s, extracting information from the symbol table (as it does with .o files). From this output, the cflow command produces a graph of external references and writes it to standard output. Each line of output provides the following information (in order from left to right):
•A line number followed by sufficient tabs to indicate the level of nesting
•The name of the global, a colon, and its definition
The name is normally a function not defined as external and not beginning with an underline character (see the -i_ and -i inclusion flags). For information extracted from C source files, the definition consists of an abstract type declaration (for example, char∗), the name of the source file surrounded by angle brackets, and the line number on which the definition was found. Definitions extracted from object files contain the filename and section under which the symbol appeared, such as text or data. The cflow command deletes leading underline characters in C-style external names.
Once the cflow command displays a name, later references to the name contain only the cflow line number where the definition can be found. For undefined references, cflow displays only <> (angled brackets). If the nesting level becomes too deep to display in available space, pipe the output from the cflow command to the pr command using the -e flag to compress the tab expansion to less than eight spaces per tab stop.
To ensure that the line numbers produced by cflow match your lex and yacc files, you must send the .l or .y file to the cflow command.
EXAMPLES
1.To generate a default flow graph of these C files that comprise a program, enter:
cflow timeout.c kill.c error.c
2.To produce a C flow graph with a single level of nesting of functions, enter:
cflow -d1 resam.c pptp.c ptpt.c rrr.c whn.c
3.To generate a cflow graph of a lex program, enter:
cflow scan.l
4.To generate a cflow graph of a yacc program, enter:
cflow yaccfile.y
5.To generate an inverted listing that shows the callers of each of the functions in the C files used in the previous examples, enter:
cflow -r resam.c pptp.c ptpt.c rrr.c whn.c