How can we generate symbolicate crash report from normal text data? - ios

Im using xcode 12 and ios 13 for ios application.
I have caught runtime exceptions in AppDelegate level append StackTrace (using Thread.callStackSymbols) to Log file and save it with .crash extension. But Stacktrace is not human readable. I followed some article , found we have to generate symobolicate file from it and it should be human readable.
Unfortunately, i couldn't find the way to how to do it ? can someone suggest standard way to how to do it ?
I will attach my log.crash file output content here for your reference.
Please, help me to resolve this issue and i really appreciate your feedback and comment.
Crash Type : signal
Summary: OTHER
Reason: Signal OTHER(5) was raised
Version: 1.0
AppInfo:
Device: iPad
OS Version: iOS 13.5.1
CallStack:
2 libsystem_platform.dylib 0x00000001ad5b4884 3834105B-0F62-3E9B-A9F7-B9F29A2B7E1B + 34948
3 libswiftCore.dylib 0x00000001bad57d70 01A8EE3D-C8DC-396B-89AD-A5F64DF13F80 + 220528
4 libswiftCore.dylib 0x00000001bad57234 $ss17_assertionFailure__4file4line5flagss5NeverOs12StaticStringV_A2HSus6UInt32VtF + 468
5 libswiftCore.dylib 0x00000001bad35ed0 $ss12_ArrayBufferV37_checkInoutAndNativeTypeCheckedBounds_03wasfgH0ySi_SbtF + 208
6 libswiftCore.dylib 0x00000001bad39ac8 $sSayxSicig + 84
7 test 0x000000010047fda8 $s13test24ToolOptionsContainerViewC03setdE8MetaData8toolTypeyAA0dL0O_tF + 1188
8 test 0x000000010048341c $s13test24ToolOptionsContainerViewC06updatedeG08toolTypeyAA0dJ0O_tF + 188
9 test 0x000000010047f2bc $s13test24ToolOptionsContainerViewC5frame8toolType8delegateACSo6CGRectV_AA0dJ0OAA0defG8Delegate_ptcfc + 2852
10 test 0x000000010047e788 $s13test24ToolOptionsContainerViewC5frame8toolType8delegateACSo6CGRectV_AA0dJ0OAA0defG8Delegate_ptcfC + 88
11 test 0x00000001002d1564 $s13test0bC4ViewC18setUpHeaderToolbar33_DCFA78A12B92B8638AD99354F8879966LLyyF + 12292
12 test 0x00000001002ce540 $s13test0bC4ViewC12initSubViews33_DCFA78A12B92B8638AD99354F8879966LLyyF + 32
13 test 0x00000001002cd568 $s13test0bC4ViewC5frameACSo6CGRectV_tcfc + 3716
14 test 0x00000001002cd644 $s13test0bC4ViewC5frameACSo6CGRectV_tcfcTo + 56
15 test 0x000000010023c854 $sSo6UIViewCABycfcTO + 28
16 test 0x000000010023c82c $sSo6UIViewCABycfC + 32
17 test 0x000000010024d0ac $s13test0bC14ViewControllerC04loadD0yyF + 200
18 test 0x000000010024f7e8 $s13test0bC14ViewControllerC04loadD0yyFTo + 32
19 UIKitCore 0x00000001b130eee4 BD57BD6E-12B4-3F92-85CA-754932DA499D + 4108004
20 UIKitCore 0x00000001b130f5e8 BD57BD6E-12B4-3F92-85CA-754932DA499D + 4109800
21 UIKitCore 0x00000001b128dbc0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 3578816
22 UIKitCore 0x00000001b12363d0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 3220432
23 UIKitCore 0x00000001b1232654 BD57BD6E-12B4-3F92-85CA-754932DA499D + 3204692
24 UIKitCore 0x00000001b195bb64 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10713956
25 UIKitCore 0x00000001b194b50c BD57BD6E-12B4-3F92-85CA-754932DA499D + 10646796
26 UIKitCore 0x00000001b197b9f0 BD57BD6E-12B4-3F92-85CA-754932DA499D + 10844656
27 CoreFoundation 0x00000001ad82906c 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 688236
28 CoreFoundation 0x00000001ad823f60 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 667488
29 CoreFoundation 0x00000001ad8243dc 50CF3336-313F-3A7D-9048-CB1ED8EC3368 + 668636
30 CoreFoundation 0x00000001ad823ce8 CFRunLoopRunSpecific + 424
31 GraphicsServices 0x00000001b796e38c GSEventRunModal + 160
32 UIKitCore 0x00000001b1952444 UIApplicationMain + 1932
33 test 0x000000010039d00c main + 88
34 libdyld.dylib 0x00000001ad6ab8f0 3D6D64B4-CB2B-3CC4-A7E9-02774DF7AE74 + 6384

