1
2FRAMA-C(1) General Commands Manual FRAMA-C(1)
3
4
5
7 frama-c[.byte] - a static analyzer for C programs
8
9 frama-c-gui[.byte] - the graphical interface of frama-c
10
11
13 frama-c [ options ] files
14
15
17 frama-c is a suite of tools dedicated to the analysis of source code
18 written in C. It gathers several static analysis techniques in a sin‐
19 gle collaborative framework. This framework can be extended by addi‐
20 tional plugins placed in the $FRAMAC_PLUGIN directory. The command
21
22 frama-c --plugins
23
24 will provide the full list of the plugins that are currently installed.
25
26 frama-c-gui is the graphical user interface of frama-c. It features
27 the same options as the command-line version.
28
29 frama-c.byte and frama-c-gui.byte are the ocaml bytecode versions of
30 the command-line and graphical user interface respectively.
31
32 By default, Frama-C recognizes .c files as C files needing pre-process‐
33 ing and .i files as C files having been already pre-processed. Some
34 plugins may extend the list of recognized files. Pre-processing can be
35 customized through the -cpp-command and -cpp-extra-args options.
36
37
39 Syntax
40
41 Options taking an additional parameter can also be written under the
42 form
43
44 -option=param
45
46 This form is mandatory when param starts with a dash ('-').
47
48 Most options that take no parameter have a corresponding
49
50 -no-option
51
52 option which has the opposite effect.
53
54 Help options
55
56 -help gives a short usage notice.
57
58 -kernel-help
59 prints the list of options recognized by Frama-C's kernel
60
61 -verbose n
62 Sets verbosity level (default is 1). Setting it to 0 will output
63 less progress messages. This level can also be set on a
64 per-plugin basis, with option -plugin-verbose n. Verbosity
65 level of the kernel can be controlled with option -kernel-ver‐
66 bose n.
67
68 -debug n
69 Sets debugging level (default is 0, meaning no debugging mes‐
70 sages). This option has the same per-plugin (and kernel) spe‐
71 cializations as -verbose.
72
73 -quiet Sets verbosity and debugging level to 0.
74
75 Options controlling Frama-C's kernel
76
77 -absolute-valid-range <min-max>
78 considers that all numerical addresses in the range min-max are
79 valid. Bounds are parsed as ocaml integer constants. By default,
80 all numerical addresses are considered invalid.
81
82 -add-path p1[,p2[...,pn]]
83 adds directories <p1> through <pn> to the list of directories in
84 which plugins are searched.
85
86 [-no]-aggressive-merging
87 merges function definitions modulo renaming. Defaults to no.
88
89 [-no]-allow-duplication
90 allows duplication of small blocks during normalization of tests
91 and loops. Otherwise, normalization uses labels and gotos. Big‐
92 ger blocks and blocks with non-trivial control flow are never
93 duplicated. Defaults to yes.
94
95 [-no]-annot
96 reads ACSL annotations. This is the default. Annotations are
97 pre-processed by default. Use -no-pp-annot if you don't want to
98 expand macros in annotations.
99
100 -big-ints-hex max
101 integers larger than max are displayed in hexadecimal (by
102 default, all integers are displayed in decimal)
103
104 -check performs integrity checks on the internal AST (for developers
105 only).
106
107 [-no]-asm-contracts
108 generates contracts for assembly code written according to gcc's
109 extended syntax. Defaults to yes.
110
111 [-no]-asm-contracts-auto-validate
112 automatically marks contracts generated from asm as valid.
113 Defaults to no.
114
115 -c11 enables (partial) C11 compatibility, e.g. typedef redefinitions.
116 Defaults to no.
117
118 [-no]-collapse-call-cast
119 allows implicit cast between the value returned by a function
120 and the lvalue it is assigned to. Otherwise, a temporary vari‐
121 able is used and the cast is made explicit. Defaults to yes.
122
123 [-no]-constfold
124 folds all syntactically constant expressions in the code before
125 analyses. Defaults to no.
126
127 -const-readonly
128 variables with const qualifier must be actually constant.
129 Defaults to yes. The opposite option is -unsafe-writable.
130
131 [-no]-continue-annot-error
132 When analyzing an annotation, the default behavior (the -no ver‐
133 sion of this option) when a typechecking error occurs is to
134 reject the source file as is the case for typechecking errors
135 within the C code. With this option on, the typechecker will
136 only output a warning and discard the annotation but typecheck‐
137 ing will continue (errors in C code are still fatal, though).
138
139 -cpp-command cmd
140 Uses cmd as the command to pre-process C files. Defaults to the
141 CPP environment variable or to
142
143 gcc -C -E -I.
144
145 if it is not set. In order to preserve ACSL annotations, the
146 preprocessor must keep comments (the -C option for gcc).
147 %1 and %2 can be used in cmd to denote the original source file
148 and the pre-processed file respectively.
149
150 -cpp-extra-args args
151 Gives additional arguments to the pre-processor. This is only
152 useful when -preprocess-annot is set. Pre-processing annotations
153 is done in two separate pre-processing stages. The first one is
154 a normal pass on the C code which retains macro definitions.
155 These are then used in the second pass during which annotations
156 are pre-processed. args are used only for the first pass, so
157 that arguments that should not be used twice (such as additional
158 include directives or macro definitions) must thus go there
159 instead of -cpp-command.
160
161 [-no]-cpp-frama-c-compliant
162 indicates that the chosen preprocessor complies to some Frama-C
163 requirements, such as accepting the same set of options as GNU
164 cpp, and accepting architecture-specific options such as
165 -m32/-m64. Default values depend on the installed preprocessor
166 at configure time. See also -pp-annot.
167
168 -custom-annot-char c
169 uses character c for starting ACSL annotations.
170
171 [-no]-autoload-plugins
172 When on, load all the dynamic plugins found in the search path
173 (see -print-plugin-path for more information on the default
174 search path). Otherwise, only plugins requested by -load-module
175 will be loaded. Default behavior is on.
176
177 -enums repr
178 Choose the way the representation of enumerated types is deter‐
179 mined. frama-c -enums help gives the list of available options.
180 Default is gcc-enums
181
182 -float-digits n
183 When outputting floating-point numbers, display n digits.
184 Defaults to 12.
185
186 -float-flush-to-zero
187 Floating point operations flush to zero.
188
189 -float-hex
190 display floats as hexadecimal.
191
192 -float-normal
193 display floats with the standard OCaml routine.
194
195 -float-relative
196 display float intervals as [ lower_bound++width ].
197
198 [-no]-frama-c-stdlib
199 adds -I$FRAMAC_SHARE/libc to the options given to the cpp com‐
200 mand. If -cpp-frama-c-compliant is not false, also adds -nostd‐
201 inc to prevent an inconsistent mix of system and Frama-C header
202 files. Defaults to yes.
203
204 -implicit-function-declaration <action>
205 warns or aborts when a function is called before it has been
206 declared. <action> can be one of ignore, warn, or error.
207 Defaults to warn.
208
209 -initialized-padding-locals
210 Implicit initialization of locals sets padding bits to 0. If
211 false, padding bits are left uninitialized (defaults to yes).
212
213 -journal-disable
214 Do not output a journal of the current session. See -journal-
215 enable.
216
217 -journal-enable
218 On by default, dumps a journal of all the actions performed dur‐
219 ing the current Frama-C session in the form of an ocaml script
220 that can be replayed with -load-script. The name of the script
221 can be set with the -journal-name option.
222
223 -journal-name name
224 Set the name of the journal file (without the .ml extension).
225 Defaults to frama_c_journal.
226
227 [-no]-keep-comments
228 Tries to preserve comments when pretty-printing the source code
229 (defaults to no).
230
231 [-no]-keep-switch
232 When -simplify-cfg is set, keeps switch statements. Defaults to
233 no.
234
235 -keep-unused-specified-functions
236 See -remove-unused-specified-functions
237
238 -kernel-log kind:file
239 copies log messages from the Frama-C's kernel to file. kind
240 specifies which kinds of messages to be copied (e.g. w for warn‐
241 ings, e for errors, etc.). See -kernel-help for more details.
242 Can also be set on a per-plugin basis, with option -plugin-log.
243
244 [-no]-lib-entry
245 Indicates that the entry point is called during program execu‐
246 tion. This implies in particular that global variables cannot be
247 assumed to have their initial values. The default is -no-lib-
248 entry: the entry point is also the starting point of the program
249 and globals have their initial value.
250
251 -load file
252 loads the (previously saved) state contained in file.
253
254 -load-module m1[,m2[...,mn]]
255 loads the ocaml modules <m1> through <mn>. These modules must
256 be .cmxs files for the native code version of Frama-c and
257 .cmo or.cma files for the bytecode version (see the Dynlink sec‐
258 tion of the OCaml manual for more information). All modules
259 which are present in the plugin search paths are automatically
260 loaded.
261
262 -load-script s1[,s2,[...,sn]]
263 loads the ocaml scripts <s1> through <sn>. The scripts must be
264 .ml files. They must be compilable relying only on the OCaml
265 standard library and Frama-C's API. If some custom compilation
266 step is needed, compile them outside of Frama-C and use -load-
267 module instead.
268
269 -machdep machine
270 uses machine as the current machine-dependent configuration
271 (size of the various integer types, endiandness, ...). The list
272 of currently supported machines is available through -machdep
273 help option. Default is x86_32
274
275 -main f
276 Sets f as the entry point of the analysis. Defaults to 'main'.
277 By default, it is considered as the starting point of the pro‐
278 gram under analysis. Use -lib-entry if f is supposed to be
279 called in the middle of an execution.
280
281 -obfuscate
282 prints an obfuscated version of the code (where original identi‐
283 fiers are replaced by meaningless ones) and exits. The corre‐
284 spondence table between original and new symbols is kept at the
285 beginning of the result.
286
287 -ocode file
288 redirects pretty-printed code to file instead of standard out‐
289 put.
290
291 [-no]-orig-name
292 During the normalization phase, some variables may get renamed
293 when different variables with the same name can co-exist (e.g. a
294 global variable and a formal parameter). When this option is on,
295 a message is printed each time this occurs. Defaults to no.
296
297 [-no]-pp-annot
298 pre-processes annotations. This is currently only possible when
299 using gcc (or GNU cpp) pre-processor. The default is to pre-
300 process annotations when the default pre-processor is identified
301 as GNU or GNU-like. See also -cpp-frama-c-compliant
302
303 [-no]-print
304 pretty-prints the source code as normalized by CIL (defaults to
305 no).
306
307 [-no]-print-libc
308 expands #include directives in the pretty-printed CIL code for
309 files in the Frama-C standard library (defaults to no).
310
311 -print-libpath
312 outputs the directory where the Frama-C kernel library is
313 installed.
314
315 -print-path
316 alias of -print-share-path
317
318 -print-plugin-path
319 outputs the directory where Frama-C searches its plugins (can be
320 overridden by the FRAMAC_PLUGIN variable and the -add-path
321 option)
322
323 -print-share-path
324 outputs the directory where Frama-C stores its data (can be
325 overridden by the FRAMAC_SHARE variable)
326
327 [-no]-remove-exn
328 transforms throw and try/catch statements into normal C func‐
329 tions. Defaults to no, unless the input source language has an
330 exception mechanism.
331
332 -remove-projects p1,...,pn
333 removes the given projects p1,...,pn. @all_but_cur‐
334 rent removes all projects but the current one.
335
336 -remove-unused-specified-functions
337 keeps function prototypes that have an ACSL specification but
338 are not used in the code. This is the default. Functions having
339 the attribute FRAMAC_BUILTIN are always kept.
340
341 -safe-arrays
342 For multidimensional arrays or arrays that are fields inside
343 structs, assumes that all accesses must be in bound (set by
344 default). The opposite option is -unsafe-arrays.
345
346 -save file
347 Saves Frama-C's state into file after analyses have taken place.
348
349 -session s
350 sets s as the directory in which session files are searched.
351
352 [-no]-set-project-as-default
353 the current project becomes the default one (and so future -then
354 sequences are applied on it). Defaults to no.
355
356 [-no]-simplify-cfg
357 removes break, continue and switch statements before analyses.
358 Defaults to no.
359
360 [-no]-simplify-trivial-loops
361 simplifies trivial loops such as do ... while (0) loops.
362 Defaults to yes.
363
364 -then allows one to compose analyzes: a first run of Frama-C will
365 occur with the options before -then and a second run will be
366 done with the options after -then on the current project from
367 the first run.
368
369 -then-last
370 like -then, but the second group of actions is executed on the
371 last project created by a program transformer.
372
373 -then-on prj
374 Similar to -then except that the second run is performed in
375 project prj. If no such project exists, Frama-C exits with an
376 error.
377
378 -then-replace
379 like -then-last, but also removes the previous current project.
380
381 -time file
382 appends user time and date in the given file when Frama-C exits.
383
384 -typecheck
385 forces typechecking of the source files. This option is only
386 relevant if no further analysis is requested (as typechecking
387 will implicitly occur before the analysis is launched).
388
389 -ulevel n
390 syntactically unroll loops n times before the analysis. This can
391 be quite costly and some plugins (e.g. the value analysis) pro‐
392 vide more efficient ways to perform the same thing. See their
393 respective manuals for more information. This can also be acti‐
394 vated on a per-loop basis via the loop pragma unroll <m> direc‐
395 tive. A negative value for n will inhibit such pragmas.
396
397 [-no]-ulevel-force
398 ignores UNROLL loop pragmas disabling unrolling.
399
400 [-no]-unicode
401 outputs ACSL formulas with utf8 characters. This is the default.
402 When given the -no-unicode option, Frama-C will use the ASCII
403 version instead. See the ACSL manual for the correspondence.
404
405 -unsafe-arrays
406 see -safe-arrays
407
408 [-no]-unspecified-access
409 checks that read/write accesses occurring in an unspecified
410 order (according to the C standard's notion of sequence points)
411 are performed on separate locations. With -no-unspecified-
412 access, assumes that it is always the case (this is the
413 default).
414
415 -version
416 outputs the version string of Frama-C.
417
418 -warn-decimal-float <freq>
419 warns when a floating-point constant cannot be exactly repre‐
420 sented (e.g. 0.1). <freq> can be one of none, once, or all
421
422 [-no]-warn-signed-downcast
423 generates alarms when signed downcasts may exceed the destina‐
424 tion range (defaults to no).
425
426 [-no]-warn-signed-overflow
427 generates alarms for signed operations that overflow (defaults
428 to yes).
429
430 [-no]-warn-unsigned-downcast
431 generates alarms when unsigned downcasts may exceed the destina‐
432 tion range (defaults to no).
433
434 [-no]-warn-unsigned-overflow
435 generates alarms for unsigned operations that overflow (defaults
436 to no).
437
438 Plugin-specific options
439
440 For each plugin, the command
441
442 frama-c -plugin-help
443
444 will give the list of options that are specific to the plugin.
445
446
448 0 Successful execution
449
450 1 Invalid user input
451
452 2 User interruption (kill or equivalent)
453
454 3 Unimplemented feature
455
456 4 5 6 Internal error
457
458 125 Unknown error
459
460 Exit status greater than 2 can be considered as a bug (or a feature
461 request for the case of exit status 3) and may be reported on Frama-C's
462 BTS (see below).
463
464
466 It is possible to control the places where Frama-C looks for its files
467 through the following variables.
468
469 FRAMAC_LIB
470 The directory where kernel's compiled interfaces are installed.
471
472 FRAMAC_PLUGIN
473 The directory where Frama-C can find standard plugins. If you
474 wish to have plugins in several places, use -add-path instead.
475
476 FRAMAC_SHARE
477 The directory where Frama-C data (e.g. its version of the stan‐
478 dard library) is installed.
479
480
482 Frama-C user manual: $FRAMAC_SHARE/manuals/user-manual.pdf
483
484 Frama-C homepage: http://frama-c.com
485
486 Frama-C BTS: http://bts.frama-c.com
487
488
489
490 2016-12-02 FRAMA-C(1)