Debugging Dynamic Memory Usage Errors Using HP WDB (5900-1474; WDB 6.2; January 2011)

Table 16 Commonly Used Commands for Memory Debugging (continued)
Batch ModeInteractive Mode/Attach ModeDescription
Not supported in Batch Modeset heap-check compiler
<on/off>
Enables you to stop whenever
compiler detects corruption in
variables allocated by compiler.
The application should be
compiled with +check=all
option.
check_openfd=[on|off]Not supported in Interactive ModeEnables you to detect open file
descriptors.
Debugging Memory Using WDB GUI
The WDB GUI is a Graphical User Interface (GUI) designed by Hewlett-Packard for WDB.
It can be used to debug native-compiled HP C, HP aC++, and Fortran programs on
Itanium-based systems running HP-UX 11i v2 or HP-UX 11i v3, and PA-RISC systems
running HP-UX 11.0, HP-UX 11i v1, HP-UX 11i v2, or HP-UX 11i v3.
The WDB GUI offers the following capabilities to debug memory–related errors in an
application
Detects corruption caused by calls to strcpy(), memset(), and memcopy()
Stops program-execution at free of an unallocated or de-allocated block address
Stops program-execution when block is freed if bad writes occur before or after
block bounds
Scrambles previous memory contents on malloc() or free() calls
Stops if the following block address is allocated or de-allocated
Stops program execution when an allocation causes heap growth exceeding <num>
bytes
Collects memory leak data (equivalent to info leak) and memory-usage (equivalent
to info heap) data
WDB GUI supports both interactive and attach mode of memory-debugging. It does not
support the batch mode debugging of applications.
The source window in the WDB GUI displays the source code. The command window
displays the output after debugging the application. It also enables you to use the
command-line interface in WDB. The command window can be used to take advantage
of memory-debugging features that are not directly supported in the GUI.
Using WDB GUI to Debug Memory-Related Problems
To debug an application for memory problems using WDB GUI, complete the following
steps:
78