Try it below link , it is working to some level. but line numbers are missing.
https://github.com/GDXRepo/CallStackParser
But CwlDemangle has some compile errors and replace it by below file.
https://github.com/mattgallagher/CwlDemangle/blob/master/CwlDemangle/CwlDemangle.swift
We can get callStackSymbols from below way.
var callStackSymbols = Thread.callStackSymbols
or
let callStackSymbols = exteption.callStackSymbols
and pass callStackSymbols to classAndMethodForStackSymbol(callStackSymbol)
Then it will return decoded string.

Related

How to fix WebKit crash on objective-c

I try to fix an error on firebase.
My sources are based on objective-c, and "webkit" is a problem in my code
I try and try to find what is cause of it, but I can't. Because these errors appears in a different places but same error.
stack trace : com.apple.main-thread
**EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000028**
keyboard_arrow_up
arrow_right 0
WebKit
WebKit::ProcessThrottler::setAssertionType(WebKit::ProcessAssertionType) + 544
I know it has only few clues for finding. Sorry.
My codes have a lot of request datas to Server and response from Server on mainthread.
I expect it occurs this problem but I'm not sure.
Thanks.
full call stack
Crashed: com.apple.main-thread
0 WebKit 0x199361fcc WebKit::ProcessThrottler::setAssertionType(WebKit::ProcessAssertionType) + 544
1 WebKit 0x199361fb4 WebKit::ProcessThrottler::setAssertionType(WebKit::ProcessAssertionType) + 520
2 WebKit 0x199362484 WebKit::ProcessThrottler::sendPrepareToSuspendIPC(WebKit::IsSuspensionImminent) + 596
3 WebKit 0x199367620 WTF::Detail::CallableWrapper<WebKit::ProcessThrottler::setAssertionType(WebKit::ProcessAssertionType)::$_1, void>::call() + 144
4 WebKit 0x199435e40 -[WKProcessAssertionBackgroundTaskManager _notifyAssertionsOfImminentSuspension] + 436
5 WebKit 0x1994364b0 -[WKProcessAssertionBackgroundTaskManager _handleBackgroundTaskExpirationOnMainThread] + 312
6 JavaScriptCore 0x197034278 WTF::Detail::CallableWrapper<WTF::callOnMainAndWait(WTF::Function<void ()>&&, WTF::MainStyle)::$_0, void>::call() + 48
7 JavaScriptCore 0x197049324 WTF::RunLoop::performWork() + 484
8 JavaScriptCore 0x197049f24 WTF::RunLoop::performWork(void*) + 36
9 CoreFoundation 0x18cfdb81c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
10 CoreFoundation 0x18cfdb718 __CFRunLoopDoSource0 + 208
11 CoreFoundation 0x18cfdaa28 __CFRunLoopDoSources0 + 268
12 CoreFoundation 0x18cfd4d20 __CFRunLoopRun + 824
13 CoreFoundation 0x18cfd44bc CFRunLoopRunSpecific + 600
14 GraphicsServices 0x1a3ae6820 GSEventRunModal + 164
15 UIKitCore 0x18f981164 -[UIApplication _run] + 1072
16 UIKitCore 0x18f986840 UIApplicationMain + 168
17 MyApp 0x10235f3d0 main + 29 (main.m:29)
18 libdyld.dylib 0x18cc9be40 start + 4

Crashing when getting default Realm on macOS High Sierra

