我正在尝试调试死锁情况。我在一台Linux (Debian)
机器上工作,正在使用QT Creator
。我尝试使用以下GDB
命令进行调试:
thread apply all bt
该命令的输出为:
158thread apply all bt
>&"thread apply all btn"
>~"nThread 4 (LWP 6801):n"
>~"#0 0x00007ffff6da6994 in ?? ()n"
>~"#1 0x0008800002d0da5d in ?? ()n"
>~"#2 0x0000000000000002 in ?? ()n"
>~"#3 0x00007d640002dfe3 in ?? ()n"
>~"#4 0x00007ffff3395ac0 in ?? ()n"
>~"#5 0x00007ffff6d539dd in ?? ()n"
>~"#6 0x00007d2000000400 in ?? ()n"
>~"#7 0x0000000000000078 in ?? ()n"
>~"#8 0x00007ffff6d8f9b6 in ?? ()n"
>~"#9 0x0000000000000078 in ?? ()n"
>~"#10 0x0000000000000010 in ?? ()n"
>~"#11 0x00007ffff3395ac0 in ?? ()n"
>~"#12 0x0000000000000001 in ?? ()n"
>~"#13 0x00007ffff6d539dd in ?? ()n"
>~"#14 0x00007ffff6d9028c in ?? ()n"
>~"#15 0x0000000000000004 in ?? ()n"
>~"#16 0x00007d2000000400 in ?? ()n"
>~"#17 0x00007ffff3394b10 in ?? ()n"
>~"#18 0x00007fff00000000 in ?? ()n"
>~"#19 0x00007d940000ca38 in ?? ()n"
>~"#20 0x00007ffff3395ac0 in ?? ()n"
>~"#21 0x0000000000000078 in ?? ()n"
>~"#22 0x0000000000000000 in ?? ()n"
>~"nThread 3 (LWP 6800):n"
>~"#0 0x00007ffff5c518bd in ?? ()n"
>~"#1 0x0000000000000001 in ?? ()n"
>~"#2 0x00007ffff6d6e919 in ?? ()n"
>~"#3 0x00000064f3b96040 in ?? ()n"
>~"#4 0x00007ffff3b96a01 in ?? ()n"
>~"#5 0x00007ffff3b96ac0 in ?? ()n"
>~"#6 0x000000000048e149 in pTimerThread (pData=<error reading variable: Cannot access memory at address 0xfffffffffff97328>) at /mnt/hgfs/Projects/deom/Modul/osTimer.c:267n"
>~"Backtrace stopped: Cannot access memory at address 0xfffffffffff973c8n"
>~"nThread 2 (LWP 6799):n"
>~"#0 0x00007ffff5c2a28d in ?? ()n"
>~"#1 0x0000000000000000 in ?? ()n"
>~"nThread 1 (LWP 6795):n"
>~"#0 0x00007ffff67bd556 in ?? ()n"
>~"#1 0x00007ffff3c03808 in ?? ()n"
>~"#2 0x00007ffff7f64880 in ?? ()n"
>~"#3 0x00007d140000ef80 in ?? ()n"
>~"#4 0xfffffffeffffffff in ?? ()n"
>~"#5 0x00007fffffffded0 in ?? ()n"
>~"#6 0x00007ffff67bd604 in ?? ()n"
>~"#7 0x00007ffff7f64880 in ?? ()n"
>~"#8 0x0000000000000000 in ?? ()n"
>158^done
对我来说,人类可读的唯一一行是:
>~"#6 0x000000000048e149 in pTimerThread (pData=<error reading variable: Cannot access memory at address 0xfffffffffff97328>) at /mnt/hgfs/Projects/deom/Modul/osTimer.c:267n"
这个命令不应该给出每个线程最近调用的函数列表吗?为什么它只给出地址列表,而不直接给出函数的名称?有没有办法知道这些地址中定义了哪些函数?
可执行文件没有调试符号。假设您还没有去掉符号,请使用-g
编译对象文件(假设您使用的是gcc/clang(。