Content-type: text/html Man page of cflow

cflow

Section: User Commands (1)
Index Return to Main Contents
 

NAME

cflow - Generates a C language flow graph of external references  

SYNOPSIS

cflow [-r] [-d number] [-D name[=def]]... [-i incl] [-I dir]... [-U dir]... [-MA] [-Ndnumber] [-Nlnumber] [-Nnnumber] [-Ntnumber] file...

The token -- (double-dash) is accepted as a delimiter indicating the end of options. Any following arguments are treated as operands, even if they begin with the - character.
 

STANDARDS

Interfaces documented on this reference page conform to industry standards as follows:

cflow:  XPG4, XPG4-UNIX

Refer to the standards(5) reference page for more information about industry standards and associated tags.
 

OPTIONS

Indicates the depth at which the flow graph is cut off. The argument number is a decimal integer. By default this is a very large number. Attempts to set the cut-off depth to a nonpositive integer are ignored. Defines name, as if by a C-language #define directive. If no =def is given, a value of 1 is used. Changes the number of included symbols. The incl parameter is one of the following characters: (Underscore). Includes names that begin with an underscore character. By default, these functions are excluded (and corresponding data if -i x is used). [Compaq]  Disables ANSI function prototypes. By default, undefined function information is filled in with available prototype declarations. Includes external and static data symbols. By default, only functions are included. Adds the directory specified by dir to the list of directories in which the lint program searches for #include files. [Compaq]  Specifies that the first pass of the modified lint command is operated in ANSI mode. The default mode of operation is extended mode. [Compaq]  Changes the dimension table size to number. The default value of number is 2000. [Compaq]  Changes the number of type nodes to number. The default value of number is 8000. [Compaq]  Changes the symbol table size to number. The default value of number is 1500. [Compaq]  Changes the number of tree nodes to number. The default value of number is 1000. Produces an inverted listing that shows the callers of each function, sorted by called function. Removes any initial definition of name, where name is a reserved symbol that is predefined by the particular preprocessor.
 

DESCRIPTION

The cflow command analyzes a collection of object files or assembler, C-language, lex, or yacc source files, and attempts to write a chart of their external references to standard output.

Files suffixed in .l, .y, .c, and .i are processed by lex and yacc and preprocessed by the compiler preprocessor phase (bypassed for .i files) as appropriate. The output is then run through a modified first pass of lint. Files suffixed with .s are assembled and information is extracted (as in .o files) from the symbol table.

From this output, cflow() writes a flow graph 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 x inclusion options). 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 option 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

Given the following in file.c:

int i; main() {
        f();
        g();
        f(); } f() {
        i = h(); }
the command: cflow -i x file.c
produces the following output: 1 main: () int, <file.c 4> 2 f: () int, <file.c 11> 3 h: <> 4 i: int, <file.c 1> 5 g: <> To generate a default flow graph of these C files that comprise a program, enter: cflow timeout.c kill.c error.c 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 To generate a cflow graph of a lex program, enter: cflow scan.l To generate a cflow graph of a yacc program, enter: cflow yaccfile.y 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

 

ENVIRONMENT VARIABLES

The following environment variables affect the behavior of cflow: Provides a default value for the locale category variables that are not set or null. If set, overrides the values of all other locale variables. Determines the order in which output is sorted for the -r option. Determines the locale for the interpretation of byte sequences as characters (single-byte or multibyte) in input parameters and files. Determines the locale used to affect the format and contents of diagnostic messages displayed by the command. Determines the location of message catalogs for processing of LC_MESSAGES.
 

SEE ALSO

Commands:  lex(1), lint(1), nm(1), pr(1), yacc(1)

Standards:  standards(5)


 

Index

NAME
SYNOPSIS
STANDARDS
OPTIONS
DESCRIPTION
EXAMPLES
ENVIRONMENT VARIABLES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 02:42:46 GMT, October 02, 2010