I've written an unhandled error module for my iPhone app, but for some reason some errors are managing to bypass it.
I have an exception handler and the following signal handlers set:
NSSetUncaughtExceptionHandler(&handleException);
signal(SIGILL, handleSignal);
signal(SIGABRT, handleSignal);
signal(SIGFPE, handleSignal);
signal(SIGBUS, handleSignal);
signal(SIGSEGV, handleSignal);
signal(SIGSYS, handleSignal);
signal(SIGPIPE, handleSignal);
For most stuff (unrecognized selector, floating point errors, etc) it works, but for example when I run the following code:
NSString* str = [NSString stringWithFormat:@"a"];
[str release];
[str retain];
It avoids my error handler entirely and instead prints this to the console:
Stack dump: 0. Running pass 'Combine redundant instructions' on function '@glgRunProcessor10'**
I had another one that printed the following (but I can't remember what code I ran to cause it):
Stack dump: 0. Running pass 'Linear Scan Register Allocator' on function '@gldLLVMFPTransform5'
If I do this:
NSString* str = [NSString stringWithFormat:@"a"];
[str release];
[str init];
It doesn't print anything at all, but just exits the program.
Does anyone know of a surefire way to ensure that ALL errors get caught and run through a handler routine?