Welcome to the Frama-C Wiki.

Is on-topic in this wiki anything that may be of help to others users of Frama-C and related tools: tips, changes that you have noticed, workarounds, etc. If it should have been in the manual, put it here. If it's too minute, platform-specific, or temporary to be a good fit for the manual, put it here. Your goal should be to make a wiki so clear and functional that it puts the authors of Frama-C's various manuals to shame.

Do not be afraid to reorganize the words of others if you feel that makes the wiki more useful as a whole. They agreed to let you do that when they chose to participate, and so do you.

This site contains all possible syntax you may use when editing the pages of this wiki. This wiki is moderated after-the-fact.


Using the BTS

Compilation and Installation

  • Compiling Beryllium for Mac OS X
    To compile Frama-C for Mac OS X Leopard yourself, see this message.
  • Compiling Beryllium for FreeBSD
    To compile Frama-C on FreeBSD, use env MAKE=gmake bash ./configure CFLAGS=”-I/usr/local/include” LDFLAGS=”-L/usr/local/lib” && gmake

* How can I compile the Jessie plugin coming with Why 2.22 under Windows?

  1. Install the Windows binary 20090902 Beryllium Frama-C version
  2. Set the following environment variables (using the Windows Control Panel):
    • prepend C:\Frama-C\bin to PATH
    • set OCAMLLIB to C:\Frama-C\lib
    • set CAML_LD_LIBRARY_PATH to C:\Frama-C\lib\stublibs
      Replace C:\Frama-C by your installation path if you customized it.
  3. Install a Cygwin version (1.7 beta has been verified to work) with at least the gcc-mingw and autoconf packages
  4. If C:\Cygwin\bin\gcc.exe is a symbolic link, remove it and replace it by its full expansion e.g. gcc-3.exe under Cygwin 1.7 beta.
  5. Download the source tar.gz of Why 2.22
  6. untar it in your cygwin home directory
  7. configure it with ./configure –prefix C:/Frama-C (forward slash must be used!)
  8. compile it with make
  9. install it with make FRAMAC_LIBDIR=“C:\\\Frama-C\\\lib\\\frama-c” install (triple backward slashes must be used!)
  10. then proceed to the installation of provers
  • What do I need to be able to use the Windows Frama-C package?
    You need to install a C preprocessor. Any preprocessor can be used. The best preprocessor to choose is the one that is supposed to be used to preprocess the application you want to analyze. \\If you just seek any C preprocessor for testing purpose, you may want to install Cygwin and add the gcc development package or any version you can find on the web. Page 40 of the Value analysis manual gives hints for other preprocessors (MSVC):
