1CFLOW(1P) POSIX Programmer's Manual CFLOW(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 cflow - generate a C-language flowgraph (DEVELOPMENT)
13
15 cflow [-r][-d num][-D name[=def]] ... [-i incl][-I dir] ...
16 [-U dir] ... file ...
17
19 The cflow utility shall analyze a collection of object files or assem‐
20 bler, C-language, lex, or yacc source files, and attempt to build a
21 graph, written to standard output, charting the external references.
22
24 The cflow utility shall conform to the Base Definitions volume of
25 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines, except
26 that the order of the -D, -I, and -U options (which are identical to
27 their interpretation by c99) is significant.
28
29 The following options shall be supported:
30
31 -d num
32 Indicate the depth at which the flowgraph is cut off. The appli‐
33 cation shall ensure that the argument num is a decimal integer.
34 By default this is a very large number (typically greater than
35 32000). Attempts to set the cut-off depth to a non-positive
36 integer shall be ignored.
37
38 -i incl
39 Increase the number of included symbols. The incl option-argu‐
40 ment is one of the following characters:
41
42 x
43 Include external and static data symbols. The default shall be
44 to include only functions in the flowgraph.
45
46 _
47 (Underscore) Include names that begin with an underscore. The
48 default shall be to exclude these functions (and data if -i x is
49 used).
50
51
52 -r Reverse the caller:callee relationship, producing an inverted
53 listing showing the callers of each function. The listing shall
54 also be sorted in lexicographical order by callee.
55
56
58 The following operand is supported:
59
60 file The pathname of a file for which a graph is to be generated.
61 Filenames suffixed by .l shall shall be taken to be lex input,
62 .y as yacc input, .c as c99 input, and .i as the output of c99
63 -E. Such files shall be processed as appropriate, determined by
64 their suffix.
65
66 Files suffixed by .s (conventionally assembler source) may have more
67 limited information extracted from them.
68
69
71 Not used.
72
74 The input files shall be object files or assembler, C-language, lex, or
75 yacc source files.
76
78 The following environment variables shall affect the execution of
79 cflow:
80
81 LANG Provide a default value for the internationalization variables
82 that are unset or null. (See the Base Definitions volume of
83 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
84 ables for the precedence of internationalization variables used
85 to determine the values of locale categories.)
86
87 LC_ALL If set to a non-empty string value, override the values of all
88 the other internationalization variables.
89
90 LC_COLLATE
91
92 Determine the locale for the ordering of the output when the -r
93 option is used.
94
95 LC_CTYPE
96 Determine the locale for the interpretation of sequences of
97 bytes of text data as characters (for example, single-byte as
98 opposed to multi-byte characters in arguments and input files).
99
100 LC_MESSAGES
101 Determine the locale that should be used to affect the format
102 and contents of diagnostic messages written to standard error.
103
104 NLSPATH
105 Determine the location of message catalogs for the processing of
106 LC_MESSAGES .
107
108
110 Default.
111
113 The flowgraph written to standard output shall be formatted as follows:
114
115
116 "%d %s:%s\n", <reference number>, <global>, <definition>
117
118 Each line of output begins with a reference (that is, line) number,
119 followed by indentation of at least one column position per level. This
120 is followed by the name of the global, a colon, and its definition.
121 Normally globals are only functions not defined as an external or
122 beginning with an underscore; see the OPTIONS section for the -i inclu‐
123 sion option. For information extracted from C-language source, the def‐
124 inition consists of an abstract type declaration (for example, char *)
125 and, delimited by angle brackets, the name of the source file and the
126 line number where the definition was found. Definitions extracted from
127 object files indicate the filename and location counter under which the
128 symbol appeared (for example, text).
129
130 Once a definition of a name has been written, subsequent references to
131 that name contain only the reference number of the line where the defi‐
132 nition can be found. For undefined references, only "<>" shall be writ‐
133 ten.
134
136 The standard error shall be used only for diagnostic messages.
137
139 None.
140
142 None.
143
145 The following exit values shall be returned:
146
147 0 Successful completion.
148
149 >0 An error occurred.
150
151
153 Default.
154
155 The following sections are informative.
156
158 Files produced by lex and yacc cause the reordering of line number dec‐
159 larations, and this can confuse cflow. To obtain proper results, the
160 input of yacc or lex must be directed to cflow.
161
163 Given the following in file.c:
164
165
166 int i;
167 int f();
168 int g();
169 int h();
170 int
171 main()
172 {
173 f();
174 g();
175 f();
176 }
177 int
178 f()
179 {
180 i = h();
181 }
182
183 The command:
184
185
186 cflow -i x file.c
187
188 produces the output:
189
190
191 1 main: int(), <file.c 6>
192 2 f: int(), <file.c 13>
193 3 h: <>
194 4 i: int, <file.c 1>
195 5 g: <>
196
198 None.
199
201 None.
202
204 c99, lex, yacc
205
207 Portions of this text are reprinted and reproduced in electronic form
208 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
209 -- Portable Operating System Interface (POSIX), The Open Group Base
210 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
211 Electrical and Electronics Engineers, Inc and The Open Group. In the
212 event of any discrepancy between this version and the original IEEE and
213 The Open Group Standard, the original IEEE and The Open Group Standard
214 is the referee document. The original Standard can be obtained online
215 at http://www.opengroup.org/unix/online.html .
216
217
218
219IEEE/The Open Group 2003 CFLOW(1P)