Oracle® Solaris Studio 12.4: Code Analyzer User's Guide

Exit Print View

Updated: October 2014
 
 

Collecting Dynamic Memory Access Data

Collecting dynamic memory access data on your C or C++ program is a two-step process: instrumenting the binary with discover and then running the instrumented binary.

To instrument your program with discover to collect data for Code Analyzer, you must have compiled the program with Oracle Solaris Studio version 12.3 or 12.4 C or C++ compiler. Compiling with the –g option generates debug information that enables Code Analyzer to display source code and line number information for dynamic memory access errors and warnings.

discover provides the most complete detection of memory errors at the source code level if you compile your program without optimization. If you compile with optimization, some memory errors will not be detected.

For information about specific types of binaries that Discover can or cannot instrument, see Prepare Binaries Correctly in Oracle Solaris Studio 12.4: Discover and Uncover User’s Guide and Binaries That Use Preloading or Auditing Are Incompatible in Oracle Solaris Studio 12.4: Discover and Uncover User’s Guide .


Note -  You can build your program once for use with both discover and uncover. However, because you cannot instrument a binary that is already instrumented, if you are also planning to use uncover to collect coverage data, save a copy of the binary for this purpose before instrumenting it with discover. For example:
% cp a.out a.out.save