Debugging Dynamic Memory Usage Errors Using HP WDB

For 64-bit applications running on PA-RISC
LD_PRELOAD=/opt/langtools/lib/pa20_64/librtc.sl <executable> <arguments>
Overriding the Default Location for librtc.[sl.so]
By default WDB uses the librtc.[sl|so], available at the location /opt/langtools/lib.
If the application requires the use of librtc.[sl|so] at a different location, you must set the
environment variable, LIBRTC_SERVER, to point to the location where the library is located.
Following is the syntax for setting an alternate location for librtc.[sl|so]:
export LIBRTC_SERVER=<path>
NOTE: This environmental variable is applicable for attach and interactive mode also.
Overriding the Default Path for Searching the GDB Executable
The GDB_SERVER variable enables you to override the default path from where the gdb
executable is used to debug memory problems. The default path for the gdb executable is
/opt/langtools/bin/gdb.
Following is the syntax to override the default path for the gdb executable:
export GDB_SERVER=<path>
Configuration File for Batch Mode Debugging
You can set your preferences for batch mode memory-debugging by setting the parameters in
the configuration file. The following sections discuss the location of the configuration file and
the supported variables.
Location of the Configuration File for Batch Mode Debugging
The configuration file rtcconfig for batch mode debugging is user-defined. You must either
create the rtcconfig file in the current directory or specify the location of the configuration
file by exporting the environment variable GDBRTC_CONFIG to contain the pathname of the
configuration file (including the filename.)
The following example illustrates how to specify the path of the configuration file:
$ export GDBRTC_CONFIG=/tmp/rtcconfig
If the path to the configuration file is not specified, the debugger assumes that the rtcconfig
configuration file, by default, is located in the current working directory.
Supported Variables for Memory-Debugging in the Batch Mode Configuration File
You must specify the variables in the configuration file based on the commands that are required
to debug the application. Table 13 lists the variables that are supported in the configuration file.
Table 13 Supported Variables in the Batch Mode Configuration File
DescriptionCommand
Enables you to detect double-frees and frees with
improper arguments
set heap-check free <on/off>
Enables heap profiling
set heap-check <on/off>
Enables you to detect leaks
set heap-check leaks <on/off>
Supported Modes of Memory-debugging in WDB 57