This is a discussion on Re: [9fans] 9vx native OS X gui - Plan9 ; > I assume the fix would be to install an EXC_BAD_ACCESS > handler after kicking off the app event loop. That would > make sure that Carbon never saw it. > But I don't know how to do that. I ...
> I assume the fix would be to install an EXC_BAD_ACCESS
> handler after kicking off the app event loop. That would
> make sure that Carbon never saw it.
> But I don't know how to do that.
I don't have a 10.5 mac to see if this is moot with the changes to
mach/mach.h has thread_set_exception_ports() to install handlers for
mach exceptions. There is also a task_ version for all the threads in
The basics are like:
/* recieve right */
kret = mach_port_allocate(mach_task_self(),
/* send right */
kret = mach_port_insert_right(mach_task_self(),
/* select exc type */
kret = thread_set_exception_ports(mach_thread_self(),
Then you do what you want with the exception; in the common case that
means set up fake sigcontext and deliver to signal handler code.
Amit Singh's osx kernel book has example code (http://macosxbook.com/
book/src/ in fig. 9-38). http://tinyurl.com/46dsgp is a production
example with comments @ the phrase ``Mach's exception mechanism''.
It's Apple's bug, and that's too far to have to go to work around it,
IMO, but the technique might be interesting or handy for this kind of
software atop osx.