In this section:

Windows

You can recompile all parts or just selected parts of your program with Insure++, rather than with your normal compiler, and run the program under Insure++. Insure++ then generates a report whenever an error is detected; this report usually contains enough detail to track down and correct the problem. 

You do not need to instrument/build 100% of your project with Insure++. Insure++ performs the most thorough error detection on instrumented code. However, when you run non-instrumented code under Insure++, Insure++ is still able to perform a lighter level of error detection on that code. You may want to focus your instrumentation on certain files based on project specifications, your current phase of the development process, source code availability, and so on. Adapt your instrumentation based on what makes sense in your current context.

Unix

For the most thorough checking possible, compile and link source code with Insure++. You can then run the program as normal. For example commands, see Example Compilation and Linking Commands.

When you do not have the time to build and run an instrumented application, simply re-link your code with Insure++ and run the program as normal. This provides a basic level of checking for heap corruption, errors in calls to common C functions, and memory leaks. For example commands, see see Example Compilation and Linking Commands.

Compiling with Insure++ creates a version of your code that includes calls to the Insure++ library. The instrumented code is passed to your normal compiler. During the compilation process, Insure++ detects and reports various errors including:

  • Illegal typecasts
  • Incorrect parameters specified to library routines
  • Memory corruption errors which are "obvious" at compile time

During execution, Insure++ identifies a wide variety of programming errors. See Errors Detected for an exhaustive description of the types of errors detected. For each error reported, you will see the source line that appears to be incorrect and an explanation of what type of error occurred. Normally, Insure++ sends its output to stderr, but it can send its output to Insra, a graphical tool for viewing error messages. For more information, see Working with Results in Insra.

Example Compilation and Linking Commands

The simplest way to compile and link source code with Insure++ is to prepend your normal compile and link command lines with insure. The following table shows some examples:

Without Insure++With Insure++
gcc -c foo.cinsure gcc -c foo.c
g++ -c bar.ccinsure g++ -c bar.cc
/usr/local/gcc-3.4.0/bin/g++ -c bar.ccinsure g++ -o bar foo.o bar.o

For details about controlling the behavior of Insure++ and programs compiled with Insure++, see Configuration Options (psrc).

You can use the same options that you normally use to compile and link your program. For example, you would use the following command to to build bubble1.c:

insure cc -g -o bubble1 bubble1.c

If you have a makefile that uses the variable CC to define the compiler name, you can build your program with Insure++ by using the command make CC=’insure.cc.

  • No labels