
|
Debugging applications that use POSIX threads can by a challenge. Most commercial versions of pthreads provide specially modified version of native debuggers. Even these are really not effective for concurrency problems, though, because they disrupt program execution too much. Threads on Linux are an even greater challenge. User-level pthreads implementations, like Patched MIT Pthreads can use gdb, but it is not thread-aware. The situation is much worse with LinuxThreads: gdb is of no help as it will debug only the main thread. It has no control over the other threads, because each are their own process (created with the new Linux clone() system call). Setting any breakpoints will cause a crash. Post-mortem debugging is impossible, because the core file gets corrupted as the dying threads all try to write to it simultaneously. The only hope is printf(), assert() and the DBUG package detailed below.
|