Partial Instrumentation on File Level
With the three configuration parameters EXCLUDE, NO_EXCLUDE and NO_INCLUDE it is defined which source code files are instrumented by ctc.
A standard setting of these parameters is
EXCLUDE = %INCLUDES% NO_EXCLUDE = NO_INCLUDE =where %INCLUDES% means: "code coming from a file #included outside of functions" - header files, typically.
These three parameters are always evaluated in that order.
Exclude some files
To exclude a specific list of files from being instrumented (not from being compiled!), the
EXCLUDE parameter is used, either in the configuration file or via command line. If
the build is done with ctcwrap for example, with
ctcwrap –i m –C EXCLUDE+file2.cpp ...
the file file2.cpp is additionally excluded from the
instrumentation. The corresponding setting in ctc.ini is:
EXCLUDE = %INCLUDES%, file2.c NO_EXCLUDE = NO_INCLUDE =
Instrument only some files
To instrument a specific list of files only, a combination of EXCLUDE and NO_EXCLUDE
is used. For example, with
ctcwrap –i m –C EXCLUDE=* -C NO_EXCLUDE=file2.cpp ...
only the file file2.cpp is instrumented. Header files/ Included files
Header files are generally treated the same way by these parameters. Usually system
headers shall not be instrumented, hence the setting
EXCLUDE =
%INCLUDES%
is delivered in ctc.ini. With this
command for example
ctcwrap -C "NO_EXCLUDE=*\afile.h" ...
the header file afile.h is also instrumented if included in one
of the source files. With the wildcard * used, it does not matter were
afile.h is located. If the #include clause is inside a function body, the EXCLUDE, NO_EXCLUDE, NO_INCLUDE parameters are not consulted. Instead the rule is: If the function itself is instrumented, the code snippet that the function-internal #include brings is also instrumented.
Full Example
With the setting
EXCLUDE=* NO_EXCLUDE=*\dir5\*,*\dir7\* NO_INCLUDE=%INCLUDES%,*\dir5\subdir\*all files from dir5 and dir7 are instrumented except the files from dir5\subdir and except all included files.