Le 27 janv. 09 à 06:48, Bill Bumgarner a écrit :

On Jan 26, 2009, at 8:43 PM, Michael Ash wrote:
Actually it's pretty easy to avoid exiting due to EXC_BAD_ACCESS, just
install a signal handler for SIGSEGV.

Of course, doing something rational in such a signal handler is ever
so slightly non-trivial.

Hahahaha.... yeah.  That is an understatement.

Before anyone thinks that handling SIGSEGV and recovering from it is a good idea.

It isn't. Don't do it unless you are prepared to invest a TON of time into doing so.

It isn't really even a good idea to try and *emergency save* the user's data.

SIGSEGV (like other such crashes) indicates that something has gone horribly wrong. Most likely, memory corruption has occurred. Thus, if you try to save anything, you will quite likely be saving corrupted data. You better had have a 100% bulletproof means of validating the data post-crash to determine what can be salvaged!!

Of the various projects I have worked on that tried to go down the "we'll detect crashes and recover!" path, every one of them would have achieved a far higher return-on-engineering-investment by focusing on creating working software instead.

b.bum



If you want, I have a proof of concept that catch exception like EXC_BAD_ACCESS, and skip the faulting instruction (by incrementing the program counter registry) to continue programme execution. No need to say I did it only for educational purpose ;-) and I do not intend to use it in anyway.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to