Saturday, April 04, 2009

Nothing to (Crash) Report

I wish I could write the kind of informative technical blog post I've spent the past couple of days Googling for. Instead I seem to spend all of my time trudging along in other people's footsteps. And all of my open source efforts appear to be focused on re-inventing Apple's wheel.


Case in point: I'm currently trying to implement a crash reporter-like daemon for Darwin. A couple of launchd-spawned daemons expect to find it waiting for them, and scrawl their displeasure at its absence across the console, which is a pain as I've just got a proper getty-based login prompt up and running. Crash reporter is, of course, closed source, so enter my pale imitation. The power of cut-and-paste quickly got me the appropriate .plists, which shut the nagging daemons right up. Until one of them crashed, meaning I might as well make the fake crash reporter do something useful and report the crash.


So I'm now working on code which combines interacting with launchd — to retrieve the ports it's set up in advance for the daemon — and Mach exceptions — by which the actual crash is reported. If there are two less-well-documented parts of OS X/Darwin, well, I doubt anyone outside of Apple has heard of them. The launchd side of things I managed to get working using code from one of Darwin's launchd-using parts (I think it was xinit). Mach exceptions — and in particular, the difference between exc_server() and mach_exc_server(), and why one refuses to work while the other is hiding from the linker — however, are still a mystery to me.


I guess a trip to the darwin-dev mailing list on Monday is in order.




No comments: