This commit fixes some typos and reformulates some parts of the documentation. It also adds some basic formatting to make the text easier to read. Signed-off-by: Silvan Jegen <s.jegen@xxxxxxxxx> --- There are still a few open issues regarding the smatch usage that are not clear to me and that could be addressed in a later version of this patch: * Will the cross function database be used automatically by smatch when available or do you have to specify the db location somewhere on the command line when invoking test_kernel.sh? * Is it possible to use the build_kernel_data.sh script to rebuild the data base incrementally or does one need a different command line invocation in order to do that (if it is indeed possible at all)? * I interpreted "Outside of the kernel" to mean "for projects other than the kernel". Is that actually what is meant here? If someone could give me some pointers on these issues I will try to expand the smatch documentation accordingly. Documentation/smatch.txt | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/Documentation/smatch.txt b/Documentation/smatch.txt index 5fb16c7..96acd56 100644 --- a/Documentation/smatch.txt +++ b/Documentation/smatch.txt @@ -1,41 +1,55 @@ Smatch 1. Building Smatch -1. Using Smatch -1. Smatch vs Sparse +2. Using Smatch +3. Smatch vs Sparse + Section 1: Building Smatch +--------------------------- -Smatch has requires sqlite3. It requires the binaries, and the C, Perl and +Smatch requires sqlite3. It requires the binaries and the C, Perl and Python libraries for sqlite3. apt-get install sqlite3 libsqlite3-dev libdbd-sqlite3-perl -Smatch is easy to build. Just type `make`. Their isn't an install process +Smatch is easy to build. Just type `make`. There isn't an install process right now so just run it from the build directory. + Section 2: Using Smatch +------------------------ + +Smatch can be used with a cross function database. It's not mandatory to +build the database but it's a useful thing to do. Building the database +for the kernel takes 2-3 hours on my computer. For the kernel you build +the database with: -It's not mandatory to build the cross function database but it's a useful thing -to do. Building the database for the kernel takes a 2-3 hours on my computer. -For the kernel you build the database with: ~/progs/smatch/devel/smatch_scripts/build_kernel_data.sh -Outside of the kernel then you run Smatch with the options "--call-tree --info ---param-mapper --spammy". Then run the script: + +For projects other than the kernel you run Smatch with the options +"--call-tree --info --param-mapper --spammy" and finish building the +database by running the script: + ~/progs/smatch/devel/smatch_data/db/create_db.sh -Each time you rebuild the cross function database it becomes more accurate. I +Each time you rebuild the cross function database it becomes more accurate. I normally rebuild the database every morning. -If you are running Smatch over the whole kernel then use the command: +If you are running Smatch over the whole kernel you can use the following +command: + ~/progs/smatch/devel/smatch_scripts/test_kernel.sh The test_kernel.sh script will create a .c.smatch file for every file it tests and a combined warns.txt file with all the warnings. If you are running Smatch just over one kernel file: + ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/file.c + You can also build a directory like this: + ~/progs/smatch/devel/smatch_scripts/kchecker drivers/whatever/ The kchecker script prints its warnings to stdout. @@ -49,9 +63,11 @@ something like: The makefile has to let people set the CC with an environment variable for that to work, of course. + Section 3: Smatch vs Sparse +---------------------------- -Smatch is uses Sparse as a C parser. I have made a few hacks to Sparse so I +Smatch uses Sparse as a C parser. I have made a few hacks to Sparse so I have to distribute the two together. Sparse is released under the MIT license and Smatch is GPLv2+. If you make changes to Sparse please send those to the Sparse mailing list linux-sparse@xxxxxxxxxxxxxxx and I will pick them up from -- 2.3.0 -- To unsubscribe from this list: send the line "unsubscribe smatch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html