JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2 Discover and Uncover User's Guide
search filter icon
search icon

Document Information


1.  Introduction

2.  Sun Memory Error Discovery Tool (Discover)

3.  Code Coverage Tool (Uncover)

Requirements for Using Uncover

Using Uncover

Instrumenting the Binary

Running the Instrumented Binary

Generating and Viewing the Coverage Report


Understanding the Coverage Report in the Performance Analyzer

The Functions Tab

The Uncoverage Counter

The Function Count Counter

The Instr Exec Counter

The Block Covered % Counter

The Instr Covered % Counter

The Source Tab

The Disassembly Tab

The Inst-Freq Tab

Understanding the ASCII Coverage Report

Understanding the HTML Coverage Report

Limitations When Using Uncover

Only Annotated Code Can Be Instrumented

Machine Instructions Might Differ From Source Code


Using Uncover

Generating coverage information using Uncover is a three-step process:

  1. Instrumenting the binary

  2. Running the instrumented binary

  3. Generating and viewing coverage reports

Instrumenting the Binary

The input binary can be an executable or a shared library. You must instrument each binary you want to analyze separately.

You instrument the binary with the uncover command. For example, the following command instruments the binary a.out and overwrites the input a.out with the instrumented a.out. It also creates a directory with the suffix .uc (a.out.uc in this case) in which the coverage data will be collected. A copy of the input binary is saved in this directory.

uncover a.out

You can use the -d directory option to tell Uncover to create the coverage data directory in directory. This option is useful when you are collecting coverage data for multiple binaries, so that all of the coverage data directories are created in the same directory. Also, if you run different instances of the same instrumented binary from different locations, using this option ensures that the coverage data from all of these runs is accumulated in the same coverage data directory.

If you do not use the -d option, the coverage data directory is created in the current run directory.

If you run the uncover command on a input binary that is already instrumented, Uncover issues an error message telling you that the binary cannot be instrumented because it is already instrumented, and that you can run it to generate coverage data.

Running the Instrumented Binary

After you have instrumented your binary, you can run it normally. Every time you run the instrumented binary, code coverage data is collected in the coverage data directory with the .uc suffix that Uncover created during the instrumentation. Since Uncover data collection is multi-thread safe and multi-process safe, there is no restriction on the number of simultaneous runs or threads in the process. The coverage data is accumulated over all of the runs and threads.

Generating and Viewing the Coverage Report

To generate a coverage report, run the uncover command on the coverage data directory. For example:

uncover a.out.uc

This command generates an Oracle Solaris Studio Performance Analyzer experiment directory called from the coverage data in the a.out.uc directory, starts the Performance Analyzer GUI, and displays the experiment. If you have an .er.rc file (see the Oracle Solaris Studio 12.2 Performance Analyzer manual) in the current directory or your home directory, it might affect the way the Analyzer displays the experiment.

You can also use uncover command options to generate the report as HTML and view it in your web browser, or as ASCII to view in a terminal window:

-e on | off

Generate experiment directory for the coverage report and display the experiment in the Performance Analyzer GUI. On by default.

-H html_directory

Save the coverage data as HTML in the specified directory and automatically display it in your web browser. Off by default.

-h or -?



Generate coverage reports but do not start viewers like the Performance Analyzer or web browser.

-t ascii_file

Generate an ASCII coverage report in the specified file. Off by default.


Print Uncover version and exit.


Verbose. Print a log of what Uncover is doing.

Only one output format is enabled, so if you specify multiple output options, Discover uses the last option in the command.


uncover a.out

This command instruments the binary a.out, overwrites the input a.out, creates an a.out.uc coverage data directory in the current directory, and saves a copy of the input a.out in the a.out.uc directory. If a.out is already instrumented, a warning message is displayed and no instrumentation is done.

uncover -d coverage a.out

This command does everything that the first example does, except it creates the a.out.uc coverage directory in the directory coverage.

uncover a.out.uc

This command uses the data in the a.out.uc coverage directory to create a code coverage experiment ( in your working directory, and starts the Performance Analyzer GUI to display the experiment.

uncover -H a.out.html a.out.uc

This command uses the data in the a.out.uc coverage directory to create an HTML code coverage report in the directory a.out.html and displays the report in your web browser.

uncover -t a.out.txt a.out.uc

This command uses the data in the a.out.uc coverage directory to create an ASCII code coverage report in the file a.out.txt.