User-agent: Mozilla Thunderbird 1.0.7 (Macintosh/20050923)
Hi,
I am trying to execute some code when exceptions occur in my
code(execution of trap, segment violations, etc.) while still keeping
the normal flow of exceptions(ie. CrashReporter pops up). I have figured
out after a while that I need to write an exception port, I am unable to
figure out exactly how to do so.
Ideally, I'd like to rethrow the exception while knowing which thread
caused it, so that I can use the backtrace from the CrashReporter to
help in debugging crashes.
(If desired, you can stop reading here.)
This all started when I noticed that an application's windows are not
closed until the CrashReporter's close button is clicked. It makes sense
for most applications to show a dialog instead of just magically
vanishing and leaving a dialog box behind, however, when the application
is a fullscreen window, the CrashReporter actually appears "behind" the
application, with the side effect that the close button cannot be clicked.
Simple enough, I thought, it's just a matter of adding a signal handler,
catch the signal for the exceptions, close the window, then resend the
signal to ourself, thus causing the CrashReporter to pop up.
Unfortunately, CrashReporter sets up an exception port, thus intervening
before the signal handler has a chance to do something(because the
exception is not translated into a signal).
Thus, I've searched for information on how to set up an exception port
and have it rethrow the exception after closing the window, but
documentation is quite scarce on the topic of exception ports. I have
found a couple of pointers which sent me on the right track, but now I
appear to have hit a wall.