On Wed, Dec 10, 2008 at 11:37 AM, Victor Stinner <[EMAIL PROTECTED]> wrote: > Oh, I forgot the issue URL: > http://bugs.python.org/issue3999 > > I also attached an example of catching segfaults. > >> > I published a new version of my fault handler: it installs an handler for >> > signals SIGFPE and SIGSEGV. Using it, it's possible to catch them and >> > continue the execution of your Python program. Example: >> >> This will of course leave the program in an undefined state. It is >> very likely to crash again, emit garbage, hang, or otherwise be >> useless. > > Recover after a segfault is dangerous, but my first goal was to get the Python > backtrace instead just one line: "Segmentation fault". It helps a lot for > debug!
It's possible to print the Python stack purely from C, without invoking any Python code. Even better, you could print the C stack while you're at it! Doing that in a signal handler, and then killing the process, could be seriously considered. Take a look at http://www.linuxjournal.com/article/6391 . You'll probably need #ifdef's to only use it on certain supported platforms, and probably disable it by default anyway (configure option? Not sure). Still, it'd be useful to have it there. -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com