JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3 Code Analyzer User's Guide     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction

2.  Collecting Data And Starting the Code Analyzer

Collecting Static Error Data

Collecting Dynamic Memory Access Data

Collecting Code Coverage Data

Starting the Code Analyzer GUI

A.  Errors Analyzed by the Code Analyzer

Index

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 the Code Analyzer, you must have compiled the program with the Oracle Solaris Studio 12.3 C or C++ compiler. Compiling with the -g option generates debug information that allows the 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 Binaries That Redefine Standard Memory Allocation Functions Can Be Used in Oracle Solaris Studio 12.3: Discover and Uncover User’s Guide and Binaries That Use Preloading or Auditing Cannot Be Used in Oracle Solaris Studio 12.3: Discover and Uncover User’s Guide.


Note - You can build your program once for use with both Discover and Uncover. But you cannot instrument a binary that is already instrumented, so 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

To collect dynamic memory access data from the binary:

  1. Instrument the binary with Discover using the -a option:

    discover -a binary_name

    Note - You must use the version of Discover in Oracle Solaris Studio 12.3. The -a option is not available in earlier versions of Discover.


  2. Run the instrumented binary. The dynamic memory access data is written to the dynamic subdirectory in the binary_name.analyze directory.


Note - For additional instrumentation options you can specify when instrumenting the binary with Discover, see Instrumentation Options in Oracle Solaris Studio 12.3: Discover and Uncover User’s Guide or the discover man page. You can use the -c, -F, -N, or -T options with the -a option.


After collecting dynamic memory access data, you can start the Code Analyzer GUI to analyze and display the data, along with any static code data you might have previously collected (see Starting the Code Analyzer GUI. Or you can use an uninstrumented copy of the binary to collect code coverage data.