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

Table Of Contents
set heap-check
null-check-size N
Force malloc to return NULL after N bytes have
been allocated by the program.
catch nomem Allows the user to get control of an out-of-memory
event. The user can step through once the nomem
event is caught to see whether the out-of-memory
event is handled correctly.
set heap-check free [on |
off]
When set to on, forces HP WDB to stop the
program when it detects a call to free() with
an improper argument, a call to realloc() that
does not point to a valid currently allocated heap
block, or a call to free a block of memory, which
has been corrupted. Refer set heap-check
bounds for details on detecting memory
corruption.
set heap-check string [on
| off]
Toggles validation of calls to strcpy, strncpy,
memcpy, memccpy, memset, memmove, bzero,
and, bcopy. HP WDB 5.6 and later versions of
the debugger also validates calls to strcat and
strncat.
NOTE: HP WDB 6.0 and later versions of the
debugger improves performance of memory
debugging when the string option is set for
32-bit applications on HP-UX 11i v2 and later on
Itanium systems. However, the performance
degrades for 64-bit applications on HP-UX 11i v2
and later on Itanium systems.
set heap-check bounds [on
| off]
Allocates extra space at the beginning and end
of a heap block during allocation and fills it with
a specific pattern. When blocks are freed, HP
WDB verifies whether these patterns are intact. If
they are corrupted, an under flow or over- flow
must have occurred and HP WDB reports the
problem. This option increases the program's
memory requirements.
set heap-check scramble [on
| off]
Scrambles a memory block and overwrites it with
a specific pattern when it is allocated or
deallocated. This change to the memory contents
increases the chance that erroneous behaviors,
such as attempting to access space that is freed
14.10 Debugging Memory Problems 155