Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)
(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
To enable a thread, execute the following command:
(gdb) thread enable 1
Enabling thread 1
You can set and view the kernel threads with the help of the following commands:
set show-all-kthreads Sets non-zero integer value so that the gdb reports all the kernel
threads. By default this is set to 0, that means gdb reports only
those kernel threads that are associated with user threads.
show show-all-kthreads Displays the status of current set show-all-kthreads
command.
14.11.2 Backtrace Support for Thread Debugging
The following commands are available as backtrace support for thread debugging:
bt The bt command provides the stack trace of the current thread
that is being executed or the thread that accepts the signal in
case of a core file.
thread apply all bt You can use the thread apply all bt command to display
the backtrace of all threads. The bt command only provides
the stack trace of the current thread under execution.
backtrace_other_thread The backtrace_other_thread command prints the
backtrace of all stack frames for a thread with stack pointer
SP, program counter PC and address of gr32 in the backing
store BSP. This command enables you to view the stack trace
when the stack is corrupted. When using this command, you
must ensure that the SP, PC, and BSP values are valid.
The syntax for the backtrace_other_thread command is
as follows:
backtrace_other_thread SP PC BSP
14.11.3 Advanced Thread Debugging Support
Advanced thread debugging support is available for multi-threaded applications running on HP-UX
11iv2, or HP-UX 11iv3.
HP WDB 5.5 and later versions provide advanced thread debugging features to display extended
information on the state of pthread primitives such as mutexes, read-write locks and conditional
variables.
HP WDB 5.6 and later versions provide advanced thread-debugging options to detect the following
thread-related conditions:
• The thread attempts to acquire a non-recursive mutex that it currently holds.
• The thread attempts to unlock a mutex or a read-write lock that it has not ac- quired.
• The thread waits (blocked) on a mutex or read-write lock that is held by a thread with a different
scheduling policy.
140 HP-UX Configuration-Specific Information