STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Version 9 of my patch:
 - Create PYTHONNOHANDLER environment variable: don't install the signal 
handler if the variable is set
 - Rename "Segfault" by "FaultHandler"
 - reverse_string() does nothing if len==0, even if it cannot occur when it's 
called by dump_decimal() and dump_hexadecimal().
 - _Py_DumpBacktrace() only writes the first 100 frames (arbitrary limit) to 
avoid unlimited loops

I don't know 100 frames is a good limit or not. Is it enough?

Summary of the patch:
 - Add a fault handler for SIGSEGV, SIGFPE, SIGBUS and SIGILL signals: display 
the Python backtrace and abort the process (call the debugger on Windows)
 - Add PYTHONNOHANDLER environment variable to disable the fault handler
 - The fault handler is implemented using only very simple instructions: it 
calls only signal-safe functions and it doesn't allocate memory (on the heap, 
only some bytes on the stack)
 - The fault handler uses an alternate stack to be able to display the 
backtrace (to be able to allocate memory on the stack and call functions)

The fault handler has no more the infinite loop issue (because the backtrace is 
truncated on frame loop).

----------
Added file: http://bugs.python.org/file20102/segfault_handler-9.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8863>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to