UnCaughtException handler : decode backtrace symbol - ios

I'm trying to get backtrace symbol like Xcode listout as below
*** First throw call stack:
(
0 CoreFoundation 0x018865e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x016098b6 objc_exception_throw + 44
2 CoreFoundation 0x01923903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x0187690b ___forwarding___ + 1019
4 CoreFoundation 0x018764ee _CF_forwarding_prep_0 + 14
5 Foundation 0x0124036c __NSFireDelayedPerform + 372
6 CoreFoundation 0x01844c46 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 22
7 CoreFoundation 0x0184462d __CFRunLoopDoTimer + 1181
8 CoreFoundation 0x0182c698 __CFRunLoopRun + 1816
9 CoreFoundation 0x0182bb33 CFRunLoopRunSpecific + 467
10 CoreFoundation 0x0182b94b CFRunLoopRunInMode + 123
11 GraphicsServices 0x02c249d7 GSEventRunModal + 192
12 GraphicsServices 0x02c247fe GSEventRun + 104
13 UIKit 0x0037c94b UIApplicationMain + 1225
14 CrashHandler 0x000088ad main + 141
15 libdyld.dylib 0x06244725 start + 0
16 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I'm trying to extract symbol from NSException as below code. and less information only available.
-(void)handleException:(NSException*)exception
{
[exception callStackSymbols]//I've written this into file.
}
I've got output as below
*** First throw call stack: (
0 CoreFoundation 0x326bd2bb <redacted> + 186
1 libobjc.A.dylib 0x3a33b97f objc_exception_throw + 30
2 CoreFoundation 0x326c0e07 <redacted> + 170
3 CoreFoundation 0x326bf531 <redacted> + 392
4 CoreFoundation 0x32616f68 _CF_forwarding_prep_0 + 24
5 Foundation 0x32fcb277 <redacted> + 450
6 CoreFoundation 0x326925df <redacted> + 14
7 CoreFoundation 0x32692291 <redacted> + 272
8 CoreFoundation 0x32690f01 <redacted> + 1232
9 CoreFoundation 0x32603ebd CFRunLoopRunSpecific + 356
10 CoreFoundation 0x32603d49 CFRunLoopRunInMode + 104
11 GraphicsServices 0x361b62eb GSEventRunModal + 74
12 UIKit 0x34519301 UIApplicationMain + 1120
13 CrashHandler 0x0007f421 main + 116
14 libdyld.dylib 0x3a772b20 <redacted> + 0
)
How to decode <redacted> symbol?
Reference and Understanding:
I've refer SO post1, SO post2 but It need dSYM file and we have to manually decode as like testflight.. Without dSYM file, how to do this?

Symbolication is the process of translation a memory address to a symbol that contains all or some of the following elements:
class name
method name
file name
line number
When symbolicating on the device with the app symbols being part of the app binary, only class name and method name can be retrieved. It is not possible to get file name and line number this way.
When symbolicating using the app dSYM, it is possible to get all data, as long all information is available when building the app. E.g. when using third party static libraries, file name and line number might be missing for those calls.
<redacted> symbols can only show up for system calls when symbolicating system framework addresses on the device. The reason the class name and/or method name doesn't show up is an iOS memory optimization. Explanation for this can be found here: https://devforums.apple.com/thread/171264
To symbolicate these addresses, you need to have the iOS symbols of the iOS version and CPU architecture that was used to create the stack trace on the computer that is symbolicating the report.
It is possible to get these symbols as part of Xcode or by connecting a device of the specific iOS version and CPU architecture to Xcode, which will then fetch the symbols. Note that e.g. for iOS bugfix versions that do not come with an updated SDK, the only way to get the symbols is using a device.
Symbolication on a computer can be done using Xcode organizer or manually using the symbolciatecrash.pl script which is part of Xcode manually in the terminal.
For symbolication to work with Xcode or the script, you need a full crash report which contains lots more information than your posted stack trace.
To use atos to manually symbolicate the frame addresses of your report, you'll also need the load address for each binary that a frame references, e.g. from Foundation, CoreFoundation, UIKit. The shown stack trace doesn't provide this information. There are multiple posts here on StackOverflow how to use atos manually.

There is no way to symbolicate the trace without a dSYMbolication file.
You could try to build your code with the option not to strip debug symbols but I'm not sure.
Also implementing a crash handler is a very delicate task that I would leave to pro's ;)
Yet you can give it a try and probably learn new things.

Related

Coredata + CollectionView

I'm trying to create an iOS app which has a collectionview that takes information from a website (with JSON) and stores the info on CoreData.
I have 2 entities on CoreData.
1 Called Regions (wich will be the collection header texts).
1 Called Distributors (which will be the collection cells).
To use CollectionView + CoreData i have seen this example: https://github.com/AshFurrow/UICollectionViewExample
I set up everthing and works but sometimes, when i rotate the devide multiple times and the collection view still scrolls i see this error:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'NSMutableRLEArray objectAtIndex:effectiveRange:: Out of bounds'
*** First throw call stack:
(
0 CoreFoundation 0x01a9f5e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x015738b6 objc_exception_throw + 44
2 CoreFoundation 0x01a9f3bb +[NSException raise:format:] + 139
3 Foundation 0x011a5f62 -[NSRLEArray objectAtIndex:effectiveRange:] + 131
4 Foundation 0x011a7b86 -[NSConcreteMutableAttributedString addAttribute:value:range:] + 212
5 UIFoundation 0x034aab82 __50-[NSConcreteTextStorage addAttribute:value:range:]_block_invoke + 156
6 UIFoundation 0x034aaa65 -[NSConcreteTextStorage addAttribute:value:range:] + 127
7 DataDetectorsUI 0x0a7da85c -[DDTextKitOperation _addResultsToAttributes] + 374
8 DataDetectorsUI 0x0a7daa82 __46-[DDTextKitOperation doURLificationOnDocument]_block_invoke_2 + 39
9 UIFoundation 0x034a9190 -[NSTextStorage(ActorSupport) coordinateAccess:] + 48
10 DataDetectorsUI 0x0a7daa54 __46-[DDTextKitOperation doURLificationOnDocument]_block_invoke + 134
11 libdispatch.dylib 0x0222d440 _dispatch_barrier_sync_f_slow_invoke + 71
12 libdispatch.dylib 0x0223e4b0 _dispatch_client_callout + 14
13 libdispatch.dylib 0x0222c75e _dispatch_main_queue_callback_4CF + 340
14 CoreFoundation 0x01b04a5e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
15 CoreFoundation 0x01a456bb __CFRunLoopRun + 1963
16 CoreFoundation 0x01a44ac3 CFRunLoopRunSpecific + 467
17 CoreFoundation 0x01a448db CFRunLoopRunInMode + 123
18 GraphicsServices 0x03d569e2 GSEventRunModal + 192
19 GraphicsServices 0x03d56809 GSEventRun + 104
20 UIKit 0x002e1d3b UIApplicationMain + 1225
21 CollectionTest 0x0000934d main + 141
22 libdyld.dylib 0x024ce725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I have created a demo app with everthing ready to launch it and check the error, you can download it here: https://www.dropbox.com/s/cg86896ld6240r5/CollectionTest.zip
I would appreciate any help if anyone know what could be the problem.
Thanks in advance.
I don't think this has anything to do with CoreData. I think this has to do with a bug in iOS 7 related to doURLificationOnDocument. We're running into this same problem in our app that makes no use of core data whatsoever. If you look at this stack overflow link: iOS 7 UITextView link detection crash in UITableView, you'll see that someone else is complaining about the same problem.
You are not using Core Data properly. Your entities have no relationships to each other. Instead, you are relying on some kind of foreign key. This is not appropriate for object graphs such as Core Data and can lead to all kinds of unpredictable errors, including the one you are encountering.
Read up on how Core Data models work. Pay particular attention to the chapter Relationships and Fetched Properties in the Core Data Programming Guide.

Symbolicate iOS Crash Stack Trace without Crash Log

I'm using BugSense to track crashes from an iOS App. Recently I noticed problems symbolicating stack traces from live usage.
The problem is that Apple introduced address space randomization with iOS 4.3 so that the stack address of interest cannot solely be used to retrieve the correct methods that caused the crash.
Currently I'm trying to get the correct address by calculating
symbol address = slide + stack address - load address
I already have slide and stack address but from my understanding the load address can only be found in the crash report which I cannot get via BugSense.
The stack trace looks like
0 CoreFoundation 0x342723e7 + 162
1 libobjc.A.dylib 0x3bf63963 objc_exception_throw + 30
2 CoreFoundation 0x3427229d + 0
3 Foundation 0x34b48fa3 + 90
4 UIKit 0x360b5bd9 + 7640
5 MyApp 0x000c6e99 0xb3000 + 81561
6 UIKit 0x3623c2ff 0x3607e000 + 1827583
7 UIKit 0x361b8737 0x3607e000 + 1287991
8 UIKit 0x361a9869 0x3607e000 + 1226857
9 UIKit 0x361a97ad 0x3607e000 + 1226669
10 CoreFoundation 0x34247941 0x341b0000 + 620865
11 CoreFoundation 0x34245c39 0x341b0000 + 613433
12 CoreFoundation 0x34245f1d 0x341b0000 + 614173
13 CoreFoundation 0x341b923d CFRunLoopRunSpecific + 356
14 CoreFoundation 0x341b90c9 CFRunLoopRunInMode + 104
15 GraphicsServices 0x37d9733b GSEventRunModal + 74
16 UIKit 0x360d52b9 UIApplicationMain + 1120
17 MyApp 0x000b61bf 0xb3000 + 12735
18 MyApp 0x000b4a08 0xb3000 + 6664
Is there another way to symbolicate this address or to get the respective load address?
The load address is 0xb3000.
Luckily you have the symbols stripped from your app binary, otherwise this wouldn't be visible.
Also this crash happened because of an exception being thrown, so the crash report should give you a Last Exception Backtrace showing where the actual exception happened and the actual exception reason. It is likely that the call in line 5 of the posted stack trace doesn't give you a lot of information on that. The crash information you are getting looks pretty limited :(

How can I resolve a SIGSEGV with crittercism

I'm using crittercism to get crash report on my app.
It's working pretty well but I got a crash with a stacktrace which is not really helpful.
0 libobjc.A.dylib 0x3b16c5b0 objc_msgSend + 16
1 Foundation 0x33d6b0f5 __NSThreadPerformPerform + 461
2 CoreFoundation 0x33429683 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
3 CoreFoundation 0x33428ee9 __CFRunLoopDoSources0 + 213
4 CoreFoundation 0x33427cb7 __CFRunLoopRun + 647
5 CoreFoundation 0x3339aebd CFRunLoopRunSpecific + 357
6 CoreFoundation 0x3339ad49 CFRunLoopRunInMode + 105
7 GraphicsServices 0x36f712eb GSEventRunModal + 75
8 UIKit 0x352b0301 UIApplicationMain + 1121
9 myapp 0x00024c2f main (main.m:14)
The crash is symbolicated but there is no information to point me at the exact place of the crash.
I think it could be an object released too soon, but since it's a random bug and I don't know where it happen its really hard to track it down.
How do I convert this stacktrace or the crash report to a human readable one?
This crash is almost exactly identical with my main headache-causing crash at the moment, and I don't know what to do about it. The only change in my crash log is main (main.m:6) instead of your main (main.m:14).
So far I've found this:
SIGABRT crash on __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
Rejected iPhone app has strange crash logs
The accepted answers suggests that it could be related to misuse of performSelector.
This guy also has the same crash, but with no suggested solution:
http://comments.gmane.org/gmane.comp.handhelds.phonegap/24494
There are other, similar crash logs out there that have a curious addition:
...
CoreFoundation 0xXXXXXXXX -[NSObject performSelector:withObject:] + XX <- additional line
Foundation 0xXXXXXXXX __NSThreadPerformPerform + XXX
CoreFoundation 0xXXXXXXXX __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + XX
...
Which again suggests that it's related to performSelector, but that's still speculation.

Symbolicating crash log for app with static library

I'm receiving crash reports from an app but Xcode is not able to symbolicate the symbols that are specific to my app:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x32c43a1c __pthread_kill + 8
1 libsystem_c.dylib 0x33a0a3b4 pthread_kill + 52
2 libsystem_c.dylib 0x33a02bf8 abort + 72
3 libsystem_c.dylib 0x33a306d4 __assert_rtn + 140
4 MyApplication 0x0000dd54 0x9000 + 19796
5 MyApplication 0x0000dbda 0x9000 + 19418
6 MyApplication 0x000103f6 0x9000 + 29686
7 MyApplication 0x0001035e 0x9000 + 29534
8 MyApplication 0x0000f3cc 0x9000 + 25548
9 MyApplication 0x00025d1e 0x9000 + 118046
10 CoreFoundation 0x35847efc -[NSObject(NSObject) performSelector:withObject:] + 16
11 Foundation 0x36eec7a2 __NSThreadPerformPerform + 262
12 CoreFoundation 0x358b1a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
13 CoreFoundation 0x358b3758 __CFRunLoopDoSources0 + 376
14 CoreFoundation 0x358b44e4 __CFRunLoopRun + 224
15 CoreFoundation 0x35844ebc CFRunLoopRunSpecific + 224
16 CoreFoundation 0x35844dc4 CFRunLoopRunInMode + 52
17 GraphicsServices 0x3446b418 GSEventRunModal + 108
18 GraphicsServices 0x3446b4c4 GSEventRun + 56
19 UIKit 0x344a2d62 -[UIApplication _run] + 398
20 UIKit 0x344a0800 UIApplicationMain + 664
21 MyApplication 0x0000b174 main (main.m:14)
22 MyApplication 0x0000b124 0x9000 + 8484
Except for the line in main.m. I know I have the dSYM file for it still in Xcode's archive. I've tried using the command line to reference those debug symbols directly, but I get the same result every time. I've tried using atos to lookup the symbol directly and it wasn't able to find it. I verified that it was the right dSYM by comparing the UUID.
It finds main.m every time, so it seems like its half working, but just not able to find anything else.
I am using a static library in this app--is it possible that the crash is occurring in the static library? Would that debug information be in a separate set of debug symbols? It says that the responsible library is my application...would it say the name of the static library if it was in fact responsible for the crash?
Thanks!
Static libraries are linked into your app executable, so after linking you won't be able to identify the original source of that code. Hence it will always name your app as the source binary.
It is likely that those frames are not getting symbolicated, because of the static library you included. This happens if the static library doesn't have the symbols in it, but stripped of. Happens quite often for static library release builds, where the default setting is the same as for apps, to strip of the symbols. (For apps this is the correct thing to do!)
In that case the symbols wouldn't be copied into the dSYM, because it can't find them in the static library.

Unable to symbolicate frameworks sometimes

I am completely at a loss on this one. I was able to symbolicate one of my crash reports (obtained from a user submitting it via the app) and it looked like this:
Thread 0 Crashed:
0 libobjc.A.dylib 0x360a3fbc objc_msgSend + 16
1 libobjc.A.dylib 0x360a50c5 _objc_rootRelease + 37
2 Foundation 0x31b7ec75 _timerRelease + 49
3 CoreFoundation 0x3729e709 __CFRunLoopDoTimer + 429
4 CoreFoundation 0x3729d29f __CFRunLoopRun + 1207
5 CoreFoundation 0x372204dd CFRunLoopRunSpecific + 301
6 CoreFoundation 0x372203a5 CFRunLoopRunInMode + 105
7 GraphicsServices 0x35dddfed GSEventRunModal + 157
8 UIKit 0x3055b743 UIApplicationMain + 1091
9 [App Name] 0x00002463 main (main.m:54)
However all of the rest of the crash reports look like this after being symbolicated:
Thread 0 Crashed:
0 libobjc.A.dylib 0x3790bfbc 0x37908000 + 16316
1 libobjc.A.dylib 0x3790d0c5 0x37908000 + 20677
2 Foundation 0x3505ec75 0x3505a000 + 19573
3 CoreFoundation 0x37d99709 0x37d0c000 + 579337
4 CoreFoundation 0x37d9829f 0x37d0c000 + 574111
5 CoreFoundation 0x37d1b4dd 0x37d0c000 + 62685
6 CoreFoundation 0x37d1b3a5 0x37d0c000 + 62373
7 GraphicsServices 0x37af2fcd 0x37aef000 + 16333
8 UIKit 0x3189b743 0x3186a000 + 202563
9 [App Name] 0x00002463 main (main.m:54)
Why do CoreFoundation, UIKit, etc. symbolicate in the first instance but not for the rest?
NOTE: I do have the original archive (that was submitted to the app store) and these are being symbolicated within Xcode 4.2 simply by dragging it into the organizer.
You most likely do not have the symbols on your Mac of the iOS version that crashed.
Check the iOS Version of the crash report (shows up in the top part of the report) and then check if you have the symbols for this iOS version here: /Developer/Platforms/iPhoneOS.platform/DeviceSupport.

Resources