使用gdb进行调试时,是否可以跟踪线程正在执行的函数/代码。我执行以下操作
$gdb
$gdb attach pid
$info threads
27 Thread 0x7f0d3a0fe700 (LWP 3418) "BgHangManager" 0x00007f0d4fd9b0af in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
26 Thread 0x7f0d389ff700 (LWP 3419) "gdbus" 0x00007f0d4f098b3d in poll () from /lib64/libc.so.6
25 Thread 0x7f0d381fe700 (LWP 3420) "gmain" 0x00007f0d4f098b3d in poll () from /lib64/libc.so.6
24 Thread 0x7f0d36fff700 (LWP 3422) "Timer" 0x00007f0d4fd9b458 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
23 Thread 0x7f0d3ee52700 (LWP 3423) "Cache2 I/O" 0x00007f0d4fd9b0af in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
$ bt
Only gives me the stack-trace of the currently executing code while I would like to
for know what code is exuting in another thread for instance thread 26.
答案 0 :(得分:0)
通过切换到“想要的”线程并打印堆栈跟踪
来解决它