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

Document Information

Preface

1.  Introduction

2.  Memory Error Discovery Tool (Discover)

Requirements for Using Discover

Binaries Must Be Prepared Correctly

Binaries That Use Preloading or Auditing Cannot Be Used

Binaries That Redefine Standard Memory Allocation Functions Can Be Used

Quick Start

Instrumenting a Prepared Binary

Caching Shared Libraries

Instrumenting Shared Libraries

Ignoring Libraries

Command Line Options

Output Options

Instrumentation Options

Caching Options

Other Options

bit.rc Initialization Files

SUNW_DISCOVER_OPTIONS Environment Variable

SUNW_DISCOVER_FOLLOW_FORK_MODE Environment Variable

Running an Instrumented Binary

Analyzing Discover Reports

Analyzing the HTML Report

Using the Errors Tab

Using the Warnings Tab

Using the Memory Leaks Tab

Using the Control Panel

Analyzing the ASCII Report

Memory Access Errors and Warnings

Memory Access Errors

ABR

ABW

BFM

BRP

DFM

FMR

FMW

FRP

IMR

IMW

OLP

PIR

SBR

SBW

UAR

UAW

UMR

Memory Access Warnings

AZS

Interpreting Discover Error Messages

Partially Initialized Memory

Speculative Loads

Uninstrumented Code

Limitations When Using Discover

Only Annotated Code is Instrumented

Machine Instruction Might Differ From Source Code

Compiler Options Affect the Generated Code

System Libraries Can Affect the Errors Reported

Custom Memory Management Can Affect the Accuracy of the Data

Out of Bounds Errors for Static and Automatic Arrays Cannot Be Detected

3.  Code Coverage Tool (Uncover)

Index

Limitations When Using Discover

Only Annotated Code is Instrumented

Discover can instrument only code that has been prepared as described in Binaries Must Be Prepared Correctly. Non-annotated code might come from assembly language code linked into the binary, or from modules compiled with older compilers or operating systems than those listed in that section.

Specifically excluded from preparation are assembly language modules and functions that contain asm statements or .il templates.

Machine Instruction Might Differ From Source Code

Discover operates on machine code. The tool detects errors on machine instructions such as loads and stores, and correlates the errors with the source code. Some source code statements do not have associated machine instructions, so it may appear that Discover did not detect an obvious user error. For example, consider the following C code fragment:

  int *p = (int *)malloc(sizeof(int));
  int i;

  i = *p;  /* compiler may not generate code for this statement */
  printf("Hello World!\n");

  return;

Reading a value stored at the address pointed to by p is a potential user error since the memory was not initialized. However, an optimizing compiler will detect that the variable i is not used, so the code for the statement reading from memory and assigning to i will not be generated. In this case, Discover will not report uninitialized memory usage (UMR).

Compiler Options Affect the Generated Code

Compiler-generated code is not always as you expect it to be. Because the code the compiler generates varies depending on the compiler options you use, including the -On optimization options, the errors reported by Discover might also vary. For example, errors reported in code generated at the -O1 optimization level could disappear for code generated at the -O4 optimization level.

System Libraries Can Affect the Errors Reported

System libraries are preinstalled with the operating system and cannot be recompiled for instrumentation. Discover provides support for the common function from the standard C library (libc.so); that is, Discover knows what memory is accessed or modified by these functions. However, if your application uses other system libraries, you might see false positives in the Discover report. If false positives are reported, you can call the Discover API from your code to eliminate them.

Custom Memory Management Can Affect the Accuracy of the Data

Discover can track heap memory when it is allocated by standard programming language mechanisms like malloc(), calloc(), free(), operator new(), and operator delete().

If your application uses a custom memory management system working on top of the standard functions (for example, pool allocation management implemented with malloc()), then Discover works, but is not guaranteed to correctly report leaks or access to freed memory.

Discover does not support the following memory allocators:

The sigaltstack(2)() function is not supported.

Out of Bounds Errors for Static and Automatic Arrays Cannot Be Detected

Because of the algorithms that Discover uses to detect array bounds, it is not possible to detect out of bounds access errors for static and automatic (local) arrays. Errors can be detected only for dynamically allocated arrays.