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