【发布时间】:2018-01-10 09:54:19
【问题描述】:
用lldb调试的时候想知道mutex的所有者,我上网查了一下gdb可以打印出https://en.wikibooks.org/wiki/Linux_Applications_Debugging_Techniques/Deadlocks这样的线程id
但是,当我在 lldb 中尝试此操作时,互斥锁内的成员变量是不透明的,例如:
Process 76057 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001000017f5 a.out`main at lol2.cc:65
62 }
63 std::cout << "main thread notify start" << std::endl;
64 std::this_thread::sleep_for(std::chrono::seconds(1));
-> 65 start = true;
66 cv.notify_all();
67 {
68 std::unique_lock<std::mutex> lk(mu1);
(lldb) p mu1
(mutex) $0 = {
__mutex_base = {
_M_mutex = (__sig = 1297437786, __opaque = char [56] @ 0x00007fc614127698)
}
}
(lldb)
有什么办法可以得到不透明部分的内容吗?谢谢。
【问题讨论】:
标签: c++ multithreading gdb mutex lldb