[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 1

cflow Command

Purpose

Generates a C and C++ flow graph of external references.

Syntax

cflow -d Number ] [ -I Directory ] [ -i _ ] [ -i p ] [ -i x ] [ -qOption ] [ -r ] [ -MA ] [ -U Name ] [ -NdNumber ] [ -NlNumber ] [ -NnNumber ] [ -NtNumber ] [ -D Name[=Definition ] ] File ...

Description

The cflow command analyzes the C, C++, yacc, lex, assembler, and object files and writes a chart of their external references to standard output.

Note: Processing of C++ language files by the cflow command requires the presence of the IBM C Set++ Compiler/6000 package.

The cflow command sends files with the .y, .l, and .c suffixes to the yacc command, lex command, and cpp command 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 sends files with a .C suffix to the C Set++ compiler.

The cflow command assembles files with the .s suffix, 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):

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 and 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 file name and location counter 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.

Note: To ensure that the line numbers produced by the cflow command match your lex and yacc files, you must send the .l or .y file to the cflow command.

Flags

-d Number 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 the -ix flag is used).
-i p Disables ANSI function prototypes. The default option is to fill in undefined function information with available prototype declarations.
-i x Includes external and static data symbols. The default includes only functions.
-r Produces an inverted listing that shows the callers of each function, sorted by called function.
-MA Specifies ANSI mode. The cflow command expects ANSI C code in this mode. The default mode of operation is extended mode.
-NdNumber Changes the dimension table size to the Number parameter. The default value of Number is 2000.
-NlNumber Changes the number of type nodes to the Number parameter. The default value of Number is 8000.
-NnNumber Changes the symbol table size to the Number parameter. The default value of Number is 1500.
-NtNumber Changes the number of tree nodes to the Number parameter. The default value of Number is 1000.

In addition, the cflow command recognizes the following flags of the cpp command (macro preprocessor):

-D Name[=Definition] Defines the Name parameter, as if by the #define statement. The default Definition is 1.
-qOption Passes the -qOption to the preprocessor. For example, -qmbcs sets multibyte mode specified by the current locale and -qidirfirst modifies the search order for files included with the #include file_name directive.
-I Directory Adds the specified Directory to the list of directories in which the cflow program searches for #include files.
-U Name Removes any initial definition of the Name parameter, where Name is a reserved symbol that is predefined by the particular preprocessor.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To generate a default flow graph of these C files that compose a program, enter:
    cflow timeout.c kill.c error.c 
  2. To produce a cflow 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 the yacc program, enter:
    cflow yaccfile.y
  5. To generate an inverted listing showing the callers of each of the functions in the C files used in example 2, enter:
    cflow -r resam.c pptp.c ptpt.c rrr.c whn.c

Files

/usr/ccs/bin/cflow Driver for the cflow command
/usr/ccs/lib/cflow1 Executable for the cflow command
/usr/ccs/lib/dag Executable for the cflow command
/usr/ccs/lib/flip Executable for the cflow command
/usr/ccs/lib/lpfx Executable for the cflow command
/usr/ccs/lib/nmf Executable for the cflow command
/var/tmp/cf.* Temporary files created by the cflow command

Related Information

The as command, cpp command, lex command, lint command, nm command, pr command, yacc command.


[ Previous | Next | Contents | Glossary | Home | Search ]