我使用以下GDB功能:
define why
set pagination on
set logging file ~/why.dump
set logging overwrite
set logging on
set logging redirect off
thread apply all where
set logging off
set pagination on
end
当我运行函数为什么时,我在终端中看到正常的回溯。类似的东西:
Thread 78 (Thread 3123):
#0 0xffffe424 in blah ()
#1 0xb63330d4 in blah () at blah
#2 0xadfe74f9 in blah () from blah
#3 0xadf724d2 in blah () from blah
#4 0xadf6aadb in blah () from blah
#5 0xadf6d806 in blah () from blah
#6 0xadffa717 in blah () from blah
#7 0xae3f0f20 in blah ()
#9 0xadff83f1 in blah () from blah
#10 0xadf942af in blah () from blah
#11 0xadf946d8 in blah () from blah
#12 0xadf9afac in blah () from blah
#13 0xadfe57b1 in blah () from blah
#14 0xb632eb98 in blah (arg=0xab981b70) at blah
#15 0xb62ad70e in blah () at blah
但我的〜/ why.dump跳过每个线程下的实际回溯,看起来像:
warning: Current output protocol does not support redirection
Thread 5 (Thread 2886):
Thread 4 (Thread 2885):
Thread 2 (Thread 2884):
Thread 1 (Thread 2883):
我试图获取每个线程的输出,以便在我的日志中显示。感谢。
答案 0 :(得分:0)
输出中的警告很有意思。它来自execute_command_to_string
,它是从Python使用的,而不是gdb的主要部分。这是暗示,但我看起来并不太深。在任何情况下,我认为这只是一个错误,我建议报告它。
另外我注意到你的脚本以set pagination on
开头,这看起来与你想要的相反。