I made a big mistake by upgrading to macOS High Sierra too soon. Now, whenever I try to get the default Realm in the simulator by simply calling let realm = try! Realm(), the app crashes with the below trace.
17-09-27 00:42:12.066162+0900 Lulu[94661:1045399] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation getArgument:atIndex:]: struct with unknown contents found while getting argument at index -1'
*** First throw call stack:
(
0 CoreFoundation 0x00000001123381cb __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000111c9af41 objc_exception_throw + 48
2 CoreFoundation 0x00000001122bb549 -[NSInvocation getArgument:atIndex:] + 473
3 Foundation 0x000000011173ba34 _NSGetValueWithMethod + 174
4 Foundation 0x00000001116b5500 -[NSObject(NSKeyValueCoding) valueForKey:] + 284
5 Realm 0x0000000110392709 -[RLMObjectBase valueForKey:] + 185
6 Realm 0x00000001103bac13 -[RLMProperty initSwiftPropertyWithName:indexed:linkPropertyDescriptor:property:instance:] + 691
7 Realm 0x0000000110399752 +[RLMObjectSchema propertiesForClass:isSwift:] + 1922
8 Realm 0x000000011039745d +[RLMObjectSchema schemaForObjectClass:] + 941
9 Realm 0x00000001104fd49b _ZL16RLMRegisterClassP10objc_class + 299
10 Realm 0x00000001104fe83d __25+[RLMSchema sharedSchema]_block_invoke + 77
11 CoreFoundation 0x00000001122bcf72 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 226
12 Realm 0x00000001104fe4f4 +[RLMSchema sharedSchema] + 1044
13 Realm 0x00000001104db934 +[RLMRealm realmWithConfiguration:error:] + 5620
14 RealmSwift 0x0000000110e1ea72 _T0So8RLMRealmCABSo0A13ConfigurationC13configuration_tKcfCTO + 162
15 RealmSwift 0x0000000110e1e8ee _T010RealmSwift0A0CACyKcfc + 126
16 RealmSwift 0x0000000110e1e816 _T010RealmSwift0A0CACyKcfC + 54
17 Lulu 0x000000010eab258e _T010Lulu15QuestionsLoaderC19loadDbQuestionnaire33_B2763018E452D760653439DEADCB4F03LLAA0G0CSgyF + 46
18 Lulu 0x000000010eab2155 _T010Lulu15QuestionsLoaderC04loadC033_B2763018E452D760653439DEADCB4F03LLyyKF + 37
19 Lulu 0x000000010eab10d4 _T010Lulu15QuestionsLoaderC13questionnaireAA13QuestionnaireCfg + 228
20 Lulu 0x000000010ea939b9 _T010Lulu22QuestionnairePresenterCAcA0C4View_p08questionE0_tcfc + 201
21 Lulu 0x000000010ea938a2 _T010Lulu22QuestionnairePresenterCAcA0C4View_p08questionE0_tcfC + 50
22 Lulu 0x000000010e98757f _T010Lulu27QuestionnaireViewControllerC11viewDidLoadyyF + 191
23 Lulu 0x000000010e988a84 _T010Lulu27QuestionnaireViewControllerC11viewDidLoadyyFTo + 36
24 UIKit 0x0000000113441d51 -[UIViewController loadViewIfRequired] + 1235
25 UIKit 0x000000011344219e -[UIViewController view] + 27
26 UIKit 0x000000011347413b -[UINavigationController _startCustomTransition:] + 954
27 UIKit 0x000000011348a894 -[UINavigationController _startDeferredTransitionIfNeeded:] + 686
28 UIKit 0x000000011348bb90 -[UINavigationController __viewWillLayoutSubviews] + 115
29 UIKit 0x00000001136e22ae -[UILayoutContainerView layoutSubviews] + 231
30 UIKit 0x0000000113372551 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1331
31 QuartzCore 0x000000011ba184ba -[CALayer layoutSublayers] + 153
32 QuartzCore 0x000000011ba1c5a9 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
33 QuartzCore 0x000000011b9a51cd _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
34 QuartzCore 0x000000011b9d0ae4 _ZN2CA11Transaction6commitEv + 500
35 UIKit 0x000000011329df4a _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
36 UIKit 0x0000000113bf5960 __handleEventQueueInternal + 6894
37 CoreFoundation 0x00000001122db2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
38 CoreFoundation 0x000000011237ad31 __CFRunLoopDoSource0 + 81
39 CoreFoundation 0x00000001122bfc19 __CFRunLoopDoSources0 + 185
40 CoreFoundation 0x00000001122bf1ff __CFRunLoopRun + 1279
41 CoreFoundation 0x00000001122bea89 CFRunLoopRunSpecific + 409
42 GraphicsServices 0x000000011a5379c6 GSEventRunModal + 62
43 UIKit 0x00000001132a3d30 UIApplicationMain + 159
44 Lulu 0x000000010e9dbc07 main + 55
45 libdyld.dylib 0x0000000116e95d81 start + 1
)
My installation is the following:
Xcode 9.0
Cocoapods 1.3.1
Realm 2.10.1
Swift 3.2
SSD Hard drive, that means I have APFS
FileVault enabled
I tried to find anything on the web, apparently there isn't anything.
I also tried (but it didn't work):
Removing and re-installing pods
Deleting realm files
Removing and re-installing app in the simulator
Deleting Xcode's derived data
Apparently, I was awfully shortsighted (I did deserve those downvotes 🙃), this had nothing to do with anything I thought about.
After debugging through Realm's code to check the exception, it turned out that the crash was caused by this instruction id propertyValue = [obj valueForKey:_name]; in [RLMProperty initSwiftPropertyWithName:indexed:linkPropertyDescriptor:property:instance:].
The actual issue is that I added a field of type Decimal which is not supported in Realm.

iOS Keyboard Extension crash before any of my code runs

I have been getting crash reports like this for a keyboard extension I have developed and am either confused about how to read the stack trace or why it is occurring or both and I was hoping someone could help me clear this up.
Below is the stack trace:
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0xd15db9df
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x37949f66 objc_msgSend + 5
1 UIKit 0x2cd57f05 -[_UIViewControllerTransitionContext completeTransition:] + 52
2 UIKit 0x2d10ac1f __95-[_UIWindowAnimationController _performLayoutAnimationWithContext:windowGeometryUpdatingBlock:]_block_invoke88 + 26
3 UIKit 0x2cc7b8e1 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 308
4 UIKit 0x2cc7b4f9 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 184
5 UIKit 0x2cc7b40f -[UIViewAnimationState animationDidStop:finished:] + 70
6 QuartzCore 0x2c660fe7 CA::Layer::run_animation_callbacks(void*) + 234
7 libdispatch.dylib 0x37ecdc6f _dispatch_client_callout + 22
8 libdispatch.dylib 0x37ed9553 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1322
9 CoreFoundation 0x295ac889 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
10 CoreFoundation 0x295aafa9 __CFRunLoopRun + 1512
11 CoreFoundation 0x294f69a1 CFRunLoopRunSpecific + 476
12 CoreFoundation 0x294f67b3 CFRunLoopRunInMode + 106
13 GraphicsServices 0x30e911a9 GSEventRunModal + 136
14 UIKit 0x2cca7635 UIApplicationMain + 1440
15 libxpc.dylib 0x3806f9e3 _xpc_objc_main + 706
16 libxpc.dylib 0x38071009 xpc_main + 168
17 Foundation 0x2a3ec289 service_connection_handler + 162
18 PlugInKit 0x32c5ff75 -[PKService run] + 508
19 PlugInKit 0x32c5fc4b +[PKService main] + 58
20 PlugInKit 0x32c5ffa9 +[PKService _defaultRun:arguments:] + 20
21 libextension.dylib 0x371b60c5 NSExtensionMain + 48
22 libdyld.dylib 0x37f0baaf start + 2
In the left column where it lists the libraries (correct term?) I don't see any reference to my code. In other crash logs there is always some reference to a class in my app or something but I don't see that in this one. What does that mean? Is the crash occurring before my code executes and this is an Apple issue I can ignore?
It's an Apple Bug. The keyboard extension I work on has a nearly identical crash report. Fortunately, this only seems to happen on iOS 8, though I have seen a similar one that affects iOS 9.
I would file a bug report with Apple, and include a copy of the stack trace.

How to understand this crash report for iPhone App

This iPhone App will dial and hangup a call automatically. It works on jailbroken devices.
Sometimes it will crash when hanging up a phone call.
What is the problem and how do I fix it?
Exception Type: EXC_GUARD
Exception Subtype: GUARD_TYPE_FD
Exception Message: CLOSE on file descriptor 16 (guarded with 0x08fd4dbfade2dead)
Triggered by Thread: 0
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x38cdf130 __close_nocancel + 12
1 libsystem_c.dylib 0x38c4fcd5 fclose + 69
2 libCGFreetype.A.dylib 0x2e56dde5 FT::file_stream::~file_stream() + 25
3 libCGFreetype.A.dylib 0x2e56ddbb FT::file_stream::~file_stream() + 7
4 libCGFreetype.A.dylib 0x2e5730b5 destroy_face + 117
5 libCGFreetype.A.dylib 0x2e573039 FT_Done_Face + 93
6 libCGFreetype.A.dylib 0x2e5658e3 FT::face_release(FT_FaceRec_*) + 95
7 libCGFreetype.A.dylib 0x2e568f31 FT::font::~font() + 269
8 libCGFreetype.A.dylib 0x2e568e13 FT::font::~font() + 7
9 libCGFreetype.A.dylib 0x2e56fa77 (anonymous namespace)::release_private_data(void*) + 55
10 CoreGraphics 0x2e51301f font_finalize + 27
11 CoreFoundation 0x2e2ffe2d CFRelease + 465
12 libcache.dylib 0x38bc321f _value_entry_remove + 139
13 libcache.dylib 0x38bc25b3 _entry_remove + 195
14 libcache.dylib 0x38bc2761 cache_remove_with_block + 129
15 CoreFoundation 0x2e307fcb __CFNotificationCenterAddObserver_block_invoke + 123
16 CoreFoundation 0x2e391e6f __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 11
17 CoreFoundation 0x2e305aad _CFXNotificationPost + 1717
18 Foundation 0x2ecebec1 -[NSNotificationCenter postNotificationName:object:userInfo:] + 69
19 UIKit 0x30bd7e79 -[UIApplication _handleApplicationSuspend:eventInfo:] + 909
20 UIKit 0x30b590c3 -[UIApplication handleEvent:withNewEvent:] + 771
21 UIKit 0x30b58cf9 -[UIApplication sendEvent:] + 69
22 UIKit 0x30bbe31d _UIApplicationHandleEvent + 661
23 GraphicsServices 0x3303876b _PurpleEventCallback + 607
24 GraphicsServices 0x33038353 PurpleEventCallback + 31
25 CoreFoundation 0x2e39a775 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 33
26 CoreFoundation 0x2e39a70f __CFRunLoopDoSource1 + 343
27 CoreFoundation 0x2e398edb __CFRunLoopRun + 1403
28 CoreFoundation 0x2e30346d CFRunLoopRunSpecific + 521
29 CoreFoundation 0x2e30324f CFRunLoopRunInMode + 103
30 GraphicsServices 0x330372e7 GSEventRunModal + 135
31 UIKit 0x30bb8841 UIApplicationMain + 1133
32 MyApp 0x000f6d0d main (main.m:15)
33 libdyld.dylib 0x38c29ab5 start + 1
It looks like you have a bogus file descriptor that its trying to close. The address ends in "fade2dead", which is likely a special value to indicate freed memory. Since I don't see any of your code in the stack trace, it's likely that something is overwriting memory used by the FreeType library. I'd look for other memory stompers in your code using GuardMalloc or other similar memory tools to track down what it could be, as it's not obvious from the above stack trace.

Interpreting iOS crash reports

I'm experiencing multiple crashes where it appears that a native iOS method is calling functions from a third-party library. Here's an example:
Thread: Unknown Name (Crashed)
0 libsystem_kernel.dylib 0x33222350 __pthread_kill + 8 + 8
1 libsystem_c.dylib 0x3500f973 abort + 95 + 94
2 libsystem_c.dylib 0x34ff04d1 basename + 1
3 FireChat 0x00036489 -[OTOverlayButton drawRect:] + 1
4 Foundation 0x37a4a5a9 -[NSDictionary(NSKeyValueCoding) valueForKey:] + 33 + 32
5 FireChat 0x709d -[NetworkModel getUserForUid:] (NetworkModel.m:150)
6 FireChat 0x0001c42f -[OpenTokController session:didReceiveStream:] (OpenTokController.m:258)
7 libdispatch.dylib 0x32da011f _dispatch_call_block_and_release + 11 + 10
8 libdispatch.dylib 0x32d9f4b7 _dispatch_client_callout + 23 + 22
9 libdispatch.dylib 0x32da41bd _dispatch_main_queue_callback_4CF$VARIANT$mp + 225 + 224
10 CoreFoundation 0x37dbbf3b __CFRunLoopRun + 1291 + 1290
11 CoreFoundation 0x37d2eebd CFRunLoopRunSpecific + 357 + 356
12 CoreFoundation 0x37d2ed49 CFRunLoopRunInMode + 105 + 104
13 GraphicsServices 0x358e22eb GSEventRunModal + 75 + 74
14 UIKit 0x3a1b42f9 UIApplicationMain + 1121 + 1120
15 FireChat 0x43b3 main (main.m:8)
To me, it appears that the [NSDictionary valueForKey:] method is invoking [OTOverlayButton drawRect:] which comes from a third-party library. This shouldn't be possible -- am I reading the crash report wrong?
[OTOverlayButton drawRect:] isn't called anywhere in my code. Note that the dictionary contains (my) objects which contain pointers to objects from the third-party library.
The library vendor and I are both baffled.
Thanks.
I believe the cause of this crash was memory corruption resulting from calling performSelector: on a method that returned a struct. See this blog post for more details:
Why performSelector is more dangerous than I thought

Resources