Debugging Dynamic Memory Usage Errors Using HP WDB
Debugging Multiple Applications in Batch Mode
To debug multiple applications in the batch mode, complete the following steps:
1. Compile the source files.
2. Set the following variables in the rtcconfig configuration file:
3. Set the required environment variables as follows:
export BATCH_RTC=on
4. To load the target application, set the environment variable, LD_PRELOAD as follows:
• For 32-bit applications running on Itanium
LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.sl <executable> <arguments>
• For 64-bit applications running on Itanium
LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.sl <executable> <arguments>
• For 32-bit applications running on PA-RISC
LD_PRELOAD=/opt/langtools/lib/librtc.sl <executable> <arguments>
• For 64-bit applications running on PA-RISC
LD_PRELOAD=/opt/langtools/lib/pa20_64/librtc.sl <executable> <arguments>
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 the LD_PRELOAD environment variable is
appropriately set.
The following steps illustrate the usage of this mode:
1. In order to perform memory debugging in attach mode, the target application needs to be
started by preloading (LD_PRELOAD) the appropriate librtc.[sl|so] library.
Set the environment variable LD_PRELOAD and the program as follows:
• For 32-bit applications running on Itanium
LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.sl <executable> <arguments>
• For 64-bit applications running on Itanium
LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.sl <executable> <arguments>
• For 32-bit applications running on PA-RISC
LD_PRELOAD=/opt/langtools/lib/librtc.sl <executable> <arguments>
• For 64-bit applications running on PA-RISC
Supported Modes of Memory-debugging in WDB 63