Oracle® Solaris Studio 12.4: Debugging a Program With dbx

Exit Print View

Updated: January 2015
 
 

Attached Process 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:

64-bit AMD64 platforms: /install-dir/lib/dbx/amd64/runtime/librtc.so

32-bit AMD64 platforms/install-dir/lib/dbx/runtime/librtc.so

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.