gdb usage
attach process
gdb attach $pid
查看进程内的所有线程
info thread
切换跟踪线程
thread $thread_id #此thread_id为info thread结果行首的thread id
查看变量值
先bt查看backtrace,再f $n设置栈帧,再p *mutex打印变量值(这里的mutex为一个结构体指针)
(gdb) f 3 #3 __pthread_cond_wait (cond=0x10da6a0, mutex=0x10da688) at pthread_cond_wait.c:638 638 pthread_cond_wait.c: No such file or directory. (gdb) p *mutex $1 = {__data = {__lock = 0, __count = 0, __owner = 0, __kind = 2, __nusers = 1, {__spins = 0, __list = {__next = 0x0}}}, __size = '\000' <repeats 12 times>, "\002\000\000\000\001\000\000\000\000\000\000", __align = 0} (gdb)
标签:__,thread,gdb,000,cond,usage,mutex From: https://www.cnblogs.com/aspirs/p/16830138.html