[Python-Dev] Trap SIGSEGV and SIGFPE

skip at pobox.com skip at pobox.com
Thu Dec 11 15:27:27 CET 2008

    >> The Python distribution comes with a Misc/gdbinit file

    Victor> Hum, do you really run *all* programs in gdb? Most of the time,
    Victor> you don't expect a crash (because you trust your softwares). You
    Victor> will have to try to reproduce the crash, but sometimes it's very
    Victor> hard (eg. Heisenbugs!).

Please folks!  Get real.  I was trying to help out a guy who responded to
this thread saying that he gets intermittent segfaults in his PyGTK
programs.  I don't presume that he runs his app in gdb.  If he has a core
file this will work.  I apologize profusely for any implication that a set
of gdb commands is in any way superior to your patch.

OTOH, it works today if you have a core file and are running Python at least
as far back as 2.4.  It doesn't require any changes to the interpreter.  I
use it frequently at work (a couple times a month anyway).  We get
notifications of all core files dropped each day.  I make at least a cursory
check of all core files dumped by Python.  For that I use the pystack
command defined in Misc/gdbinit.

    Victor> My new proposition is to display the backtrace instead of just
    Victor> the message "segmentation fault". It's not a problem if
    Victor> displaying the backtrace produces new fault because it's already
    Victor> better than just the message "segmentation fault". Even with my
    Victor> SIGSEVG handler, you can still use gdb because gdb catchs the
    Victor> signal before the program.

Again, I meant no disrespect to your proposal.  I was *simply trying to help
the guy out*.


More information about the Python-Dev mailing list