Debugging Dynamic Memory Usage Errors Using HP WDB (766161-001, March 2014)
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 Memory from core file
In case your application running in batch-mode dumps core before generating RTC memory reports,
you will still be able to obtain these reports from the core-file. All you need to do is start analyzing
the core in a gdb interactive session and then without setting any RTC parameters at gdb prompt,
just issue memory reporting commands like info heap, info leak etc.
NOTE: This feature is currently supported only on HP Integrity systems from WDB 6.4 and later.
To run this program follow the below steps:
1. Run the application in batch mode. (Please refer “Debugging in Batch Mode”)
2. If above application creates core, examine the core file under debugger.
The following example illustrates the usage of the memory debugging commands on core file:
Supported Modes of Memory-debugging in WDB 59