Skip Navigation Links | |
Exit Print View | |
Oracle Solaris Studio 12.3: Discover and Uncover User's Guide Oracle Solaris Studio 12.3 Information Library |
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
Instrumenting a Prepared Binary
Instrumenting Shared Libraries
SUNW_DISCOVER_OPTIONS Environment Variable
SUNW_DISCOVER_FOLLOW_FORK_MODE Environment Variable
Running an Instrumented Binary
Memory Access Errors and Warnings
Interpreting Discover Error Messages
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
Discover works on binaries compiled with the Sun Studio 12 Update 1, Oracle Solaris Studio 12.2, or Oracle Solaris Studio 12.3 compilers; or the GCC for Sun Systems compilers starting with version 4.2.0. It works on a SPARC-based or x86-based system running the Solaris 10 10/08 operating system or a later Solaris 10 update, or Oracle Solaris 11.
Discover issues an error and does not instrument a binary if it does not meet these requirements. However, you can instrument a binary that does not meet these requirements and run it to detect a limited number of errors by using the -l option (see Instrumentation Options).
A binary compiled as described includes information called annotations to help Discover instrument it correctly. The addition of this small amount of information does not affect the performance of the binary or its runtime memory usage.
Using the -g option to generate debug information when compiling the binary allows Discover to display source code and line number information while reporting errors and warnings, and to produce more accurate results. If your binary is not compiled with the -g option, Discover displays only the program counters of the corresponding machine level instructions. Also, compiling with the -g option helps Discover produce more accurate reports (see Interpreting Discover Error Messages.
Because Discover uses some special features of the runtime linker, you cannot use it with binaries that use preloading or auditing.
If a program requires the setting of the LD_PRELOAD environment variable, it probably won't work correctly with Discover, because Discover needs to interpose on certain system functions, and it cannot do so if the function has been preloaded.
Similarly, if a program uses runtime auditing (either the binary was linked with the -p option or the -P option, or it requires the LD_AUDIT environment variable to be set), this auditing will conflict with Discover's use of auditing. If the binary was linked with auditing, Discover fails at instrumentation time. If you set the LD_AUDIT environment variable at runtime, the results are undefined.
Discover supports binaries that redefine the standard memory allocation functions: malloc(), calloc(), memalign(), valloc(), and free().