• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CrashReporter, signals and exception ports
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CrashReporter, signals and exception ports


  • Subject: CrashReporter, signals and exception ports
  • From: Jean-Francois Im <email@hidden>
  • Date: Fri, 06 Jan 2006 16:15:43 -0500

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.

Currently, I have an exception port which traps the exception but does not rethrow it(I assume that it is possible). I'd paste the code here, but it's somewhat longish and it's not all that different from the ux_handler() function present in XNU. http://www.opensource.apple.com/darwinsource/10.4.3/xnu-792.6.22/bsd/uxkern/ux_exception.c

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.

Thanks in advance for any help on the topic.

Jean-Francois Im

PS: For posterity, I'll include the documentation I found useful :
http://www.wodeveloper.com/omniLists/macosx-dev/2001/March/msg00849.html
http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/
http://www.opensource.apple.com/darwinsource/10.4.3/xnu-792.6.22/bsd/uxkern/ux_exception.c
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: CrashReporter, signals and exception ports
      • From: Steve Checkoway <email@hidden>
  • Prev by Date: Re: Win32 cross-compiler for OSX?
  • Next by Date: Re: CrashReporter, signals and exception ports
  • Previous by thread: Re: Win32 cross-compiler for OSX?
  • Next by thread: Re: CrashReporter, signals and exception ports
  • Index(es):
    • Date
    • Thread