Ganesh
Ganesh

Reputation: 71

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

Upvotes: 3

Views: 3518

Answers (2)

Employed Russian
Employed Russian

Reputation: 213385

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).

Upvotes: 0

Nikolai Fetissov
Nikolai Fetissov

Reputation: 84151

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.

Upvotes: 3

Related Questions