kwshell monitors your C/C++ build to generate a build specification for kwcheck or for Klocwork Desktop for C/C++. kwshell is installed with the Klocwork Command Line tools.


kwshell [option...] [<command>] [arg...]

where <command> is a shell program, plus any shell options. The default value is your default shell (the value of the COMSPEC environment variable).


kwshell --project-dir /users/jlee/klocwork_projects/wincvs/.kwlp


  • Your build system (for example, make or jam) must be dynamically linked. To check that the build system is dynamically linked, use the command ldd on your build mechanism.
  • You must have created a project in Klocwork Desktop or with kwcheck create.


Start kwshell from the directory that contains your local project directory (called .kwlp by default), or specify your local project directory with the -pd option.

When kwshell is running on your local project, you see the [kw] prompt. Use the -N option to suppress the prompt. You do not see the [kw] prompt if you're using the Unix bash shell in non-interactive mode or with the --login or --rcfile options.


  • kwshell does not work in distributed build environments (for example, Klocwork's distributed analysis, IncrediBuild and Electric Cloud).
  • You can't use the --shell option with the <command> argument.


Name Short name Description
--exclude-prog <pattern> [<pattern>...]   exclude any of the programs that match one of the specified patterns.
--help -h display this help
--ignore-files <pattern> [<pattern>...] -I (UNIX only) ignore source files that match one of the specified patterns. <pattern> may contain the * and ? wildcards. For example, --ignore-files conftest.* specifies that temporary files created by the configure script will be ignored.
-N   suppress Klocwork shell prompt

do not resolve symbolic links. When --no-resolve option is specified, it does not resolve paths in compiler options.

Restriction: This command option is supported on Unix only.

--project-dir <dir> -pd specify the local project directory if different from the default directory (.kwlp), and/or location if it's outside the source tree
--restrict-dir <dir> -r ignore source files outside the specified directory
--shell <environment_variable> -s specify (non-default) shell program to start (for example, Bash or Korn (ksh) on Unix, or cmd.exe or the Visual Studio Command Prompt on Windows)
--verbose   print verbose information about program execution, which can help to troubleshoot errors
--version -v display version

Options for handling custom compilers

Use the options below if you are using a compiler with a non-standard name. For more information, see Troubleshooting an incomplete kwinject build specification.

Name Short name Description
--config <file> -c read filter configuration from <file>. Allows you to use a "private" copy of kwfilter.conf to specify your custom compiler information.
--prog <prog>[=<filter>][,<prog>[=<filter]...] -P used to pass your non-standard compiler information "on the fly" to kwinject. Specify the comma-separated list of programs to intercept, along with the appropriate filter to use.