In this section:
Introduction
When you build with Insure++, the tool performs source code Instrumentation. Insure++ rewrites, or “instruments,” the code in a process that also performs mutation testing. Insure++ then compiles and links the instrumented code with your native compiler.
Source code instrumentation has several advantages over object code instrumentation, including a deeper understanding of the code being checked. This results in more complicated and subtle bugs being detected.
In addition to uncovering such problems as memory leaks and pointer errors, Insure++ uncovers code ambiguities. As a result, many more bugs are found, including language–specific and algorithmic errors. Insure++ is also able to report code coverage data with TCA. For more information on TCA, refer to the section Analyzing Coverage with TCA.
Basic Process
The basic procedure for building code with Insure++ is detailed in the following steps.
- Open the file or workspace in Visual Studio.
- Instrument and link source files, based on what makes sense in your current context:
- To instrument selected source files in the project, instrument each source file by clicking the Instrument File button. After the instrumentation is completed, click the Insure++ Build button to instrument and link any out-of-date objects in your project.
- To instrument all files in a project, click the Insure++ Rebuild All button.
You can build a solution from all current projects in Visual Studio 2003 and higher.
Click the Insure++ Build Solution icon on the toolbar to instrument and compile all projects in the current solution. To clean and rebuild the current solution in the IDE, click the Insure++ Rebuild Solution icon.
To stop Insure++ while in progress, click the Insure++ Stop Build icon. To view and/or change Insure++ options, click the Insure++ Control Panel icon.
By default, error messages are sent to Insra. Errors may be reported at both compile-time and runtime. For more information on using Insra, see Working with Results in Insra. For details on reported problems, see Error Codes.
Insure++ generally hides standard compiler warnings to prevent confusion.
Using Makefiles
Set the build macro to insure
(instead of cl
) and set the link macro to inslink
.
Using insdevenv
If you use devenv
to build a project from the command line, you can also use the insdevenv
option to build source code with Insure++. The syntax for both options is the same.
The devenv directory must be specified in the PATH environment variable
In order for insdevenv to work properly, the directory in which devenv resides must be specified in the PATH environment variable.
Example
devenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [ /projectconfig name ] ]
insdevenv solutionfile.sln /build solutionconfig [ /project projectnameorfile [/projectconfig name ] ]