在gdb中调试条件变量和关联的互斥锁

时间:2018-06-01 17:46:19

标签: linux gdb mutex

我的应用程序中的这个线程似乎永远在睡觉(我想是这样,至少)。条件变量数据中是否有任何东西可以告诉线程在信号或广播时有多长时间处于休眠状态?互斥体中是否还有类似的信息可以告诉相同的信息?

这是backtrace的gdb输出,以及条件变量及其相关互斥锁的内容:

(gdb) bt
#0  0x0000003dce20e334 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x0000003dce20b7a7 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#2  0x0000000000407aa0 in do_compress_thread (arg=0x0) at /home/hebbo/file_save/compress_save_file_lz4.c:447
#3  0x0000003dce207aa1 in start_thread () from /lib64/libpthread.so.0
#4  0x0000003dcdae893d in clone () from /lib64/libc.so.6
(gdb) print inBufMutex
$3 = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 24, __kind = 2, __spins = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 12 times>, "\030\000\000\000\002", '\000' <repeats 22 times>, __align = 0}
(gdb) print inBufCond
$4 = {__data = {__lock = 0, __futex = 348, __total_seq = 174, __wakeup_seq = 174, __woken_seq = 174, __mutex = 0x60e660, __nwaiters = 48, __broadcast_seq = 9},
  __size = "\000\000\000\000\\\001\000\000\256\000\000\000\000\000\000\000\256\000\000\000\000\000\000\000\256\000\000\000\000\000\000\000`\346`\000\000\000\000\000\060\000\000\000\t\000\000", __align = 1494648619008}

感谢。

0 个答案:

没有答案