Colen
Colen

Reputation: 13918

Mac OS signal handling / crash reporting

In Mac OS, an application that causes a signal (through a null pointer exception or something similar) normally shows the standard Mac OS crash dialog, including a nice stack trace of where the signal happened. If you have the crash report, this makes it easy for you to find out where the problem occurred in your code and fix it.

mac os crash report

This stack trace is easy to look up and figure out where the execution was where it crashed.

However, the standard Mac OS crash report prompts the user to send it to Apple, which is not useful because users will just press the button and assume we got the crash report when in fact we didn't. I want to instead show my own crash report with stack trace that tells the user to email it to me instead, or auto-submits it to a web form, or something similar.

How can I get the stack trace for a signal like this? I've tried the following:

enter image description here

The line numbered 3 in this image is where the signal handler is called - it doesn't give the same stack trace as the standard crash report, even if you ignore the obvious "here's where I'm throwing an exception" bit.

How can I duplicate the behavior of the standard crash report where it gives me the call stack from which the signal was generated?

Upvotes: 3

Views: 2832

Answers (1)

Evan
Evan

Reputation: 6161

I highly recommend PLCrashReporter. It handles uncaught exceptions and fatal signals and generates a crash report similar to the one you see in the Apple crash dialog. There are various services you can pay to do the analytics of the crashes (group by version and common callstack). Or you can run a server yourself. One open source service is QuicyKit.

Upvotes: 3

Related Questions