Debugging a Program With dbx

Using RTC on an Attached Process

RTC works with attached processes as well. However, to use RTC on an attached process, that process must be started with librtc.so preloaded. librtc.so resides in the lib directory of the product (../lib from the path of dbx; if the product is installed in /opt, it is /opt/SUNWspro/lib/librtc.so).

To preload librtc.so:


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

It is a good idea to set to preload librtc only when needed (as with attach); do not have it on all the time. For example:


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

Once you attach to the process, you can enable RTC.

In case the program you want to attach to gets forked or executed from some other program, you need to set LD_PRELOAD for the main program (which will fork). The setting of LD_PRELOAD is inherited across fork/exec.