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