Instrumenting a C application with TrueCoverage 6.X from the Command Line

0 Likes

Problem:

How to instrument from the command line with Devpartner version 6.X?

Resolution:

You can instrument your application from the command line using NMAKE and the following TrueCoverage components. The instrumentation process uses the TrueCoverage NMCL compiler driver instead of the standard Visual C compiler driver.

NMCL.EXE

TrueCoverage compiler driver. Used in place of CL.EXE.

NMLINK.EXE

TrueCoverage linker driver

BCINTERF.LIB

TrueCoverage library file required by all instrumented programs

To instrument for TrueCoverage from the command line using a standard Microsoft makefile

Specify CPP=NMCL/NMtcOn on the NMAKE command line. For example, if your path statement includes NMCL and NMLINK, you can use the following command.

NMAKE CPP="NMCL /NMtcOn" LINK32="NMLINK /NMtcOn"

If your makefile uses a name other than MAKEFILE, use the following command syntax.

NMAKE /f filename.MAK CPP="NMCL /NMtcOn" LINK32="NMLINK /NMtcOn"

Note: If your path statement does not include NMCL and NMLINK, you must specify the full directory path to these programs (they are located in your TrueCoverage installation directory).

Add a target to the makefile that corresponds to the TrueCoverage Project Configuration you created in Developer Studio. (This step is optional, but recommended.)

To instrument for TrueCoverage using a Win32 SDK makefile

If your makefile is based on the original Win32 SDK, the substitution line is slightly different, and you must add it after the line that includes the NTWIN32.MAK file.

!include <NTWIN32.MAK>

cc=NMCL /NMtcOn

link=NMLINK /NMtcOn

To apply NMCL command-line options to a project

Specify NMCL and the appropriate option in quotes. For example:

NMAKE /f TEST.MAK CPP="NMCL /NMtcOn /NMopt:TEST.INI"

See NMCL Options for a list of available options.

To specify NMCL command-line options with an environment variable

You can also specify NMCL command-line options using the NMCL environment variable. You might want to do this for global options. For example, the following line instructs NMCL to exclude the specified source file from instrumentation.

set NMCL=/NMignore:StdAfx.cpp

See NMCL Options for a list of available options.

Notes

When you specify a combination of TrueCoverage and CL options for NMCL, you must specify all TrueCoverage options before any CL options.

TrueCoverage cannot instrument your project from the command line if it is open. Close your project in Visual C and TrueCoverage before you begin instrumentation.

You can use the NMCL command in batch files.

See NMLINK Options for a list of available NMLINK options.

Old KB# 11807
Comment List
Anonymous
Related Discussions
Recommended