1.查看进程id
[gm@gm ~]$ ps -ef
2.启动gdb attach 进程
[gm@gm ~]$ gdb attach 199187
3.查看所有线程
(gdb) info threads
4.进入某个线程
(gdb) thread 2
5.查看线程调用栈
(gdb) bt
结果
#0 0x00007f566b49a02d in ?? () from /usr/lib64/libpthread.so.0
#1 0x00007f566b4934a1 in pthread_mutex_lock () from /usr/lib64/libpthread.so.0
#2 0x00007f565c53931c in DataOperMgr::IsSubscribeAttr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
from /home/gm/GM1000_DAP/Platform/libObjectAccess.so
或者直接用pstack 进程id