Debugging with GDB Manual The GNU Source-Level Debugger (769148-001, March 2014)
set heap-check high-mem-count
X_number
Stops when brk() value has moved X_number of times.
Limitations:
• This feature assumes that an application has a deterministic memory allocation pattern from
one run to another.
• The high_mem feature is not supported in batch mode debugging.
Support for Memory Debugging Feature on Applications Using libmallocng Library
for Heap Allocation Management
With this feature, you can perform memory debugging while using libmallocng library instead
of libc library for heap management. This enables you to identify potential heap usage errors
which might surface only when using libmallocng library for heap management.
NOTE: Arena information cannot be obtained if the application uses libmallocng.
If you are using LD_PRELOAD to load libmallocng, then LD_PRELOAD must be modified to
load librtc library ahead of libmallocng library before memory debugging as shown below:
• For 64–bit executable
export LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.so:/usr/lib/hpux64/libmallocng.so
• For 32–bit executable
export LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.so:/usr/lib/hpux32/libmallocng.so
This feature is available only on HP Integrity systems.
Thread Debugging Support
HP WDB provides thread-debugging support for kernel, user, and MxN threads. You can exclusively
disable or enable specific thread execution. Advanced thread debugging support in HP WDB
enables you to view information on pthread primitives and detect certain thread-related conditions.
NOTE: HP WDB supports pthread parallelism, but it does not support compiler-generated
parallelism such as parallelism with directives.
Support for Enabling and Disabling Specific Threads
When you suspect that a specific thread is causing a problem while debugging a multi- threaded
application, you can suspend the execution of other threads in the application and debug the
doubtful thread exclusively. HP WDB 3.2 and later versions provide the following commands to
disable and enable specific thread execution:
thread disable This command prevents the specified threads from running until they are
enabled again using the thread enable command.
thread enable This command enables the specified thread to run when you issue the
continue or step command. By default, all threads are in the enabled
state. You can use the thread enable command to reactivate a disabled
thread.
Consider the following example:
(gdb) info threadsystem thread 4189 0x7f666da8
in __pthread_create_system+0x3d8 () from /usr/lib/libpthread.1
2 system thread 4188 worker (wptr=0x40004640 ") at quicksort.c:135
1 system thread 4184 0x7f66f728 in _lwp_create+0x10 () from /usr/lib/libpthread.1
To disable a thread, execute the following command:
(gdb) thread disable 1
warning: ATTENTION!! Disabling threads may result in
deadlocks in the program.Disabling thread 1
Thread Debugging Support 133