Getting started with kwcheck for C/C++
Getting started with kwcheck for C/C++kwcheck is a desktop analysis tool for C/C++ and Java developers using IDEs and text editors that aren't supported by Klocwork in the form of an IDE plug-in. You can also try the GUI tool Klocwork Desktop. Set up a local projectSet up a local project and connect it to a server project with kwcheck create. kwcheck create --url http://server2:8080/my_project Perform this step only the first time. From here on, the steps are the same for the first and subsequent analysis runs. Capture build settingsTo capture build settings, run kwshell from the directory that contains your local project directory (called .kwlp by default). kwshell When kwshell starts up, it indicates which Klocwork local project directory (.kwlp) it's using. For example: Using Klocwork project directory '/space/testing/jlee/my_project/.kwlp' Running Klocwork Shell ... A [kw] prefix is also added to the command-line prompt to indicate that kwshell is running. Now, build your component. A file must be compiled at least once under kwshell for Klocwork to "see" it. kwshell monitors compile and link commands and creates a build specification. make Note: If you need to use settings from the server project in the form of a build specification template (not recommended), do not run kwshell. In this case, you may see a message indicating that one or more variables need to be defined. To set build specification variables, use kwcheck set-var .
Run the analysis
5 (System: 22) /testing/myproj/trees.c:777 ABR Fix Buffer overflow, array index of 'bl_tree' may be out of bounds. Array 'bl_tree' of size 39 may use index value(s) 39..65535. Also there are 2 similar errors on line(s) 777. * foo.c:760: ...:=tree[0] .dl.len * foo.c:768: n<=max_code is true * foo.c:769: ...:=tree[n+1] .dl.len * foo.c:769: curlen:=nextlen * foo.c:789: nextlen==0 is false * foo.c:776: curlen!=prevlen is true * foo.c:777: The array 'bl_tree' size is 39. * deflate.h:194: The array 'bl_foo' size is 39. * foo.c:777: Array 'bl_foo' may use the 39..65535 index. Current status 'Analyze' See C and C++ checker reference for documentation on detected issues. Fix defects and ignore the rest
|