JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.3: Debugging a Program With dbx     Oracle Solaris Studio 12.3 Information Library
search filter icon
search icon

Document Information

Preface

1.  Getting Started With dbx

2.  Starting dbx

3.  Customizing dbx

4.  Viewing and Navigating To Code

5.  Controlling Program Execution

6.  Setting Breakpoints and Traces

7.  Using the Call Stack

8.  Evaluating and Displaying Data

9.  Using Runtime Checking

Capabilities of Runtime Checking

When to Use Runtime Checking

Runtime Checking Requirements

Using Runtime Checking

Turning On Memory Use and Memory Leak Checking

Turning On Memory Access Checking

Turning On All Runtime Checking

Turning Off Runtime Checking

Running Your Program

Using Access Checking

Understanding the Memory Access Error Report

Memory Access Errors

Using Memory Leak Checking

Detecting Memory Leak Errors

Possible Leaks

Checking for Leaks

Understanding the Memory Leak Report

Generating a Leak Report

Combining Leaks

Fixing Memory Leaks

Using Memory Use Checking

Suppressing Errors

Types of Suppression

Suppression by Scope and Type

Suppression of Last Error

Limiting the Number of Errors Reported

Suppressing Error Examples

Default Suppressions

Using Suppression to Manage Errors

Using Runtime Checking on a Child Process

Using Runtime Checking on an Attached Process

On a System Running Solaris

On a System Running Linux

Using Fix and Continue With Runtime Checking

Runtime Checking Application Programming Interface

Using Runtime Checking in Batch Mode

bcheck Syntax

bcheck Examples

Enabling Batch Mode Directly From dbx

Troubleshooting Tips

Runtime Checking Limitations

Works Better With More Symbols and Debug Information

SIGSEGV and SIGALTSTACK Signals Are Restricted on x86 Platforms

Works Better When Sufficient Patch Area is Available Within 8 MB of All Existing Code (SPARC platforms only).

Runtime Checking Errors

Access Errors

Bad Free (baf) Error

Duplicate Free (duf) Error

Misaligned Free (maf) Error

Misaligned Read (mar) Error

Misaligned Write (maw) Error

Out of Memory (oom) Error

Read From Array Out-of-Bounds (rob) Error

Read From Unallocated Memory (rua) Error

Read From Uninitialized Memory (rui) Error

Write to Array Out-of-Bounds Memory (wob) Error

Write to Read-Only Memory (wro) Error

Write to Unallocated Memory (wua) Error

Memory Leak Errors

Address in Block (aib) Error

Address in Register (air) Error

Memory Leak (mel) Error

10.  Fixing and Continuing

11.  Debugging Multithreaded Applications

12.  Debugging Child Processes

13.  Debugging OpenMP Programs

14.  Working With Signals

15.  Debugging C++ With dbx

16.  Debugging Fortran Using dbx

17.  Debugging a Java Application With dbx

18.  Debugging at the Machine-Instruction Level

19.  Using dbx With the Korn Shell

20.  Debugging Shared Libraries

A.  Modifying a Program State

B.  Event Management

C.  Macros

D.  Command Reference

Index

Using Runtime Checking on an Attached Process

Runtime checking works on an attached process with the exception that RUI cannot be detected if the affected memory has already been allocated.

On a System Running Solaris

On a system running the Solaris operating system, the process must have rtcaudit.so preloaded when it starts. If the process to which you are attaching is a 64-bit process, use the appropriate 64-bit rtcaudit.so, which is located at:

/installation_directory/lib/dbx/sparcv9/runtime/rtcaudit.so on 64-bit SPARC platforms

/installation_directory/lib/dbx/amd64/runtime/rtcaudit.so on AMD64 platforms

/installation_directory/lib/dbx/runtime/rtcaudit.so on 32-bit platforms

To preload rtcaudit.so:

% setenv LD_AUDIT path-to-rtcaudit/rtcaudit.so

Set the LD_AUDIT environment variable to preload rtcaudit.so only when needed; do not keep it loaded all the time. For example:

% setenv LD_AUDIT...
% start-your-application
% unsetenv LD_AUDIT

Once you attach to the process, you can enable runtime checking.

If the program you want to attach to is forked or executed from some other program, you must set LD_AUDIT for the main program (which will fork). The setting of LD_AUDIT is inherited across forks and execution. This solution might not work if a 32–bit program forks or executes a 64–bit program, or a 64–bit program forks or executes a 32–bit program.

The LC_AUDIT environment variable applies to both 32-bit programs and 64-bit programs, which makes it difficult to select the correct library for a 32-bit program that runs a 64-bit program, or a 64-bit program that runs a 32-bit program. Some versions of the Solaris OS support the LD_AUDIT_32 environment variable and the LD_AUDIT_64 environment variable, which affect only 32-bit programs and 64-bit programs, respectively. See the Linker and Libraries Guide for the version of Solaris you are running to determine if these variables are supported.

On a System Running Linux

On a system running the Linux operating system, the process must have librtc.so preloaded when it starts. If the process to which you are attaching is a 64-bit process running on an AMD64 processor, use the appropriate 64-bit librtc.so, which is located at:

/installation_directory/lib/dbx/amd64/runtime/librtc.so on 64-bit AMD64 platforms

/installation_directory/lib/dbx/runtime/librtc.so on 32-bit platforms

To preload librtc.so:

% setenv LD_PRELOAD path-to-rtcaudit/librtc.so

Set the LD_PRELOAD environment variable to preload librtc.so only when needed; do not keep it loaded all the time. For example:

% setenv LD_PRELOAD...
% start-your-application
% unsetenv LD_PRELOAD

Once you attach to the process, you can enable runtime checking.

If the program you want to attach to is forked or executed from some other program, you must set LD_PRELOAD for the main program (which will fork). The setting of LD_PRELOAD is inherited across forks and execution. This solution might not work if a 32–bit program forks or executes a 64–bit program, or a 64–bit program forks or executes a 32–bit program.

The LC_PRELOAD environment variable applies to both 32-bit programs and 64-bit programs, which makes it difficult to select the correct library for a 32-bit program that runs a 64-bit program, or a 64-bit program that runs a 32-bit program. Some versions of Linux support the LD_PRELOAD_32 environment variable and the LD_PRELOAD_64 environment variable, which affect only 32-bit programs and 64-bit programs, respectively. See the Linker and Libraries Guide for the version of Linux you are running to determine if these variables are supported.