SIGABRT doesn't show stack trace in iOS 5 simulator
Asked Answered
F

3

10

When running my application in the iPad Simulator using iOS 5, if there is a SIGABRT error, it doesn't show the full stack trace as it did in iOS 4.3

Also the debugger doesn't stop in the line where the error occurred, but in the application's main method instead.

This makes it much harder to find the problem...

Does anyone know how to make iOS 5 behave as it did in 4.3? Is it possible?

This is what iOS 5 shows

2011-10-21 10:45:18.528 KBNavigator[9283:17603] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: unrecognized selector sent to instance 0x2b4ccd8'
*** First throw call stack:
(0x2ab6052 0x28d6d0a 0x2ab7ced 0x2a1cf00 0x2a1cce2 0x14ff1c 0x14e93c 0x10cdf1 0x105c88 0x133b40 0x135935 0x1532548 0x1534722 0x13e47c7 0x13e42c1 0xd1e3d66 0x13e728c 0x13e72b8 0x13e79ab 0x13ec288 0xd1e3ece 0xb5262 0xcf55f 0xb72c3 0x141d64e 0x141cc1c 0x144356d 0x142dd47 0x1444441 0x14444f9 0x163bc68 0x13fb4a1 0x13fc12b 0x163b4c7 0x1424427 0x142458c 0xd1fe280 0x14245cc 0xecdaf 0xf14e2 0xecb9d 0xd5d0e 0x135e88 0x107098 0x12d870 0x2ab7ec9 0x135a5c2 0x135a55a 0x13ffb76 0x140003f 0x13ff2fe 0x137fa30 0x137fc56 0x1366384 0x1359aa9 0x28b9fa9 0x2a8a1c5 0x29ef022 0x29ed90a 0x29ecdb4 0x29ecccb 0x28b8879 0x28b893e 0x1357a9b 0x18656 0x2be5 0x1)
terminate called throwing an exception

And this is for iOS 4.3

2011-10-21 10:46:40.066 KBNavigator[9381:14003] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: unrecognized selector sent to instance 0x20d15e8'
*** Call stack at first throw:
(
0   CoreFoundation                      0x020645a9 __exceptionPreprocess + 185
1   libobjc.A.dylib                     0x021b8313 objc_exception_throw + 44
2   CoreFoundation                      0x020660bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3   CoreFoundation                      0x01fd5966 ___forwarding___ + 966
4   CoreFoundation                      0x01fd5522 _CF_forwarding_prep_0 + 50
5   KBNavigator                         0x0014ff1c -[GXControlWheel controlToData:] + 1292
...
)
terminate called throwing an exception
Federica answered 21/10, 2011 at 13:0 Comment(2)
Found a usefull workaround here, having exactly the same problem as described.Celestaceleste
Great!, that worked. Voted to close this question as duplicate...Federica
P
19

The easiest way to debug these sorts of errors is to add a breakpoint that fires on Objective-C exceptions. You can do so from this menu:

Exception menu

(Hat tip Naveen Shan)

Philibeg answered 3/4, 2012 at 10:47 Comment(0)
G
0

If this is only for debugging purposes, one solution is to simply set a breakpoint in NSException where it's thrown. The only problem is it will break also for exceptions that are handled, but it won't affect the code.

Another solution is to set an exception handler with NSSetUncaughtExceptionHandler. This will be triggered only when exceptions were not handled as the name suggests.

Gird answered 4/3, 2012 at 10:24 Comment(0)
F
0

What did it for me, was something that I found here that has to do with creating NSZombies

  1. Go to your project in Xcode 4
  2. Environment variables can be set up in the Scheme editor (find Product -> Edit scheme… in menu bar)
  3. Name the variable as NSZombieEnabled and set its value to YES.
  4. Run your app in Debug mode. You likely get a … message sent to deallocated instance… message and the debugger stops at the line in error. This information leads to the problem.
  5. When ready, disable NSZombieEnabled by changing YES to NO.
Flow answered 28/3, 2012 at 22:2 Comment(1)
This is for EXC_BAD_ACCESS Error which is caused due to using of any object which already get deallocatedOpenandshut

© 2022 - 2024 — McMap. All rights reserved.