Debugging threads with HP Wilde Beest

Table of Contents
About This Document.....................................................................................................................7
Intended Audience...............................................................................................................7
Typographic Conventions....................................................................................................7
Related Information..............................................................................................................8
End of Reading.....................................................................................................................9
What are threads?...............................................................................................................11
Understanding complexity in thread programming..........................................................11
Common conditions or events in thread programming...............................................12
Introducing the HP WDB Debugger..................................................................................12
Thread Debugging Support in HP WDB............................................................................13
Support for enabling and disabling specific threads....................................................13
Back trace support for thread debugging.....................................................................13
Debugging programs with multiple threads......................................................................14
Advanced Thread Debugging Support..............................................................................17
Enabling and Disabling Advanced Thread Debugging Features.................................17
Prerequisites for Advanced thread debugging feature in HP WDB.............................17
Modes of Thread debugging in HP WDB..........................................................................18
Thread-debugging in Interactive mode........................................................................18
Using thread-debugging feature in HP WDB..........................................................18
The thread-check command.....................................................................................19
Debugging common thread-programming problems.............................................19
Problem: The thread attempts to acquire a non-recursive mutex that it currently has
control..................................................................................................................19
Problem: The thread attempts to unlock a mutex or a read-write lock that it does not
control..................................................................................................................22
Problem: The Thread waits on a mutex or a read-write lock that is held by a thread
with a different scheduling policy...........................................................................24
Problem: Different threads non-concurrently wait on the same condition variable,
but with different associated mutexes......................................................................26
Problem: The thread terminates execution without unlocking the associated mutexes
or read-write locks.................................................................................................29
Problem: The thread waits on a condition variable for which the associated mutex is
not locked..............................................................................................................31
Problem: The thread terminates execution, and the resources associated with the thread
continue to exist in the application because the thread has not been joined or
detached................................................................................................................33
Problem: The thread uses more than the specified percentage of the stack allocated to
the thread..............................................................................................................35
Problem: The number of threads waiting on any pthread object exceeds the specified
threshold number...................................................................................................37
Table of Contents 3