FRAMA-C(1)
FRAMA-C(1) โ okay bestie, this is the manual page and it's a lot, but we're gonna get through it together ๐
๐ธ NAME ๐ธ
frama-c[.byte]โ a static analyzer for C programs ๐งframa-c-gui[.byte]โ the graphical interface offrama-c๐
๐ฆ SYNOPSIS ๐ฆ
frama-c [ options ] files
๐ DESCRIPTION ๐
okay so frama-c is literally a whole suite of tools, and it's all about analyzing source code written in C. the way it does this is it gathers several analysis techniques together into one single collaborative framework. and the framework itself can be extended by additional plugins, which live in the $FRAMAC_PLUGIN directory. and if you wanna know what you actually have installed, just run
frama-c --plugins
and it will provide the full list of the plugins that are currently installed. slay ๐
frama-c-gui is the graphical user interface of frama-c, and the iconic part is that it features the same options as the command-line version. no cap.
frama-c.byte and frama-c-gui.byte are the OCaml bytecode versions of the command-line and graphical user interface respectively. iykyk.
by default, Frama-C recognizes .c files as C files needing pre-processing, and .i files as C files having been already pre-processed. some plugins may extend the list of recognized files (they're allowed, it's their moment โจ). pre-processing can be customized through the -cpp-command and -cpp-extra-args options.
โจ OPTIONS โจ
๐ Syntax ๐
options that take an additional parameter can also be written under the form
-option=param
and this form is mandatory when param starts with a dash (-). like, no wiggle room there fr fr.
most options that take no parameter have a corresponding
-no-option
option which has the opposite effect. cute, symmetric, obsessed.
๐ Help options ๐
-helpโ gives a short usage notice. quick little vibe check.-kernel-helpโ prints the list of options recognized by Frama-C's kernel-explainโ prints a help message for each other option given on the command line-verbosen โ sets verbosity level. defaults to 1. setting it to 0 will output less progress messages. this level can also be set on a per-plugin basis, with option-plugin-verbosen. verbosity level of the kernel can be controlled with option-kernel-verbosen.-debugn โ sets debugging level. defaults to 0, meaning no debugging messages. this option has the same per-plugin (and kernel) specializations as-verbose.-quietโ sets verbosity and debugging level to 0. the silent treatment, but consensual.
๐ Options controlling Frama-C's kernel ๐
-absolute-valid-rangemin-max โ considers that all numerical addresses in the range min-max are valid. bounds are parsed as OCaml integer constants. by default, all numerical addresses are considered invalid.-add-pathp1[,p2[...,pn]] โ adds directories p1 through pn to the list of directories in which plugins are searched.-add-symbolic-pathp1:n1[,p2:n2[...,pn:nn]] โ replaces each path pi with the name ni when displaying file locations in messages.[-no]-aggressive-mergingโ merges function definitions modulo renaming. defaults to no.[-no]-allow-duplicationโ allows duplication of small blocks during normalization of tests and loops. otherwise, normalization uses labels and gotos. bigger blocks and blocks with non-trivial control flow are never duplicated. defaults to yes.[-no]-annotโ reads ACSL annotations. this is the default. annotations are pre-processed by default. use-no-pp-annotif you don't want to expand macros in annotations.-autocompletep1,...,pn โ lists the options of plugins p1,...,pn in a format suitable for autocompletion scripts.-big-ints-hexmax โ integers larger than max are displayed in hexadecimal (by default, all integers are displayed in decimal).-checkโ performs integrity checks on the internal AST (for developers only). ๐ง[-no]-asm-contractsโ generates contracts for assembly code written according to gcc's extended syntax. defaults to yes.[-no]-asm-contracts-auto-validateโ automatically marks contracts generated from asm as valid. defaults to no.-c11โ enables (partial) C11 compatibility, e.g. typedef redefinitions. defaults to no.[-no]-collapse-call-castโ allows implicit cast between the value returned by a function and the lvalue it is assigned to. otherwise, a temporary variable is used and the cast is made explicit. defaults to yes.[-no]-constfoldโ folds all syntactically constant expressions in the code before analyses. defaults to no.-const-readonlyโ variables withconstqualifier must be actually constant. defaults to yes. the opposite option is-unsafe-writable.[-no]-continue-annot-errorโ when analyzing an annotation, the default behavior (the-noversion of this option) when a typechecking error occurs is to reject the source file, as is the case for typechecking errors within the C code. with this option on, the typechecker will only output a warning and discard the annotation, but type-checking will continue (errors in C code are still fatal, though).
Deprecated: use -kernel-warn-key annot-error instead.
-cpp-commandcmd โ uses cmd as the command to pre-process C files. defaults to theCPPenvironment variable or to
gcc -C -E -I.
if it is not set. if unset, the command is built as follows:
CPP -o
%1 and %2 can be used into the CPP string to mark the position of and respectively. note that this option is often better replaced by -cpp-extra-args.
-cpp-extra-argsargs โ gives additional arguments to the pre-processor. pre-processing annotations is done in two separate pre-processing stages. the first one is a normal pass on the C code which retains macro definitions. these are then used in the second pass during which annotations are pre-processed. args are used only for the first pass, so that arguments that should not be used twice (such as additional include directives or macro definitions) must thus go there instead of-cpp-command.-cpp-extra-args-per-filefile1:args1,...,filen:argsn โ like-cpp-extra-args, but the arguments only apply to the specified files.[-no]-cpp-frama-c-compliantโ indicates that the chosen preprocessor complies to some Frama-C requirements, such as accepting the same set of options as GNU cpp, and accepting architecture-specific options such as-m32/-m64. default values depend on the installed preprocessor at configure time. see also-pp-annot.[-no]-autoload-pluginsโ when on, load all the dynamic plugins found in the search path (see-print-plugin-pathfor more information on the default search path). otherwise, only plugins requested by-load-modulewill be loaded. defaults to on.-enumsrepr โ choose the way the representation of enumerated types is determined.frama-c -enums helpgives the list of available options. default isgcc-enums.-float-digitsn โ when outputting floating-point numbers, display n digits. defaults to 12.-float-flush-to-zeroโ floating point operations flush to zero.-float-hexโ display floats as hexadecimal.-float-normalโ display floats with the standard OCaml routine.-float-relativeโ display float intervals as[ lower_bound++width ].[-no]-frama-c-stdlibโ adds-I$FRAMAC_SHARE/libcto the options given to the cpp command. if-cpp-frama-c-compliantis not false, also adds-nostdincto prevent an inconsistent mix of system and Frama-C header files. defaults to yes.-implicit-function-declarationaction โ warns or aborts when a function is called before it has been declared. action can be one ofignore,warn, orerror. defaults towarn.
Deprecated: use -kernel-warn-key typing:implicit-function-declaration instead.
-initialized-padding-localsโ implicit initialization of locals sets padding bits to 0. if false, padding bits are left uninitialized. defaults to yes.-inline-callsf1,...,fn โ syntactically inlines calls to functions f1,...,fn. use@inlineto select all functions with attributeinline. recursive functions are inlined only at the first level. calls via function pointers are not inlined. ngl, pointer calls said "not today" ๐-journal-disableโ do not output a journal of the current session. see-journal-enable.-journal-enableโ on by default, dumps a journal of all the actions performed during the current Frama-C session in the form of an OCaml script that can be replayed with-load-script. the name of the script can be set with the-journal-nameoption.-journal-namename โ sets the name of the journal file (without the.mlextension). defaults toframa_c_journal.-json-compilation-databasepath โ use path as a JSON compilation database (seehttps://clang.llvm.org/docs/JSONCompilationDatabase.htmlfor more information): each file preprocessed by Frama-C will include corresponding-Iand-Dflags according to the specifications in path. if path is a directory, use<path>/compile_commands.json. disabled by default.[-no]-keep-commentsโ tries to preserve comments when pretty-printing the source code. defaults to no.[-no]-keep-switchโ when-simplify-cfgis set, keeps switch statements. defaults to no.-keep-unused-specified-functionsโ see-remove-unused-specified-functions.-keep-unused-typesโ see-remove-unused-types.-kernel-logkind:file โ copies log messages from the Frama-C's kernel to file. kind specifies which kinds of messages to be copied (e.g.wfor warnings,efor errors, etc.). see-kernel-helpfor more details. can also be set on a per-plugin basis, with option-<plugin>-log.-kernel-msg-keyk1,...,kn โ controls the emission of messages based on categories. use-kernel-msg-key helpto get a list of available categories, and-kernel-msg-key="*"to control all categories. to disable a category, add a-before its name; to enable a category, simply add its name, with an optional+before it. for instance,-kernel-msg-key=-k1,k2will disable messages from categoryk1and enable those from categoryk2. can also be set on a per-plugin basis, with option-<plugin>-msg-key. note that each plugin has its own set of categories. ๐-kernel-warn-key k1=a1,...,kn=anโ this is your warning vibe control panel ๐๏ธ for every warning categoryk, you pick an actiona. Want the full tea? Run-kernel-warn-key helpand it spills the whole list of categories plus whatever action they're currently rocking. The actions you can set per category are:active(aka warn),feedback,error,abort,once,feedback-once,err-once. If you just... don't give an action, it's the same as sayingactive. And bestie, you can also set warning categories per-plugin, using-<plugin>-warn-key. โจ[-no]-lib-entryโ says the entry point gets called while the program is already running. Which lowkey means you cannot assume global variables have their initial values โ they've been through stuff ๐. Default is-no-lib-entry: the entry point is also where the program starts, so globals are fresh out the box with their initial values.-load fileโ loads a previously saved state that's chillin' infile. ๐พ-load-module SPECโ dynamically loads OCaml plug-ins, modules and scripts, no cap ๐ฆ. EverySPECcan be an OCaml source or object file, with or without an extension, or a Findlib package. Loading order is preserved (periodt), and you can list extra dependencies in*.dependfiles.-load-script SPECโ literally just an alias for-load-module. Same energy, different name ๐-machdep machineโ usesmachineas the current machine-dependent configuration (sizes of the various integer types, endianness, that whole situation). Wanna know which machines are supported?-machdep helphas you covered. Default isx86_64.-main fโ setsfas the entry point of the analysis. Defaults tomain. By default it's treated as the starting point of the program under analysis. But iffis actually called mid-execution, use-lib-entryinstead, okay? ๐-obfuscateโ prints an obfuscated version of the code (all the original identifiers get swapped for meaningless ones) and then exits. The correspondence table mapping original symbols to new ones is kept at the beginning of the result, so you're not just lost in the void ๐-ocode fileโ redirects pretty-printed code intofileinstead of standard output. โจ[-no]-orig-nameโ during the normalization phase, some variables may get renamed when different variables with the same name can co-exist (think: a global variable and a formal parameter, awkward ๐ญ). When this option is on, a message prints every time that happens. Defaults to no.[-no]-pp-annotโ pre-processes annotations. Heads up: this is currently only possible when you're using thegcc(or GNUcpp) pre-processor. The default is to pre-process annotations when the default pre-processor is identified as GNU or GNU-like. Also see-cpp-frama-c-compliant๐[-no]-printโ pretty-prints the source code as normalized by CIL. Defaults to no.-print-cpp-commandsโ outputs the preprocessing commands for all input files. ๐-print-config-jsonโ outputs extensive Frama-C configuration data in JSON format. Yes bestie, machine-readable ๐[-no]-print-libcโ expands#includedirectives in the pretty-printed CIL code for files in the Frama-C standard library. Defaults to no.-print-libpathโ outputs the directory where the Frama-C kernel library is installed. ๐-print-pathโ alias of-print-share-path.-print-plugin-pathโ outputs the directory where Frama-C searches its plugins (this can be overridden by theFRAMAC_PLUGINvariable and the-add-pathoption).-print-share-pathโ outputs the directory where Frama-C stores its data (can be overridden by theFRAMAC_SHAREvariable).[-no]-remove-exnโ transformsthrowandtry/catchstatements into normal C functions. Defaults to no, unless the input source language has an exception mechanism โ in which case, buckle up.-remove-inlined f1,...,fnโ removes inlined functionsf1,...,fnfrom the AST. Those functions must have been given to-inline-calls. Note: this option does not check whether the given functions were fully inlined. So be careful, bestie ๐-remove-projects p1,...,pnโ removes the given projectsp1,...,pn. And@all_but_currentremoves all projects except the current one. Clean sweep ๐งน-remove-unused-specified-functionsโ keeps function prototypes that have an ACSL specification but aren't used in the code. This is the default. Functions carrying the attributeFRAMAC_BUILTINare always kept, no exceptions ๐-remove-unused-typesโ removes types andstruct/union/enumdeclarations that aren't referenced anywhere else in the code. This is the default. Use-keep-unused-typesto keep those definitions around instead.-safe-arraysโ for multidimensional arrays, or arrays that are fields inside structs, assumes all accesses must be in bound. This one's set by default. The opposite option is-unsafe-arrays.-save fileโ saves Frama-C's state intofileafter the analyses have taken place. Snapshot era ๐ธ-session sโ setssas the directory in which session files are searched.[-no]-set-project-as-defaultโ the current project becomes the default one (and so future-thensequences get applied on it). Defaults to no.[-no]-simplify-cfgโ removesbreak,continueandswitchstatements before analyses. Defaults to no.[-no]-simplify-trivial-loopsโ simplifies trivial loops, likedo ... while (0)loops. Defaults to yes. ๐-thenโ allows you to compose analyses: a first run of Frama-C happens with the options before-then, and a second run happens with the options after-then, running on the current project from the first run. Multitasking queen ๐-then-lastโ like-then, except the second group of actions is executed on the last project created by a program transformer.-then-on prjโ similar to-then, except the second run is performed in projectprj. If no such project exists, Frama-C exits with an error. No prj, no party ๐-then-replaceโ like-then-last, but it also removes the previous current project. Out with the old โจ-time fileโ appends the user time and date into the givenfilewhen Frama-C exits. โฐ-typecheckโ forces typechecking of the source files. This option is only relevant if no further analysis is requested (since typechecking will implicitly happen before any analysis is launched anyway).-ulevel nโ syntactically unrolls loopsntimes before the analysis. Ngl this can be quite costly, and some plugins (e.g. Eva) offer more efficient ways to do the same thing โ go read their respective manuals for that tea. You can also activate this on a per-loop basis via theloop pragma unrolldirective. And a negative value fornwill inhibit such pragmas. ๐[-no]-ulevel-forceโ ignoresUNROLLloop pragmas that disable unrolling.[-no]-unicodeโ outputs ACSL formulas with UTF-8 characters. This is the default โจ. When you give-no-unicode, Frama-C uses the ASCII version instead. See the ACSL manual for the correspondence between the two.-unsafe-arraysโ see-safe-arrays.[-no]-unspecified-accessโ checks that read/write accesses occurring in an unspecified order (per the C standard's notion of sequence points) are performed on separate locations. With-no-unspecified-access, it assumes that's always the case (which is the default).-versionโ outputs the version string of Frama-C. ๐ท๏ธ-warn-decimal-float freqโ warns when a floating-point constant can't be exactly represented (e.g.0.1).freqcan be one ofnone,once, orall.
Deprecated: use -kernel-warn-key parser:decimal-float=once (and variants) instead. The old way is giving retired icon, fr fr ๐ซถ
[-no]-warn-invalid-pointerโ generates alarms for invalid pointer arithmetic. Defaults to no.[-no]-warn-left-shift-negativeโ generates alarms for signed left shifts on negative values. Defaults to yes.[-no]-warn-right-shift-negativeโ generates alarms for signed right shifts on negative values. Defaults to no.[-no]-warn-pointer-downcastโ generates alarms when the downcast of a pointer may exceed the destination range. Defaults to yes.[-no]-warn-signed-downcastโ generates alarms when signed downcasts may exceed the destination range. Defaults to no.[-no]-warn-signed-overflowโ generates alarms for signed operations that overflow. Defaults to yes.[-no]-warn-unsigned-downcastโ generates alarms when unsigned downcasts may exceed the destination range. Defaults to no.[-no]-warn-unsigned-overflowโ generates alarms for unsigned operations that overflow. Defaults to no.[-no]-warn-invalid-boolโ generates alarms for reads of trap representations of_Boollvalues. Defaults to yes. ๐
๐ธ Plugin-specific options ๐ธ
For each plugin, this command
frama-c -plugin-help
will give you the list of options that are specific to that plugin. Every plugin has its own lil personality, so go ask it directly ๐
๐ EXIT STATUS ๐
0โ Successful execution. Slay โจ1โ Invalid user input. We've all been there ๐ญ2โ User interruption (killor equivalent). Okay bye then ๐3โ Unimplemented feature. Not yet, bestie ๐ฅฒ456โ Internal error. Oh no ๐125โ Unknown error. The mystery era ๐ฎ
Exit statuses greater than2can be considered a bug (or, for the case of exit status3, a feature request) and may be reported on Frama-C's BTS โ see below ๐
๐ ENVIRONMENT VARIABLES ๐
You can control where Frama-C looks for its files through the following variables. Set the vibes, set the paths ๐ซถ
FRAMAC_LIBโ the directory where the kernel's compiled interfaces are installed.FRAMAC_PLUGINโ the directory where Frama-C can find standard plugins. If you want your plugins in several places, use-add-pathinstead.FRAMAC_SHAREโ the directory where Frama-C data (e.g. its version of the standard library) is installed.
๐ SEE ALSO ๐
- Frama-C user manual:
https://frama-c.com/download/frama-c-user-manual.pdf - Frama-C homepage:
https://frama-c.com - Frama-C BTS:
https://git.frama-c.com/pub/frama-c/issues
And that's the whole page, bestie โ this manual came from Frama-C's June 18, 2021 era, and it's filed under FRAMA-C(1) in section 1. Go forth, read your warnings, and stay iconic ๐
๐
๐ฆ where this page comes from
- debian bookworm: frama-c-base 20220511-manganese-3+b4 ยท LGPL-2.1-only
- ubuntu noble: frama-c-base 20220511-manganese-5build7 ยท LGPL-2.1-only
- Copyright (C) 2007-2021 CEA (Commissariat ร l'รฉnergie atomique et aux รฉnergies
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms