Re: [Pyobjc-dev] A better way to deal w/sig 10 & 11 exceptions
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2003-06-04 08:20:20
|
bb...@ma... wrote: > But there is now a better way to deal with sig 10/11. I added a > Signals module to PyObjCTools. When installed as follows.... > > from PyObjCTools import Signals > Signals.dumpStackOnFatalSignal() > > .... it will trap all fatal signals-- all signals that normally cause > a core dump-- and attempt to dump the python stack before reverting > the signal handler back to the default handler and resignaling. > > I.e. if you invoke the above code and then your app crashes with > SIGBUS, it will dump the Python stack trace before croaking entirely. > > It is likely an improvement, anyway... That would be extremely useful. However, I can't get it to work when there's a real crash. I don't get a Python stack trace when I patch your demo like this: Index: signal-demo.py =================================================================== RCS file: /cvsroot/pyobjc/pyobjc/Examples/signal-demo.py,v retrieving revision 1.1 diff -c -r1.1 signal-demo.py *** signal-demo.py 4 Jun 2003 02:37:21 -0000 1.1 --- signal-demo.py 4 Jun 2003 08:06:48 -0000 *************** *** 13,19 **** ## the script again. def badness(): ! os.kill(os.getpid(), signal.SIGQUIT) class Foo: def baz(self): --- 13,21 ---- ## the script again. def badness(): ! import Foundation ! o = Foundation.NSObject.alloc().init() ! o.release() class Foo: def baz(self): Could this ever work to begin with? It seems that upon such a crash the state of the program is undefined, and executing Python code may no longer work. Just |