Print this page
12826 update to smatch 0.6.1-rc1-il-6
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/Documentation/smatch.txt
+++ new/usr/src/tools/smatch/src/Documentation/smatch.txt
1 1 Smatch
2 2
3 +0. Introduction
3 4 1. Building Smatch
4 5 2. Using Smatch
5 6 3. Smatch vs Sparse
6 7
8 +Section 0: Introduction
7 9
10 +The Smatch mailing list is <smatch@vger.kernel.org>.
11 +
8 12 Section 1: Building Smatch
9 13 ---------------------------
10 14
11 15 Smatch requires sqlite3. It requires the binaries and the C, Perl and
12 16 Python libraries for sqlite3.
13 17
14 18 apt-get install sqlite3 libsqlite3-dev libdbd-sqlite3-perl
15 19
16 20 Smatch is easy to build. Just type `make`. There isn't an install process
17 21 right now so just run it from the build directory.
18 22
19 23
20 24 Section 2: Using Smatch
21 25 ------------------------
22 26
23 27 Smatch can be used with a cross function database. It's not mandatory to
24 28 build the database but it's a useful thing to do. Building the database
25 29 for the kernel takes 2-3 hours on my computer. For the kernel you build
26 30 the database with:
27 31
28 32 cd ~/path/to/kernel_dir
29 33 ~/path/to/smatch_dir/smatch_scripts/build_kernel_data.sh
30 34
31 35 For projects other than the kernel you run Smatch with the options
32 36 "--call-tree --info --param-mapper --spammy" and finish building the
33 37 database by running the script:
34 38
35 39 ~/progs/smatch/devel/smatch_data/db/create_db.sh
36 40
37 41 Each time you rebuild the cross function database it becomes more accurate. I
38 42 normally rebuild the database every morning.
39 43
40 44 If you are running Smatch over the whole kernel you can use the following
41 45 command:
42 46
43 47 ~/progs/smatch/devel/smatch_scripts/test_kernel.sh
44 48
45 49 The test_kernel.sh script will create a .c.smatch file for every file it tests
46 50 and a combined smatch_warns.txt file with all the warnings.
47 51
48 52 If you are running Smatch just over one kernel file:
49 53
50 54 ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/file.c
51 55
52 56 You can also build a directory like this:
53 57
54 58 ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/
55 59
56 60 The kchecker script prints its warnings to stdout.
57 61
58 62 The above scripts will ensure that any ARCH or CROSS_COMPILE environment
59 63 variables are passed to kernel build system - thus allowing for the use of
60 64 Smatch with kernels that are normally built with cross-compilers.
61 65
62 66 If you are building something else (which is not the Linux kernel) then use
63 67 something like:
64 68
65 69 make CHECK="~/progs/smatch/devel/smatch --full-path" \
66 70 CC=~/progs/smatch/devel/smatch/cgcc | tee smatch_warns.txt
67 71
68 72 The makefile has to let people set the CC with an environment variable for that
69 73 to work, of course.
70 74
71 75
72 76 Section 3: Smatch vs Sparse
73 77 ----------------------------
74 78
75 79 Smatch uses Sparse as a C parser. I have made a few hacks to Sparse so I
76 80 have to distribute the two together. Sparse is released under the MIT license
77 81 and Smatch is GPLv2+. If you make changes to Sparse please send those to the
78 82 Sparse mailing list linux-sparse@vger.kernel.org and I will pick them up from
79 83 there. Partly I do that for licensing reasons because I don't want to pull GPL
80 84 changes into the Sparse code I re-distribute.
81 85
↓ open down ↓ |
64 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX