pthread_t 到 gdb 线程 id [英] pthread_t to gdb thread id
本文介绍了pthread_t 到 gdb 线程 id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有谁知道从 pthread_t 到 GDB 显示的信息线程的方法吗?
Does anyone know a way to go from a pthread_t to what GDB displays with info threads?
所以我有:
(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
有谁知道我怎么知道这是哪个线程?它似乎是 22768,但我的线程都没有这么低.
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.
推荐答案
pthread_t 的值和你看到的那个线程的系统相关线程id(在Linux gettid(2)
)不同在 GDB 中.
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,没有任何函数可以在两者之间进行转换.您需要自己跟踪.
AFAIK, there isn't any function to convert between the two. You need to keep track of that yourself.
这篇关于pthread_t 到 gdb 线程 id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文