Xcode 4.2 Debug Doesn't Symbolicate Stack Call

Xcode 4.2 debug doesn't symbolicate stack call

Nothing I tried would fix this (tried both compilers, both debuggers, etc.)
After upgrading XCode for the iOS 5 update, no stack traces seemed to work.

However, I have found an effective work-around - creating my own exception handler (which is also useful for other reasons). First, create a function that will handle the error and output it to the console (as well as whatever else you want to do with it):

void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"CRASH: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}

Next, add the exception handler to your app delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
// Normal launch stuff
}

That's it!

If this doesn't work, then there are only two possible reasons:

  1. Something is overwriting your NSSetUncaughtExceptionHandler call (there can be only one handler for your entire app). For example, some 3rd party libraries set their own uncaughtExceptionHandler. So, try setting it at the END of your didFinishLaunchingWithOptions function (or selectively disabling 3rd party libraries). Or better yet, set a symbolic break point on NSSetUncaughtExceptionHandler to quickly see who is calling it. What you may want to do is to modify your current one rather than adding another one.
  2. You're not actually encountering an exception (for example, EXC_BAD_ACCESS is not an exception; credit to @Erik B's comments, below)

Xcode 4.2 debugging on a viewDidLoad or viewDidDisappear will end on a EXC_BAD_ACCESS

You must always call through to super at some point in all of the viewWill... or viewDid... methods that you override. For example,

- (void) viewDidDisappear:(BOOL)animated {
NSLog(@"View did disapear");
[super viewDidDisappear:animated];
}

No exception stacktrace in console under Xcode 4.2/iOS 5?

This works:

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = -1;
@try {
retVal = UIApplicationMain(argc, argv, nil, nil);
}
@catch (NSException* exception) {
NSLog(@"Uncaught exception: %@", exception.description);
NSLog(@"Stack trace: %@", [exception callStackSymbols]);
}
[pool release];
return retVal;
}

For ARC:

int main(int argc, char *argv[]) {

int retVal = -1;
@autoreleasepool {
@try {
retVal = UIApplicationMain(argc, argv, nil, nil);
}
@catch (NSException* exception) {
NSLog(@"Uncaught exception: %@", exception.description);
NSLog(@"Stack trace: %@", [exception callStackSymbols]);
}
}
return retVal;
}

Still waiting for some sort of explanation as to why the default dump no longer works and/or why (even more serious) uncaughtExceptionHandler doesn't work. However, apparently this problem only affects the emulator.

update:

It has been pointed out that if you go to Product -> Scheme -> Edit Scheme, select "Run (Debug)", select the "Diagnostics" tab, and click "Log Exceptions", this will restore the missing Xcode default exception logging, possibly (I haven't tried it yet) eliminating the need for the above hack.

Debugging app crashes with iOS Simulator & XCode 4 halts in main() function, not crash source

Go to the breakpoints panel, and add the bottom left, click the + sign and add an "Exception breakpoint".

Exceptions : All

Break : On throw.

That should solve the problem in most cases.

Too much information being presented in Debug Area - Xcode 8

Open:

  • => Product
  • => Scheme
  • => Edit Scheme
  • => Select "Run"
  • => Second Tab "Argument"
  • => Inside Environment Variables press + button
  • => add Name = OS_ACTIVITY_MODE & set the Value to disable
  • Press Close button

And you are done.

tcp_connection_start debug log



Related Topics



Leave a reply



Submit