Sun Studio 12: Debugging a Program With dbx

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. However, the process must have preloaded when it starts. If the process to which you are attaching is a 64-bit process, use the appropriate 64-bit If the product is installed in the /opt directory, is at:

/opt/SUNWspro/lib/v9/ (for 64-bit SPARC platforms)

/opt/SUNWspro/lib/amd64/ (for AMD64 platforms)

/opt/SUNWspro/lib for 32-bit platforms

To preload

% setenv LD_AUDIT path-to-rtcaudit/

Set the LD_AUDIT environment variableto preload 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 need to set LD_AUDIT for the main program (which will fork). The setting of LD_AUDIT is inherited across forks and execution.

The LC_AUDITenvironment 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 the Solaris OS you are running to determine if these variables are supported.