开发者

List all Processes & Threads under processes from Linux core dump using gdb

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


This will give you back-traces of all the threads with all locals at all frames:

(gdb) thread apply all bt full

I don't think single core file covers more then one process. Take a look at GDB documentation for your scripting options.


Instead of thread apply all bt, you'll do well to use Python interpreter that is built into recent GDB versions, rather than try to parse GDB textual output.

Nikolai is correct in that a UNIX core file only covers one process (the one that crashed or was killed).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