Local build processes failing in kwinject-enabled builds

Occasionally, kwinject's process interception/monitoring mechanism can interfere with the process itself. On Windows, you can specify a list of commands which kwinject should not intercept when monitoring your build. kwinject will detach from the specified processes as soon as they are started.

To define a set of commands that kwinject should detach from, you edit the compiler mapping file, located at <klocwork_install>/config/kwfilter.conf.

When the list of commands to detach from is short, add a single detach line to kwfilter.conf.

When the list of commands becomes long, use the detach keyword to specify patterns (such as "detach from all programs within this directory" or "detach from all programs with a specific prefix"). Use the attach keyword to add exceptions to the detach rules (for example, "detach from all programs, except compiler and linker").

The attach and detach lines should be added underneath the filter binding line for the applicable compiler, and should have the following syntax:

detach <prog_name>[, <prog_name> ...]

where<prog_name> is one or more executables that you do not want kwinject to intercept

attach <prog_name>[, <prog_name> ...]

where<prog_name> is one or more exceptions to the rule specified with the detach keyword

Use one of the following formats for <prog_name>:

  • the short name of the command (for example, cl.exe)
  • the absolute path to the command
  • a partial path (for example, sdk\bin\cl.exe)

<prog_name> is a glob-like pattern, so it can contain:

  • * wildcard (any sequence of characters) - for example,sdk\bin\*.exe
  • ? wildcard (any character)

Example 1: Using the detach keyword

filter mscompile cl
detach bad1.exe, bad2.exe

Example 2: Using both the attach and detach keywords

filter mscompile cl
attach build.exe, nmake.exe
detach public\common\bin\*.exe, sdk\bin\*.exe
detach msbuild.exe