Options of ctc

ctc can be called with the following command-line options.

-i {f|d|m|te|ti}
Instrumentation mode:
f
function coverage
d
decision coverage (default)
m
multicondition coverage
te
timing exclusive (implies f)
ti
timing inclusive (implies f)

There can be many –i options, the latest overrides. In one –i option there can be many coverage instrumentation arguments - the highest prevails.

There can be only one timing instrumentation argument te, ti.

Different files in a program need not be instrumented in the same way.

To derive statement coverage with ctcpost when building reports, at least decision coverage mode is necessary for instrumentation.

To derive condition coverage or MC/DC coverage, multicondition coverage mode is necessary for instrumentation.

-n symbol-file

Path and name specification of the symbol file. Default: MON.sym in current directory. The extension .sym is added if missing.

Remark: If files at different directories are compiled without explicit specification of the symbol file, one MON.sym file in each of the directories is used.

@optionsfile
This option allows to read ctc options (and also the compilation/ linking command and its options) from a text file. The file can have options on many lines, line breaks in the file are taken as spaces. Double quotes can be used to preserve spaces within an option defined in the file. There can be multiple @-options as well as nested option files. A line starting with the character # can be used for comments.
-c conf-file[;conf-file …]
This option specifies configuration files (ctc.ini) to be used in addition to those ones looked up by default. There must be one space between -c and file names. Multiple file names are separated by a semicolon. Multiple -c options are concatenated and applied in the given order.
-C PARAMETER{=|+|-}value
Adaption of configuration parameters. With operator =, values are overwritten. If the configuration parameter is a list, values can be appended at the list end with the operator + and removed from the list with -.

These configuration options are considered after the configuration files are searched and read from their default places. If there are multiple -C options for the same configuration parameter, all of them are used in the given order. An operator = overwrites all settings made before.

Examples:
ctc -v -k -C TMP_DIRECTORY=. cl -c file*.c
ctc -C "EXCLUDE+*\file3.c,*\file5.c" cl -c file*.c
ctc -C OPT_ADD_COMPILE-/DCTC_HEAP_COUNTERS cl -c file*.c
To avoid any issues with blank spaces or misinterpretation of the operators, it is recommended to include the full argument in double quotes:
-C "EXCLUDE  +  e:\some dir with spaces\*"
-v
Displays to the screen (to stderr) what ctc is doing and what intermediate commands it internally invokes. Per source code file filename.c, the following messages are shown
  • Start of the processing for this file:
    ctc: processing file filename.c
  • Creation or adaption of the symbol file,
  • Error and warning messages,
  • The preprocessing command for the source file,
  • The compilation command for the instrumented temporary source file.
Over all, the linking command is shown if applicable.
-V
Displays the preprocessor header banner together with version number and additional information:
  1. The locations of configuration files searched for and possibly found.
  2. Information about the license used.
-k
(keep). By default, ctc deletes the preprocessed and instrumented intermediate source files. With this option, these files are kept, usually used to analyze any issues. The files are stored in the temporary directory configured with TMP_DIRECTORY in ctc.ini with the name pattern CTC.number.number.orig-file-name.ext . For each source code file, two temporary files are used: The preprocessed version with extension .i and the instrumented version with the original extension (e.g. .c,.cpp).
-dump-config
During instrumentation with ctc, the values of configuration parameters are set based on different configuration files (ctc.ini) and command line options. With -dump-config, all these settings are written to a log file in a temp folder:
  • Windows: %TEMP%\ctclog (using the environment variable %TEMP%)
  • Linux/ Unixes: /tmp/ctclog
The filename starts with "ctclog" and contains a date and a process ID. This dump is useful to analyze cases with unexpected behaviour.
-2comp
(double compilation). With this option ctc is advised to first to execute the original command unchanged without ctc. Normally it is a compile command (compiling one or more source files), but it may also be a linking command. This extra compilation may be needed for making the compiler to generate some dependency files correctly based on the original source file and as may be needed by the rest of the build chain. The Testwell CTC++ instrumentation and compiling happens with slightly different arrangements (the dependency file generation options are dropped off, because they would specify the temporary file name) than the original compilation.
-no-comp
("no compile"). This option advises ctc not to emit a compilation command on the source file it had just instrumented.
-no-templates
With this option ctc is advised to leave all templates uninstrumented as if they were enclosed between the pragmas CTC SKIP and CTC ENDSKIP.
-no-warnings
This option advises ctc not to give any warning messages that it would normally give. This option overrides the configuration parameter WARNING_LEVEL, as if it was set to 'none'.