Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pthread_t to gdb thread id

Tags:

People also ask

How do I get thread info in GDB?

Use the "info threads" command to see the IDs of currently known threads. The GDB thread debugging facility allows you to observe all threads while your program runs--but whenever GDB takes control, one thread in particular is always the focus of debugging. This thread is called the current thread.

How do I get my Pthread thread ID?

The pthread_self() function is used to get the ID of the current thread. This function can uniquely identify the existing threads.

What is LWP in GDB?

The operating system's lightweight process (LWP) ID value for the thread. This ID is used in part for the OS to keep track of this thread for scheduling purposes. The GDB ID for the thread. This is the ID to use when specifying a specific thread in GDB commands.

What is Pthread_t TID?

In main() we declare a variable called thread_id , which is of type pthread_t . This is basically an integer used to identify the thread in the system. After declaring thread_id , we call the pthread_create function to create a real, living thread.


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.