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

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Ganesh
  • 71
  • 1
  • 3

2 Answers2

3

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.

Nikolai Fetissov
  • 82,306
  • 11
  • 110
  • 171
0

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

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • Hi , I was looking for executing gdb commands from python , like $var=`bt` will contain the output in $ var. This seems to deal with executing python script inside gdb. – Ganesh Mar 11 '11 at 04:53