frama-c-gui -cpp-command ’gcc -C -E -I . -x c ’
frama-c-gui -cpp-command ’gcc -C -E -I . -o %2 %1'
frama-c-gui -cpp-command ’copy %1 %2’
frama-c-gui -cpp-command ’cat %1 > %2’
frama-c-gui -cpp-command ’CL.exe /C /E %1 > %2’
  • Installing theorem provers
    A few tips for installing provers are provided on Why's page.
    Here are detailed instructions for making use of Z3 on Ubuntu x86:
    1. download z3-1.3.6.msi Latest version:
      Z3 1.3 Safari users: use Firefox to download if it looks like the server is down (it probably isn't, just incompatible).
    2. open with wine or msiexec and install
    3. create your $HOME/bin directory
    4. in your .bashrc add:
      export PATH=$HOME/bin:$PATH
    5. restart session
    6. in $HOME/bin add file z3 with content
      args=`echo $* | sed -e 's|/|\\\|g'`
      exec wine $HOME/.wine/drive_c/Program_Files/Microsoft_Research/Z3-1.3.6/bin/z3.exe /s $args
    7. save and change permission:
      sudo chmod 775 z3
    8. Run why-config
starting autodetection...
Found prover Alt-Ergo version 0.8
Found prover Simplify version 1.5.4
err:winedevice:ServiceMain driver L"vstor2-ws60" failed to load
Found prover Z3 version 1.3
Found prover Yices version 1.0.21
Found prover CVC3 version devel
Found prover Coq version 8.1pl3
detection done.
writing rc file...

Types

Memory model of the Jessie Plug-in

Frama-C/Jessie uses a typed memory model. That is, each block of allocated memory is associated with a type. These can be simple types, such as char or int, as well as structs. Therefore, the following verifies with Jessie:

struct A {
    int x;
    int y;
};
struct B {
    struct A a;
    int z;
};

/*@ requires \valid(p);
 */
void foo(struct B *p) {
  p->a.x = 0;
  p->z = 0;
}

Note however that arrays are considered as chunks of data of the same type. Therefore, this example does not verify:

typedef int arr3[3];

/*@ requires \valid(a);
 */
foo(arr3 a) {
  a[2] = 0;
}

Instead, the correct annotation is

typedef int arr3[3];

/*@ requires \valid(a+ (0..2));
 */
foo(arr3 a) {
  a[2] = 0;
}

Booleans

The C99 type bool is not supported by Frama-C. To use bool in your code, add this line:

typedef enum _bool { false = 0, true = 1 } bool ;

Note that C99 uses a pre-defined type _Bool (see paragraph 6.2.5), that is supported by Frama-C. The standard library defines a macro bool (that expands to _Bool) in stdbool.h. Since Frama-C Boron, this header file can be found in ${FRAMAC_SHARE}/libc. See below to understand how such headers can be included in your code.

FAQ, Tips and Tricks

  • Pre-processing the annotations
    By default, the preprocessor does not process comments. ACSL annotations, unfortunately, look like comments to the preprocessor. If you use the GCC preprocessor (also known as GNU CPP), you can force the preprocessing of annotations with the -pp-annot option.
  • How do I customize the GUI?
    Starting with 20090901 (Beryllium), you can create a file named frama-c-user.rc in $FRAMAC_SHARE. An example of the syntax to use can be found in the file $FRAMAC_SHARE/frama-c.rc.
  • Is there an Eclipse plug-in?
    An Eclipse plug-in providing equivalent functionality to gWhy (for Weakest Precondition plug-ins) is currently maintained by Nickolay V. Shmyrev and is available on GitHub. This plug-in works on Linux, but not yet on Windows.
usage: extract_obligation -f=funname -o=obligation [-s=solver] sources
Options:
  -s=<solver> or --solver=<solver>  with solver in {coq,smtlib,alt-ergo} (default is coq)
  -f=<fun>    or --function=<fun>   with fun a function in sources
  -o=<obl>    or --obligation=<obl> with obl an obligation associated to the function (the name in available in the frama-c gui with jessie plugin)\\  
  • Checking the alignment of some memory accesses with the value analysis
    It is possible to check explicitly that a few memory accesses are aligned with the value analysis. Check the Explicit alignment howto.
  • Using standard headers
    Since Frama-C Boron, a large part of the C99 standard library headers are installed with Frama-C, in the ${FRAMAC_SHARE}/libc directory. It is better to use these headers rather than the ones that might be present on your system, as they contain some specific information that will help the analyses, such as in particular ACSL specifications for some of the functions. In order to #include such an header file, you can use e.g. the following command:
frama-c -cpp-extra-args="-I`frama-c -print-path`/libc" [other options]
  • Edit next tip here
    and its description here.

Known issues

  • \sum, \prod, etc. are not supported by Jessie
    See this message from frama-c-discuss.
  • Timeout for provers not working under MS-Windows
    This is a known issue in Why 2.18 and earlier versions. See this fix.
  • Code highlighting in gWhy does not work
    This may happen when processing DOS-encoded files.
    Fix: Convert file to unix encoding (C-x RET f undecided-unix in Emacs).

Publications on Frama-C

 
Logged in as: anonymous (anonymous)
mantis/frama-c/start.txt · Last modified: 2010/07/24 11:43 by pascal
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki