3
3
## Integration into Build Systems with goto-cc
4
4
5
5
Existing software projects usually do not come in a single source file
6
- that may simply be passed to a model checker. They rather come in a
6
+ that may simply be passed to a model checker. Rather, they come in a
7
7
multitude of source files in different directories and refer to external
8
8
libraries and system-wide options. A * build system* then collects the
9
9
configuration options from the system and compiles the software
10
10
according to build rules.
11
11
12
- The most prevalent build tool on Unix ( -based) systems surely is the
12
+ The most prevalent build tool on Unix-based systems is the
13
13
` make ` utility. This tool uses build rules given in a * Makefile* that
14
14
comes with the software sources. Running software verification tools on
15
15
projects like these is greatly simplified by a compiler that first
@@ -29,20 +29,20 @@ This example assumes a Unix-like machine.
29
29
1 . Download the sources of wu-ftpd from
30
30
[ here] ( ftp://ftp.wu-ftpd.org/pub/wu-ftpd/wu-ftpd-current.tar.gz ) .
31
31
32
- 2 . Unpack the sources by running ` tar xfz wu-ftpd-current.tar.gz `
32
+ 2 . Unpack the sources by running ` tar xfz wu-ftpd-current.tar.gz ` .
33
33
34
- 3 . Change to the source directory, by entering, e.g. ,
35
- ` cd wu-ftpd-2.6.2 `
34
+ 3 . Change to the source directory, for example by entering,
35
+ ` cd wu-ftpd-2.6.2 ` .
36
36
37
- 4 . Configure the project for verification by running
37
+ 4 . Configure the project for verification by running:
38
38
39
39
` ./configure YACC=byacc CC=goto-cc --host=none-none-none `
40
40
41
41
5 . Build the project by running ` make ` . This creates multiple model
42
42
files in the ` src ` directory. Among them is a model for the main
43
43
executable ` ftpd ` .
44
44
45
- 6 . Run a model-checker, e.g., CBMC, on the model file:
45
+ 6 . Run a model-checker, for example CBMC, on the model file:
46
46
47
47
`cbmc src/ftpd`
48
48
@@ -52,20 +52,20 @@ This example assumes a Unix-like machine.
52
52
53
53
More elaborate build or configuration scripts often make use of features
54
54
of the compiler or the system library to detect configuration options
55
- automatically, e.g. , in a ` configure ` script. Replacing ` gcc ` by goto-cc
56
- at this stage may confuse the script, or detect wrong options. For
55
+ automatically, for example , in a ` configure ` script. Replacing ` gcc ` by goto-cc
56
+ at this stage may confuse the script, or detect incorrect options. For
57
57
example, missing library functions do not cause goto-cc to throw an
58
58
error (only to issue a warning). Because of this, configuration scripts
59
59
sometimes falsely assume the availability of a system function or
60
60
library.
61
61
62
62
In the case of this or similar problems, it is more advisable to
63
63
configure the project using the normal routine, and replacing the
64
- compiler setting manually in the generated Makefiles, e.g. , by replacing
64
+ compiler setting manually in the generated Makefiles, for example , by replacing
65
65
lines like ` CC=gcc ` by ` CC=goto-cc ` .
66
66
67
67
A helpful command that accomplishes this task successfully for many
68
- projects is the following :
68
+ projects is:
69
69
70
70
``` plaintext
71
71
for i in `find . -name Makefile`; do sed -e 's/^\(\s*CC[ \t]*=\)\(.*$\)/\1goto-cc/g' -i $i done
@@ -81,7 +81,7 @@ is \ref man_instrumentation-vs "here".
81
81
82
82
### Linking Libraries
83
83
84
- Some software projects come with their own libraries; also , the goal may
84
+ Some software projects come with their own libraries. Also , the goal may
85
85
be to analyze a library by itself. For this purpose it is possible to
86
86
use goto-cc to link multiple model files into a library of model files.
87
87
An object file can then be linked against this model library. For this
@@ -103,16 +103,16 @@ The behavior of a C/C++ program depends on a number of parameters that
103
103
are specific to the architecture the program was compiled for. The three
104
104
most important architectural parameters are:
105
105
106
- - The width of the various scalar types; e.g. , compare the value of
106
+ - The width of the various scalar types; for example , compare the value of
107
107
` sizeof(long int) ` on various machines.
108
- - The width of pointers; e.g. , compare the value of ` sizeof(int *) ` on
108
+ - The width of pointers; for example , compare the value of ` sizeof(int *) ` on
109
109
various machines.
110
110
- The [ endianness] ( http://en.wikipedia.org/wiki/Endianness ) of
111
111
the architecture.
112
112
113
113
In general, the CPROVER tools attempt to adopt the settings of the
114
114
particular architecture the tool itself was compiled for. For example,
115
- when running a 64 bit binary of CBMC on Linux, the program will be
115
+ when running a 64- bit binary of CBMC on Linux, the program will be
116
116
processed assuming that ` sizeof(long int)==8 ` .
117
117
118
118
As a consequence of these architectural parameters, you may observe
@@ -126,7 +126,7 @@ following command-line arguments can be passed to the CPROVER tools:
126
126
` --big-endian ` .
127
127
128
128
When using a goto binary, CBMC and the other tools read the
129
- configuration from the binary, i.e., the setting when running goto-cc is
129
+ configuration from the binary. The setting when running goto-cc is
130
130
the one that matters; the option given to the model checker is ignored
131
131
in this case.
132
132
@@ -161,4 +161,3 @@ int main() {
161
161
assert (0);
162
162
}
163
163
```
164
-
0 commit comments