cflow
—
build call graphs from C, Lex, Yacc and Assembler files
cflow |
[-aAcCGgnpPr ] [-d
num] [-D
name[=value]] [-f
filelist] [-i
incl] [-I
directory] [-U
name] [-R
root] [file ...] |
The cflow
utility reads C, Lex, Yacc or Assembler source
code files and prints call graphs from their contents.
The following options are supported:
-a
- Use the GNU
as(1)
syntax parser for assembler
files. This flag only works for assembler source code files.
-A
- Exclude ANSI C keywords. All globals and functions defined by the ANSI C
standard are ignored. This flag only works for C source code files.
-c
- Print all calls within a function, including subsequent invocations of the
same function.
-C
- Exclude C99 keywords. All globals and functions defined by the C99
standard are ignored. This does not include the ANSI C standard, but only
new keywords of the C99 standard. This flag only works for C source code
files.
-d
num
- The depth at which the graph is cut off. The num
argument must be a positive integer >=0.
-D
name=[value]
- Define name as if by a C-language #define directive. This option behaves
exactly like the [
-D
] argument of the
c99(1)
utility. This flag only works for C source
code files and implicitily sets the [-p
]
argument.
-G
- Exclude GCC specific keywords. All keywords defined and used by the GNU C
compiler are ignored. This flag only works for C source code files.
-g
- Produce a
dot(1)
graph for graphviz output.
-i
incl
- Increase the number of included symbols. The incl
argument can be one of the following characters:
x
- Include external and static data symbols.
_
- Include names that begin with an underscore.
-I
directory
- Change the algorithm for searching for headers whose names are not
absolute pathnames to look in the directory named by the directory
pathname before looking in the usual places. This option behaves exactly
like the [
-I
] argument of the
c99(1)
utility. This flag only works for C source
code files and implicitily sets the [-p
]
argument.
-n
- Use the
nasm(1)
syntax parser for assembler files.
This flag only works for assembler source code files and will be the
default, if neither [-a
] nor
[-n
] are set.
-p
- Use the C preprocessor on the file before building the flowgraph. By
default "cc -E" will be used for preprocessing, if the
environment variable
CPP
is unset. This flag only
works for C source code files.
-P
- Exclude POSIX keywords. All globals and functions defined by the
IEEE Std 1003.1-2001 (“POSIX.1”)
specification are ignored. This does not include the ANSI C or C99
standards, but keywords of the IEEE Std 1003.1-2001
(“POSIX.1”) specification. This flag only works for C
source code files.
-r
- Print the flowgraph in reversed order, producing an inverted listing
showing the callers of each function.
-R
root
- The function to use as root function. The default is "main". If
set to a name, that cannot be found in the file, all functions are
printed.
-U
name
- Remove any initial definition of name. This option
behaves exactly like the [
-U
] argument of the
c99(1)
utility. This flag only works for C source
code files and implicitily sets the [-p
]
argument.
The cflow
utility exits 0 on success,
and >0 if an error occurs.
The cflow
utility will examine the
CPP
environment variable and use its contents to
invoke the preprocessor, if the [-p
] argument is used.
The cflow
utility is compliant with the
IEEE Std 1003.1-2001 (“POSIX.1”)
specification.
The flags [-aAcCfGgnPpR
] are extensions to
the specification.
Marcus von Appen ⟨marcus@sysfault.org⟩