is it possible to find which process dumped core

yairchu at yairchu at
Tue Jun 6 13:25:05 CEST 2006

if your core is from a python program you can check what file/function
was running

use this gdb macro:

define pbt
 set $i = 0
 set $j = 0
 while $i < 1000
  select $i
  if $eip >= &PyEval_EvalFrame
   if $eip < &PyEval_EvalCodeEx
    echo c frame #
    p $i
    echo py frame #
    p $j
    set $j = $j+1
    x/s ((PyStringObject*)f->f_code->co_filename)->ob_sval
    x/s ((PyStringObject*)f->f_code->co_name)->ob_sval
    echo line #
    p f->f_lineno
  set $i = $i+1
document pbt
show python backtrace
macro by yairchu based on pyframe macro by jeremy hylton

works on python2.4 here but not 100% sure it will always work. it has
some nasty hack.
you can also see where each of the threads was by choosing the wanted
thread in gdb
I'll post my useful gdb macros to the web sometime soon

More information about the Python-list mailing list