Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
NOTE: Linker with version number B.11.19 or higher is required for debugging
memory problems.
From HP WDB 5.7 onwards, the archive version of the run time check library,
librtc.a, is not available. You must use the shared version of the library,
librtc.[sl|so], instead.
14.10.3 Memory Debugging Methodologies
HP WDB enables you to debug memory problems in applications written for HP-UX 11.x
or later using C, aC++, FORTRAN 77, and Fortran 90.
HP WDB provides several commands that help expose memory-related problems.
HP WDB offers the following memory-debugging capabilities:
Reports memory leaks
Reports heap allocation profile
Reports open file descriptors. This is applicable only in batch mode.
Stops program execution if bad writes occur with string operations such as strcpy
and memcpy
Stops program execution when freeing unallocated or de-allocated blocks
Stops program execution when freeing a block if bad writes occur outside block
boundary
Stops program execution conditionally based on whether a specified block address
is allocated or de-allocated
Scrambles previous memory contents at malloc() and free() calls
Simulates and detects out-of-memory event errors
Detects dangling pointers and dangling blocks
Detects in-block corruption of freed blocks
Specifies the amount of guard bytes for every block of allocated memory
Displays the run time type information for C++ polymorphic objects
You can use any of the following methods to identify memory problems:
See “Debugging Memory in Interactive Mode” (page 153).
See “Debugging Memory in Batch Mode” (page 157).
See “Debugging Memory Interactively After Attaching to a Running Process
(page 165).
152 HP-UX Configuration-Specific Information