Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)

To preload the librtc runtime library from a path that is different from the default paths,
you must use the LD_PRELOAD environment variable.
Instead of automatically preloading librtc and mapping the shared libraries, you can
explicitly preload the required librtc library after mapping the shared libraries private.
In the case of HP 9000 systems, you must explicitly map the share libraries as private by
using the +dbg enable option for the chatr command, as follows:
$ chatr +dbg enable ./<executable>
(This step is not required on Integrity systems.)
To explicitly preload the librtc runtime library and start the target application, enter
one of the following commands:
For 32-bit IPF applications,
LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.so <executable>
For 64-bit IPF applications,
LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.so <executable>
For 32-bit PA applications,
LD_PRELOAD=/opt/langtools/lib/librtc.sl <executable>
For 64-bit IPF applications,
LD_PRELOAD=/opt/langtools/lib/pa20_64/librtc.sl <executable>
If LD_PRELOAD and chatr +rtc are used to preload the librtc runtime library , the
librtc runtime library is loaded from the path specified by LD_PRELOAD.
NOTE: Batch Mode RTC displays one of the following errors and causes the program
to temporarily hang if the version of HP WDB and librtc.[sl|so] do not match, or
if HP WDB is not available on the system:
"/opt/langtools/bin/gdb: unrecognized option `-brtc'
Use `/opt/langtools/bin/gdb --help' for a complete list of options."
OR
"execl failed. Cannot print RTC info: No such file or directory"
This error does not occur under normal usage where HP WDB or librtc.[sl|so] is
used from the default location at /opt/langtools/... However, this error occurs if
GDB_SERVER and/or LIBRTC_SERVER are set to a mismatched version of HP WDB or
librtc.[sl|so] respectively.
5. Run the program as follows:
./<executable name>
6. At the end of the run, output data file is created in output_data_dir, if defined in
rtcconfig, or the current directory. HP WDB creates output data file for each run. It creates
a separate file for leak detection and heap information. The naming convention for output
files is as follows:
<file_name>.<pid>.<suffix>
where, <pid> is the process id and the value for <sux> can be either leaks, heap, or mem.
Debugging Memory Problems 119