3

I am developing a scripting tool for gdb/linux core dump, where if I point script to core bump , it lists all stack traces of all threads under process i.e, what I am trying to achieve is pretty much gdb equivalent of windbg's !process 0 which dumps all the processes and threads with stack from dump.

Is there gdb equivalent of !process 0 ?

if Not

Whats the gdb command to list all the processes and list all threads under processes in gdb from core dump ?

This would enable me to write a script to loop over all pid's and tid's and get an backtrace which could be logged to an file?

Also suggestions on scripting language for this such as perl/python, the better one is welcome.

Thanks Ganesh

4

2 回答 2

3

这将为您提供所有帧的所有线程的回溯:

(gdb) thread apply all bt full

我不认为单个核心文件涵盖的过程不止一个。查看GDB 文档以了解您的脚本选项。

于 2011-03-09T13:13:52.740 回答
0

代替thread apply all bt,您最好使用最新 GDB 版本中内置Python 解释器,而不是尝试解析 GDB 文本输出。

Nikolai 是正确的,因为 UNIX 核心文件只涵盖一个进程(崩溃或被杀死的进程)。

于 2011-03-10T23:17:53.113 回答