Parameters for Hook Scripts

With the configuration parameters RUN_BEFORE_ALL, RUN_AFTER_CPP, RUN_AFTER_INSTR and RUN_AFTER_COMP, the execution of additional programs or scripts can be triggered at certain steps during the execution of ctc. Each of these parameters may contain a list of program or script file names.

RUN_BEFORE_ALL

A specified program is called when ctc has identified the compiler or linker command and has parsed the command line, but has not yet started the actual processing. The program is invoked with these arguments:

  • A return file name, e.g. I:\temp\CTC.3088.0.ret, in ARGV[1]
  • The compiler or linker command name, e.g. cc386, in ARGV[2]. The command contains the path, if it is used.
  • The rest of the command line arguments in ARGV[3]

Additionally, the invoked program can read from the environment variable CTCOPTS, set by ctc with the ctc-options used.

The invoked program can give feedback to ctc using the return file. It is an empty text file, created by ctc. The invoked program can write new ctc-options, into that file, which supplement or overwrite the initially used options. The ctc-options can be all on one line, or they can be on multiple lines. The options -V and -c cannot be used.

RUN_AFTER_CPP

A specified program is called just after the C-preprocessing phase for each source file. The program is invoked with these arguments:

  • The compilation command, e.g.cc386, in ARGV[1].
  • The name of the original source file, e.g. myfile.c, in ARGV[2].
  • The name of the temporary file containing the C-preprocessed code, e.g. I:\temp\CTC.3048.1.myfile.i, in ARGV[3].
  • The full compilation command, e.g. cc386 -c myfile.c, in ARGV[4].

The script can read the used ctc-options from the CTCOPTS environment variable.

RUN_AFTER_INSTR

A specified program is called after the instrumentation of each C-preprocessed file. The program is invoked with these arguments:

  • The compilation command, e.g.cc386, in ARGV[1].
  • The name of the original source file, e.g. myfile.c, in ARGV[2].
  • The name of the temporary file containing the instrumented version of the code, e.g. I:\temp\CTC.3048.2.myfile.c, in ARGV[3].
  • The full compilation command, e.g. cc386 -c myfile.c, in ARGV[4].

The script can read the used ctc-options from the CTCOPTS environment variable.

RUN_AFTER_COMP

The specified program is called just after ctc has done the compilation of the instrumented file and an instrumented version of the object file has been obtained. As arguments to the program that is invoked it is given

  • The compilation command, e.g.cc386, in ARGV[1].
  • The name of the original source file, e.g. myfile.c, in ARGV[2].
  • The name of the temporary file containing the instrumented version of the code, e.g. I:\temp\CTC.3048.2.myfile.c, in ARGV[3].
  • The full compilation command, e.g. cc386 -c myfile.c, in ARGV[4].

The script can read the used ctc-options from the CTCOPTS environment variable.