A Thread Debug Interface (TDI)

for Implementations of

the POSIX Threads (Pthreads) Standard


TDI Introduction

gdb-tdi is an enhancement of the popular gdb debugger for extensive thread debugging. It handles FSU Pthreads, MIT Threads and LinuxThreads under SunOS 4.1.x, Solaris 2.x and Linux 2.x. You can download binaries (ready to run) or sources (to compile) below.

Calling the Thread-aware Debugger

gdb-tdi <filename>

New Thread Debugging Commands of the GDB

ptattach <Thread ID> ptattach continues the application and stops as soon as the specified thread is executed. After ptattach all subsequent calls to step, next , stepi, nexti and break are implicitly bound to the control flow of the specified thread. ptattach can be used to observe a specific thread instead of thread hopping. After ptattach all breakpoint sassociated with other threads than the specified one ar disabled until detaching it.
ptdetach  ptdetach as the name says detaches the formerly attached thread. It enables the temporarily disabled breakpoint sfor the attached thread. All threadspecific breakpoints implicitly produced by applying break in attached mode will remain. ptdetach is automatically executed at program restart.
info pthreads info pthreads is the small but powerfull brother of the old UNIX ps command. All thread infos are shown by info pthreads. 
info pmutex mutex infos (type it and see)
info pcond condition variable info (type it and see)
tdi <TDI Query> tdi is the current direct user interface to the TDI. You can specify TDI queries and see the result. The input and output is a, little bit strange now, but you are welcome to improve the quality of this feature (the patch is free software). All must be given as hexadecimal or decimal. It would be very useful to input program variables instead of values.
break <Location> pthread <Thread-ID>  This breakpoint will be reached (visible to you), if the desired thread hit it.
step, stepi,next, stepi (are threadspecific after ptattach) In attached mode all these commands return in the same thread control flow as selected before executing it.
break (is threadspecific after ptattach) In attached mode all breakpoints are automatically set for the attached thread.
ptsuspend <Thread List> The desired threads will suspend their execution.
ptresume <Thread List> The desired threads will resume their execution. 
continue -cs Continues the program until the next context switch happens. The old and the new thread are displayed. All active breakpoints are temporarily disabled until context switch completed.
continue -addcs Continues the program until the next context switch happens. The old and the new thread are displayed. All active breakpoints remain active.


gdb-tdi binary release for FSU Pthreads

Operating System
Binary Release
RedHat/Suse Linux 2.x
rpm -i gdb-tdi-0.4-2.i386.rpm
Debian Linux 2.x
dpkg -i gdb-tdi_0.4-1.deb
Solaris 2.x
cd / ; tar xzf gdb-tdi_0.4-1-solaris2.tgz
SunOS 4.1.x
cd / ; tar xzf gdb-tdi_0.4-1-sunos41.tgz


TDI source release


If you want to learn more about the TDI Internals, for example in order to support another POSIX Threads implementation under TDI, check out the Developper's Pages.


You're welcome to make any suggestions and tell us your ideas. Please direct all TDI questions and bug reports to


known bugs:

Last Modified: 1999-Jul-26
Authors: Daniel Schulz, Frank Mueller