如何将gdb的完整堆栈跟踪传输到文件?

时间:2014-11-07 16:00:51

标签: c++ multithreading debugging gdb stack-trace

我正在尝试获取堆栈跟踪,因为我的服务陷入僵局。 我正在使用

gdb <binary> core.dump
gdb> set logging on
gdb> thread apply all bt full
... Here now i have to keep pressing ENTER till i get to end of all the thread trace. It takes around 5 mins for me to get all these traces? 

在单个命令中获取管道到文件的所有线程的堆栈跟踪的任何技巧?

1 个答案:

答案 0 :(得分:7)

你应该为这样的长输出关闭分页:

$ gdb <binary> core.dump
(gdb) set logging on
(gdb) set pagination off
(gdb) thread apply all bt full

请参阅gdb常见问题和文档: