2

Many OS X crash reports have this section like in a quote below

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information: objc[1769]: garbage collection is OFF

Terminating app due to uncaught exception 'InvalidX', reason: 'X can't be 0'

First throw call stack:

In my application there's custom crashes handling. All I can is to handle signals, nothing else. Where can I retrieve such useful information?

I found that you can set the message to show in built-in crash reports

static const char *__crashreporter_info__ = 0;
asm(".desc __crashreporter_info__, 0x10");

But I want not to set, but retrieve that information in my custom signal and exception handler.

Daniyar
  • 2,975
  • 2
  • 26
  • 39
  • I think your question is worded too vaguely. Are you talking about retrieving exception information, like from NSException? The docs talk about application specific information. – Jerry Dec 13 '15 at 02:07

2 Answers2

3

The technique changes every few releases of the OS. In general, the crash reporter enumerates the images in the process using the dyld debugger API, and extracts any information from crash buffers in each one. Currently, IIRC, there is a specially named Mach-O section in the data segment which points to (or contains) a static variable containing the data.

Wim Lewis
  • 392
  • 1
  • 9
  • I think it's a kind of private technic so Apple keeping silent around it. Thank you for pointing it out. – Daniyar Dec 14 '15 at 08:37
1

If you are looking to generate a crash report, the following shows how to catch the Mach message as a result of the exception and then generate a crash report.

How does OS X generate a crash report?

Community
  • 1
  • 1
Rajesh
  • 189
  • 15
  • Thank you for the answer, @Rajesh, and interesting link. Unfortunately, the main problem is a bit another, I need to debug deeply while signal caught. OS X usually now its cause, I'm not. – Daniyar Dec 14 '15 at 08:42