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, or Oracle Developer Studio version 12.5 or 12.6 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 Supported Binaries in Oracle Developer Studio 12.6: Discover and Uncover User’s Guide and Binaries That Use Preloading or Auditing Are Incompatible in Oracle Developer Studio 12.6: Discover and Uncover User’s Guide.
% cp a.out a.out.save
% discover -a binary_name
The dynamic memory access data is written to the dynamic subdirectory in the binary_name.analyze directory.