Le lundi 20 décembre 2010 à 13:09 -0500, Alexander Belopolsky a écrit : > What if the program crashes (again) in the signal handler before > having a chance to restore registers?
If the fault handler crashs, the registers are not restored. > Also, can you point to documentation that describes register restoring > behavior? I found an article telling that the kernel saves integer and float registers when calling a signal handler, but I am unable to find it again, sorry. And I cannot find an article telling the opposite. Anyway, it would just be horrible if a signal handler was responsible to save/restore integer registers. If the kernel doesn't do that for us, I suppose that the compiler or something else does it for us. Eg. signal_default_int_handler(), the Python handler of SIGINT signal, doesn't save/restore registers, even if it erases many of them. > Because I had actual experience with that using R. Your code may be > better, but R brings up a dialog on segfault asking ... You cannot compare a simple handler using simple signal-safe functions like write(), and a complex handler calling graphical functions. It is not safe to call graphical functions in a signal handler. > (I actually use RPy which loads R into Python as a shared library, > so the two handlers will conflict anyways.) It depends if R handler calls the previous handler. My fault handler is "chained" with the previous handler (it calls indirectly the previous handler). If R fault handler does the same, all handlers will be executed correctly (I don't think that the execution order matter). Victor _______________________________________________ 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