Debugging with GDB (September 2007)

Chapter 14: HP-UX Configuration-Specific Information 155
(gdb) thread enable 1
Enabling thread 1
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 com mand 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 run-
ning 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 lo ck that is held by a thread
with a different scheduling policy.
Different threads non-concurrently wait on the same condition variable, but with
different associated mutexes.
The thread terminates execution without unlocking the associated mutexes or
read-write locks.
The thread waits on a condition variable for which the associated mutex is not
locked.