pthread_t to gdb thread id

c, gdb, pthreads

Solution

The value of pthread_t is not the same as that thread's system dependent thread id (in Linux `gettid(2)`) which you see in GDB.

AFAIK, there isn't any function to convert between the two. You need to keep track of that yourself.

Problem

Does anyone know a way to go from a pthread_t to what GDB displays with info threads? So I have: ``` (gdb) info threads 37 Thread 22887 0xb7704422 in __kernel_vsyscall () 36 Thread 22926 0xb7704422 in __kernel_vsyscall () 35 Thread 22925 0xb7704422 in __kernel_vsyscall () 34 Thread 22924 0xb7704422 in __kernel_vsyscall () 33 Thread 22922 0xb7704422 in __kernel_vsyscall () 32 Thread 22921 0xb7704422 in __kernel_vsyscall () (gdb) p m_messageQueue->m_creationThread $3 = 2694822768 (gdb) p/x m_messageQueue->m_creationThread $4 = 0xa09fbb70 ``` Does anyone know how I figure out which thread this is? It would appear to be 22768, but none of my threads go that low.

Original source

Related problems