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

use*_*517 3 c++ debugging multithreading 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? 
Run Code Online (Sandbox Code Playgroud)

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

ks1*_*322 7

您应该关闭长输出的分页,如下所示:

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

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