cbmc-4.5/ 0000755 0001750 0001750 00000000000 12206365330 012054 5 ustar michael michael cbmc-4.5/scripts/ 0000755 0001750 0001750 00000000000 12206365330 013543 5 ustar michael michael cbmc-4.5/scripts/vcxproj.1 0000644 0001750 0001750 00000007515 12161645772 015343 0 ustar michael michael
DebugWin32ReleaseWin32{A183117E-485E-4E32-8A61-3CB7A2FC56F6}Win32ProjcproverApplicationtrueUnicodeApplicationfalsetrueUnicodetruefalseNotUsingLevel3DisabledWIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);STL_HASH_TR1;HAVE_MINISAT2$(ProjectDir);$(ProjectDir)/../minisat-2.2.0ConsoletrueLevel3NotUsingMaxSpeedtruetrueWIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);STL_HASH_TR1;HAVE_MINISAT2$(ProjectDir);$(ProjectDir)/../minisat-2.2.0Consoletruetruetrue
cbmc-4.5/scripts/generate_vcxproj 0000755 0001750 0001750 00000004461 12157414522 017046 0 ustar michael michael dest=../src
if ! [ -e $dest/Makefile ] ; then echo Makefile not found ; exit 1; fi
echo Generating Visual Studio Project files in $dest
function doit {
echo Generating $dest/$1.vcxproj
cat vcxproj.1 > $dest/$1.vcxproj
# this collects all the files needed
echo " " >> $dest/$1.vcxproj
for dir in $dirs ; do
sources="`(cd $dest/$dir; make sources)`"
for s in $sources ; do
echo " " >> $dest/$1.vcxproj
done
done
echo " " >> $dest/$1.vcxproj
echo " " >> $dest/$1.vcxproj
echo " " >> $dest/$1.vcxproj
cat vcxproj.2 >> $dest/$1.vcxproj
echo Generating $dest/$1.vcxproj.filters
# this produces nice "filters" (folders)
echo "" > $dest/$1.vcxproj.filters
echo "" >> $dest/$1.vcxproj.filters
echo " " >> $dest/$1.vcxproj.filters
for dir in $dirs ; do
sources="`(cd $dest/$dir; make sources)`"
for s in $sources ; do
echo " ${dir}" >> $dest/$1.vcxproj.filters
done
done
echo " minisat2" >> $dest/$1.vcxproj.filters
echo " minisat2" >> $dest/$1.vcxproj.filters
echo " " >> $dest/$1.vcxproj.filters
for dir in $dirs minisat2 ; do
echo " " >> $dest/$1.vcxproj.filters
done
echo "" >> $dest/$1.vcxproj.filters
}
dirs="big-int langapi util ansi-c assembler cpp java_bytecode xmllang solvers goto-symex analyses pointer-analysis goto-programs linking cbmc"
doit cbmc
dirs="big-int langapi util ansi-c assembler cpp java_bytecode xmllang solvers goto-symex analyses pointer-analysis goto-programs linking goto-cc"
doit goto-cc
dirs="big-int langapi util ansi-c assembler cpp java_bytecode xmllang solvers goto-symex analyses pointer-analysis goto-programs linking goto-instrument"
doit goto-instrument
cbmc-4.5/scripts/vcxproj.2 0000644 0001750 0001750 00000000203 12157326633 015324 0 ustar michael michael
cbmc-4.5/scripts/make-rpm 0000644 0001750 0001750 00000000427 11573425106 015206 0 ustar michael michael #!/bin/bash
svn export http://svn.cprover.org/svn/cbmc
mv cbmc cbmc-3.9
tar czf cbmc-3.9.tar.gz cbmc-3.9
wget http://www.minisat.se/downloads/minisat-2.2.0.tar.gz
mkdir $HOME/rpmbuild/SOURCES
mv cbmc-3.9.tar.gz minisat-2.2.0.tar.gz $HOME/rpmbuild/SOURCES
rpmbuild -qa cbmc.spec
cbmc-4.5/scripts/cbmc.spec 0000644 0001750 0001750 00000002246 11573425106 015333 0 ustar michael michael Name: cbmc
Version: 3.9
Release: 1%{?dist}
Summary: bounded model checker for C and C++ programs
Group: Applications
License: BSD 4-clause
URL: http://www.cprover.org
Source0: http://www.minisat.se/downloads/minisat-2.2.0.tar.gz
Source1: cbmc-3.9.tar.gz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires: gcc
%description
CBMC generates traces that demonstrate how an assertion can be violated, or
proves that the assertion cannot be violated within a given number of loop
iterations.
%prep
%setup -q -c cbmc+minisat
%setup -q -c cbmc+minisat -T -D -a 1
%build
mv minisat minisat-2.2.0
cd minisat-2.2.0
make MROOT=$PWD -C simp
cd ..
make -C cbmc-3.9/trunk/src/big-int
make -C cbmc-3.9/trunk/src/util
make -C cbmc-3.9/trunk/src %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}/%{_bindir}
for b in goto-cc goto-instrument cbmc ; do cp cbmc-3.9/trunk/src/$b/$b %{buildroot}/%{_bindir} ; done
strip %{buildroot}/%{_bindir}/*
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc
%{_bindir}/goto-cc
%{_bindir}/goto-instrument
%{_bindir}/cbmc
%changelog
cbmc-4.5/scripts/minisat-2.2.0-patch 0000644 0001750 0001750 00000003025 12155540312 016662 0 ustar michael michael diff -rupN minisat-2.2.0/mtl/IntTypes.h minisat-2.2.0.patched/mtl/IntTypes.h
--- minisat-2.2.0/mtl/IntTypes.h 2010-07-10 17:07:36.000000000 +0100
+++ minisat-2.2.0.patched/mtl/IntTypes.h 2011-07-15 12:05:38.144000000 +0100
@@ -31,7 +31,9 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR
#else
# include
+#ifndef _MSC_VER
# include
+#endif
#endif
diff -rupN minisat-2.2.0/utils/ParseUtils.h minisat-2.2.0.patched/utils/ParseUtils.h
--- minisat-2.2.0/utils/ParseUtils.h 2010-07-10 17:07:36.000000000 +0100
+++ minisat-2.2.0.patched/utils/ParseUtils.h 2011-07-15 12:06:14.362750000 +0100
@@ -24,7 +24,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR
#include
#include
-#include
+//#include
namespace Minisat {
@@ -35,7 +35,7 @@ static const int buffer_size = 1048576;
class StreamBuffer {
- gzFile in;
+ //gzFile in;
unsigned char buf[buffer_size];
int pos;
int size;
@@ -43,10 +43,10 @@ class StreamBuffer {
void assureLookahead() {
if (pos >= size) {
pos = 0;
- size = gzread(in, buf, sizeof(buf)); } }
+ /*size = gzread(in, buf, sizeof(buf));*/ } }
public:
- explicit StreamBuffer(gzFile i) : in(i), pos(0), size(0) { assureLookahead(); }
+ //explicit StreamBuffer(gzFile i) : in(i), pos(0), size(0) { assureLookahead(); }
int operator * () const { return (pos >= size) ? EOF : buf[pos]; }
void operator ++ () { pos++; assureLookahead(); }
cbmc-4.5/COMPILING 0000644 0001750 0001750 00000006422 12161645672 013336 0 ustar michael michael What architecture?
------------------
CPROVER compiles in the following environments:
- Linux
- MacOS X
- Cygwin
(We recommend g++-3. Don't use the i686-pc-mingw32-g++ cross compiler.)
- Microsoft's Visual Studio 2010 or 2012 (older versions won't work)
The rest of this document is split up into three parts: compilation on
Linux, MacOS, Windows. Please read the section appropriate for your
machine.
COMPILATION ON LINUX
--------------------
We assume that you have a Debian/Ubuntu-like distribution.
0) You need a C/C++ compiler, Flex and Bison, and GNU make.
The GNU Make needs to be version 3.81 or higher. Do
apt-get install g++ gcc flex bison make subversion libz-dev libwww-perl patch
WARNING: g++ 4.5.x has been observed to mis-optimize code in
MiniSat with -O3. Use a different version (or -O1).
1) You need a SAT solver (in source). We recommend MiniSat2. Do
cd src
make minisat2-download
2) Type cd src; make - that should do it.
COMPILATION ON MACOS X
----------------------
Follow these instructions:
0) You need a C/C++ compiler, Flex and Bison, and GNU make. To this
end, install the XCode command-line utilities (installing XCode is
not enough). These are available at
https://developer.apple.com/downloads/
1) You need a SAT solver (in source). We recommend MiniSat2. Do
cd src
make minisat2-download
2) Type cd src; make - that should do it.
COMPILATION ON WINDOWS
----------------------
There are two options: compilation using g++ from Cygwin, or using
Visual Studio's compiler. As Cygwin has significant overhead during
process creation, we advise you use Visual Studio.
Follow these instructions:
0) You need a C/C++ compiler, Flex and Bison, GNU tar, gzip2,
GNU make, and patch. The GNU Make needs to be version 3.81 or
higher. If you don't already have the above, we recommend you install
Cygwin.
WARNING: g++ 4.5.x has been observed to mis-optimize code in
MiniSat with -O3. Use a different version (or -O1).
1) You need a SAT solver (in source). We recommend MiniSat2. Using a
browser, download from
http://minisat.se/downloads/minisat-2.2.0.tar.gz
and then unpack with
tar xfz minisat-2.2.0.tar.gz
mv minisat minisat-2.2.0
cd minisat-2.2.0
patch -p1 < scripts/minisat-2.2.0-patch
The patch removes the dependency on zlib and prevents a problem
with a header file that is often unavailable on Windows.
2) Adjust src/config.inc for the paths to item 1).
3A) To compile with Cygwin, install the mingw compilers, and adjust
the second line of config.inc to say
BUILD_ENV = MinGW
3B) To compile with Visual Studio, make sure you have at least Visual
Studio 10, and adjust the second line of config.inc to say
BUILD_ENV = MSVC
Open the Visual Studio Command prompt, and then run the make.exe
from Cygwin from in there.
4) Type cd src; make - that should do it.
Note that "nmake" is not expected to work. Use "make".
(Optional) A Visual Studio project file can be generated with the script
"generate_vcxproj" that is in the subdirectory "scripts". The project file
is helpful for GUI-based tasks, e.g., the class viewer, debugging, etc., and
can be used for building with MSBuild. Note that you still need to run
flex/bison using "make generated_files" before opening the project.
cbmc-4.5/CHANGELOG 0000644 0001750 0001750 00000003504 12074524422 013272 0 ustar michael michael 4.3
===
Floating-point arithmetic now takes the rounding mode into account,
which can be changed dynamically.
goto-gcc generates hybrid executables on Linux, containing both machine
code and the CFG.
Limited support for Spec#-style quantifiers added.
Pointer-checks no longer use a heavy-weight alias analysis.
Limited support for some x86 and ARM inline assembly constructs.
4.2
===
goto-cc now passes all command line options to the gcc preprocessor.
The MacOS binaries are now signed.
The C/C++ front-end has been tested and fixed for the Visual Studio 2012
header files.
The man-page has been elaborated.
Support for the C99 complex type and gcc's vector type has been added.
Various built-ins for x86 MMX and SSE instructions have been added.
Support for various C11 features has been added.
Support for various built-in primitives has been added, in particular for
the __sync_* commands.
New feature: --all-claims now reports the status of all claims; the
verification continues even if a counterexample is found. This feature uses
incremental SAT.
The counterexample beautification (--beautify) now uses incremental SAT.
Numerous improvements to SMT1 and SMT2 interfaces.
Support for further SAT solvers (PRECOSAT, PICOSAT, LINGELING)
4.1
===
The support for low-level accesses to dynamically allocated data structures
and "integer addressed memory" (usually memory-mapped I/O) has been further
improved.
Numerous improvements to the SMT back-ends. Specifically, support through
the SMT1 path for Boolector and Z3 has been improved; support for MathSAT
has been added. In combination with the very latest version of MathSAT,
CBMC now also supports an SMT2 flow (use --mathsat --smt2 to activate this).
4.0
===
Better support for low-level accesses to dynamically allocated data
structures.
Numerous front-end improvements.
cbmc-4.5/LICENSE 0000644 0001750 0001750 00000003744 11561505745 013102 0 ustar michael michael (C) 2001-2011, Daniel Kroening, Edmund Clarke,
Computer Science Department, Oxford University
Computer Systems Institute, ETH Zurich
Computer Science Department, Carnegie Mellon University
All rights reserved. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that the following
conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Daniel Kroening,
Edmund Clarke,
Computer Science Department, Oxford University
Computer Systems Institute, ETH Zurich
Computer Science Department, Carnegie Mellon University
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS `AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cbmc-4.5/doc/ 0000755 0001750 0001750 00000000000 12206365330 012621 5 ustar michael michael cbmc-4.5/doc/man/ 0000755 0001750 0001750 00000000000 12206365330 013374 5 ustar michael michael cbmc-4.5/doc/man/cbmc.1 0000644 0001750 0001750 00000014066 12155275225 014377 0 ustar michael michael .\" Process this file with
.\" groff -man -Tascii cbmc.1
.\"
.TH CBMC 1 "MARCH 2012" "cbmc-4.1" "User Manual"
.SH NAME
cbmc \- Bounded Model Checker for C/C++ and Java programs
.SH SYNOPSIS
.B cbmc [--claim \fIclaim-nr\fB] \fIfile.c\fB ...
.B cbmc [--show-claims] \fIfile.c\fB ...
.B cbmc [--all-claims] \fIfile.c\fB ...
.B goto-cc [-I \fIinclude-path\fB] [-c] \fIfile.c\fB [-o \fIoutfile.o\fB]
.B goto-instrument \fIinfile\fB \fIoutfile\fR
.PP
Only the most useful options are listed here; see below for the remainder.
.SH DESCRIPTION
\fBcbmc\fR generates traces that demonstrate how an assertion can be
violated, or proves that the assertion cannot be violated within a given
number of loop iterations. CBMC can read source-code directly, or a
goto-binary generated by goto-cc. Java programs are given as class files.
Without any further options, cbmc checks all properties (automatically
generated or user-specificed) found in the program. If any of the
properties can be violated, a counterexample is printed and the analysis is
aborted. The analysis can be restricted to a particular claim with the
\-\-claim option. The verification result for all claims can be obtained by
means of the \-\-all-claims option.
\fBgoto-cc\fR reads source code, and generates a goto-binary. It's
command-line interface is designed to mimic that of
.BR gcc (1).
Note in particular that \fBgoto-cc\fR distinguishes between compiling
and linking phases, just as gcc does. \fBcbmc\fR expects a goto-binary
for which linking has been completed.
\fBgoto-instrument\fR reads a goto-binary, performs a given program
transformation, and then writes the resulting program as goto-binary on
disc.
The usual flow is to (1) translate source into a goto-binary using
goto-cc, then (2) perform instrumentation with goto-instrument, and
finally (3) perform the analysis with cbmc.
.SH OPTIONS
.SS "FRONTEND OPTIONS (cbmc and goto-cc)"
.IP "-I path"
Set include path (C/C++)
.IP "-D macro"
Define preprocessor macro (C/C++)
.IP --preprocess
Stop after preprocessing
.IP --show-symbol-table
Show symbol table
.IP --show-goto-functions
Show goto program
.SS "ARCHITECTURAL OPTIONS (cbmc and goto-cc)"
\fBcbmc\fR by default uses architectural settings that match those of the
machine \fBcbmc\fR is executed on, i.e., the settings below are only needed
when verifying software that is meant to run on a different architecture
or OS. \fBgoto-cc\fR generates a goto-binary for a particular architecture,
i.e., the architecture cannot be changed after the goto-binary is generated.
.IP "--16, --32, --64"
Set width of int
.IP "--LP64, --ILP64, --LLP64, --ILP32, --LP32"
Set width of int, long and pointers
.IP --little-endian
Allow little-endian word-byte conversions
.IP --big-endian
Allow big-endian word-byte conversions
.IP --unsigned-char
Make "char" unsigned by default
.IP --arch
Set target architecture
.IP --os
Set target operating system
.IP --no-arch
Don't set up an architecture
.IP --no-library
Disable built-in abstract C library
.IP "--round-to-nearest, --round-to-plus-inf, --round-to-minus-inf, --round-to-zero"
IEEE floating point rounding mode (default is round to nearest)
.SS "PROGRAM INSTRUMENTATION OPTIONS (cbmc and goto-instrument)"
Both \fBcbmc\fR and \fBgoto-instrument\fR can generate assertions that
catch specific common errors, as listed below.
.IP --bounds-check
Enable array bounds checks
.IP --div-by-zero-check
Enable division by zero checks
.IP --pointer-check
Enable pointer checks
.IP --signed-overflow-check
Enable arithmetic over- and underflow checks for signed integer arithmetic
.IP --unsigned-overflow-check
Enable arithmetic over- and underflow checks for unsigned integer arithmetic
.IP --nan-check
Check floating-point computations for NaN
.IP --no-assertions
Ignore user-provided assertions
.IP --no-assumptions
Ignore user-provided assumptions
.IP "--error-label label"
Check that the given label is unreachable
.SS "PROGRAM INSTRUMENTATION OPTIONS (goto-instrument only)"
\fBgoto-instrument\fR supports further, more complex, program
transformations.
.IP --nondet-volatile
Makes reads from volatile variables non-deterministic
.IP "--isr function"
Instruments an interrupt service routine with the given name
.IP --mmio
Instruments memory-mapped I/O
.IP --nondet-static
Variables with static lifetime are initialized non-deretministically
.IP --dump-c
Output ANSI-C source code instead of a goto binary.
.SS "BMC OPTIONS (cbmc)"
.IP --all-claims
Report status of all claims
.IP --show-claims
Only show claims
.IP --show-loops
Show the loops in the program
.IP --cover-assertions
Check which assertions are reachable
.IP "--function name"
Set main function name
.IP "--claim nr"
Only check specific claim
.IP --program-only
Only show program expression
.IP "--depth nr "
Limit search depth
.IP "--unwind nr "
Unwind loops nr times
.IP "--unwindset L:B,..."
Unwind loop L with a bound of B (use \-\-show\-loops to get the loop IDs)
.IP --show-vcc
Show the verification conditions
.IP --slice-formula
Remove assignments unrelated to property
.IP --no-unwinding-assertions
Do not generate unwinding assertions
.IP --no-pretty-names
Do not simplify identifiers
.SS "BACKEND OPTIONS (cbmc)"
.IP --dimacs
Generate CNF in DIMACS format for use by external SAT solvers
.IP --beautify-greedy
Beautify the counterexample (greedy heuristic)
.IP --smt1
Output subgoals in SMT1 syntax (experimental)
.IP --smt2
Output subgoals in SMT2 syntax (experimental)
.IP --boolector
Use Boolector (experimental)
.IP --mathsat
Use MathSAT (experimental)
.IP --cvc
Use CVC3 (experimental)
.IP --yices
Use Yices (experimental)
.IP --z3
Use Z3 (experimental)
.IP --refine
Use refinement procedure (experimental)
.IP "--outfile filename"
Output formula to given file
.IP --arrays-uf-never
Never turn arrays into uninterpreted functions
.IP --arrays-uf-always
Always turn arrays into uninterpreted functions
.SH ENVIRONMENT
CBMC does not regognize any environment variables. Note, however, that
the preprocessor used by CBMC will use environment variables to locate
header files. GOTO-CC aims to accept all environment variables that GCC
does.
.SH COPYRIGHT
2001-2012, Daniel Kroening, Edmund Clarke
cbmc-4.5/doc/slides/ 0000755 0001750 0001750 00000000000 12206365330 014104 5 ustar michael michael cbmc-4.5/doc/slides/cbmc-latex-beamer/ 0000755 0001750 0001750 00000000000 12206365330 017354 5 ustar michael michael cbmc-4.5/doc/slides/cbmc-latex-beamer/unrolling-cfg.mp 0000644 0001750 0001750 00000001507 12165264216 022470 0 ustar michael michael input boxes
vardef connect(suffix s, t)=
drawarrow s..t cutbefore fullcircle scaled 3pt shifted s cutafter fullcircle scaled 3pt shifted t;
drawdot s withpen pencircle scaled 3pt;
drawdot t withpen pencircle scaled 3pt;
enddef;
ystep = 0.9cm;
beginfig (0)
% Control flow graph
defaultscale:=9pt/fontsize defaultfont;
z[1] = (1.2cm,3*ystep);
z[2] = (0.4cm,2*ystep);
z[3] = (2.0cm,2*ystep);
z[4] = (1.2cm,1*ystep);
label.top ("L1", z[1]+(0,.1cm));
dotlabel.top ("", z[1]);
dotlabel.lft ("L2", z[2]);
dotlabel.rt ("L3", z[3]);
dotlabel.bot ("L4", z[4]);
connect(z[1], z[2]);
connect(z[1], z[3]);
connect(z[2], z[4]);
connect(z[3], z[4]);
drawarrow z[4]..(3cm,ypart 0.5[z[4],z[1]])..z[1] cutbefore fullcircle scaled 3pt shifted z[4] cutafter fullcircle scaled 3pt shifted z[1];
endfig;
end.
cbmc-4.5/doc/slides/cbmc-latex-beamer/arrow.pdf 0000644 0001750 0001750 00000006673 12165263510 021216 0 ustar michael michael %PDF-1.3
%
2 0 obj
<< /Length 4 0 R /Filter /FlateDecode >>
stream
x+TT(c}\C|@ 1
endstream
endobj
4 0 obj
23
endobj
1 0 obj
<< /Type /Page /Parent 7 0 R /Resources 3 0 R /Contents 2 0 R /MediaBox
[0 0 59 48] >>
endobj
3 0 obj
<< /ProcSet [ /PDF ] /XObject << /Fm1 5 0 R >> >>
endobj
5 0 obj
<< /Length 8 0 R /Type /XObject /Subtype /Form /FormType 1 /BBox [0 0 59 48]
/Resources 6 0 R /Filter /FlateDecode >>
stream
xڭn0Ew}ޏ9|@v[$%e+9 zkڼ<"}-a:(`~ Fə@@֢́$+I}>
ɑ``j~O.$%.KErJwWy]7]۽6Ck+lng)՚F_ʠEe*\ѵHR05,{Lk_ޡ@UXީTJ