Debugging Dynamic Memory Usage Errors Using HP WDB v6.3 (5900-2181, August 2012)

4. Complete one of the following steps to preload librtc.[sl|so]:
Use the +rtc option for the chatr command on each of the required executable files
that must be instrumented, as follows:
$ chatr +rtc enable exec1 exec2 exec3
The +rtc <enable> option for the chatr command is available for dynamic linker
versions B.11.66 and later on HP 9000 systems, and dynamic linker versions B.12.51
and later on Integrity systems.
(Or)
Preload librtc.[sl|so] for all the executables, as follows:
For 32-bit applications running on Itanium,
LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.so exec1 exec2 exec3
For 64-bit applications running on Itanium,
LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.so exec1 exec2 exec3
For 32-bit applications running on PA-RISC,
LD_PRELOAD=/opt/langtools/lib/librtc.sl exec1 exec2 exec3
For 64-bit applications running on PA-RISC,
LD_PRELOAD=/opt/langtools/lib/pa20_64/librtc.sl exec1 exec2 exec3
NOTE: If exec1 eventually spawns exec2, exec3, exec4, and exec5, only exec1,
exec2 and exec3 are debugged based on the settings in the rtcconfig file.
Debugging in Attach Mode
WDB can attach to a running process and debug memory problems. However to use the debugger
in this mode, the application must be launched after preloading the librtc.[sl|so] runtime
library.
To debug memory on attaching GDB to a running process, complete the following steps:
1. You can setup the configuration file, rtcconfig for attach mode in the same way as batch
mode, although there is one difference. In attach mode, for configuration file to get processed,
the GDBRTC_CONFIG environment variable must be set to a non-NULL value. If the value is a
valid pathname of the configuration file (including the filename), that same configuration file
can be processed. However, if the value is an invalid path and is not NULL, the librtc
library searches for the rtcconfig configuration file at the following locations in the following
order:
1. Current working directory.
2. Home directory of the user if the environment variable $HOME is set.
3. Default rtcconfig configuration file provided under /opt/langtools/wdb/ (Installed
along with HP WDB Version 6.3 and later.)
Configuring rtcconfig file in attach mode enables the librtc library to collect data from
the start of application. In HP WDB Version 6.3 and later, you can configure rtcconfig
file in attach mode along with batch mode.
2. You can use the +rtc <enable|disable> option for the chatr command to automatically
preload librtc.[sl|so] or you can explicitly preload librtc.[sl|so] from the
appropriate path by using the LD_PRELOAD environment variable.
To preload the librtc.[sl|so] runtime library, complete one of the following steps:
To automatically preload librtc.[sl|so] by using the +rtc <enable|disable>
for the chatr command, enter the following command at the HP-UX prompt:
58