site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Organization: Heeltoe Consulting Jonas Maebe wrote:
On 31 okt 2005, at 02:50, Brad Parker wrote:
(I also, believe it or not, want to catch EXC_ARITHMETIC, which doesn't seem to get mapped to SIGFPE)
At least on Mac OS X, the init code of libc doesn't turn on (or possibly explicitly turns off) all FPU exceptions. If you turn them on, you can catch SIGFPE's as much as you like.
[note - my comments apply only to 64 bit applications. I don't know what happens for 32 bit apps] Yes, turning on the fp exception is the easy part. And, the signal handler gets called. But two problems exist. One is that if sa_flags = SA_SIGINFO it crashes. It only seems to work if sa_flags is zero. But if you want the thread state sa_flags needs to be SA_SIGINFO. It also seems that changes to the thread state (via args passed to the signal handler) are ignored. In other 64 bit "unix-like systems" (read linux), you can change srr0 in the signal handler and return, changing the flow of the original code. This doesn't work for me in OS X. I realize it's Mach underneath, and I've since written a Mach exception handler. This is a nice facility but a little heavy weight for what I am doing (still, it seems to work). -brad _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Brad Parker