Checking the Release Version of a Visual C++ Program (Error Detection)

Related Topics

Purify can instrument your optimized release version and find run-time errors, with or without debug line data. However, without debug data Purify's call stacks and error locations are not as precise.

If you are using Visual Studio, you can create an optimized release version that contains debug data. For example, specifying the following options compiles Stock.cpp for maximum speed and with debug data:

cl /O2 /Zi stock.cpp

Visual Studio generates a .pdb file that Purify can use to display more precise call stacks. By default, however, the compiler does not create a section with relocation data when you compile your executable. To use precise instrumentation for error checking, Purify needs relocation data. To add relocation data, use the /fixed:no and /incremental:no linker options. For example:

cl /O2 /Zi stock.cpp /link /fixed:no /incremental:no

If relocation data isn't available, Purify uses minimal instrumentation for error checking.

If you do not want to build a .pdb file, you can compile optimized and build a .map file. For example:

cl /O2 stock.cpp /link /map

Purify uses the .map file to display location descriptions, but without source file information.

If you are collecting coverage data, Purify needs debug line data and relocation data to instrument a module either at line level or at function level; if debug line data and relocation data is not available, Purify excludes the module from coverage monitoring.

(C) Copyright IBM Corporation 1992, 2010.