简体   繁体   中英

How to debug Flutter iOS crash

We're getting some crashes back from our Testflight distribution of our flutter app. It's hard for us to pinpoint where exactly the problem lies since the crash log's don't tell us much.

Here's the log (gist of full crash log / Xcode screenshot ):

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000003b3801090
VM Region Info: 0x3b3801090 is not in any region.  Bytes after previous region: 4622127249  
      REGION TYPE                      START - END             [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO            0000000280000000-00000002a0000000 [512.0M] rw-/rwx SM=PRV  
--->  
      UNUSED SPACE AT END

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [4572]
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libobjc.A.dylib                 0x000000018a902090 objc_msgSend + 16
1   Flutter                         0x00000001009d6f4c -[SemanticsObject hasChildren] + 60 (accessibility_bridge.mm:160)
2   Flutter                         0x00000001009d8334 -[SemanticsObject accessibilityContainer] + 36 (accessibility_bridge.mm:287)
3   UIAccessibility                 0x0000000195f88898 -[NSObject(AXPrivCategory) _accessibilityParentView] + 84 (NSObjectAccessibility.m:7787)
4   UIAccessibility                 0x0000000195f88734 -[NSObject(AXPrivCategory) _accessibilityWindow] + 92 (NSObjectAccessibility.m:7762)
5   UIAccessibility                 0x0000000195f8ff68 -[NSObject(AXPrivCategory) _accessibilityConvertSystemBoundedScreenRectToContextSpace:] + 48 (NSObjectAccessibility.m:10192)
6   UIAccessibility                 0x0000000195f83ee8 -[NSObject(AXPrivCategory) _iosAccessibilityAttributeValue:] + 4624 (NSObjectAccessibility.m:5303)
7   UIAccessibility                 0x0000000195f6637c _copyMultipleAttributeValuesCallback + 540 (UIAccessibilityRuntime.m:345)
8   AXRuntime                       0x0000000194fc56e0 ___AXXMIGCopyMultipleAttributeValues_block_invoke + 60 (AccessibilityPriv.m:1262)
9   AXRuntime                       0x0000000194fc5264 _handleNonMainThreadCallback + 60 (AccessibilityPriv.m:466)
10  AXRuntime                       0x0000000194fc5570 _AXXMIGCopyMultipleAttributeValues + 332 (AccessibilityPriv.m:1261)
11  AXRuntime                       0x0000000194fbf4b4 _XCopyMultipleAttributeValues + 392 (AccessibilityClientDefsServer.c:1354)
12  AXRuntime                       0x0000000194fd443c mshMIGPerform + 268 (MachServerHelper.c:447)
13  CoreFoundation                  0x000000018ab5d07c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56 (CFRunLoop.c:1937)
14  CoreFoundation                  0x000000018ab5c7a8 __CFRunLoopDoSource1 + 444 (CFRunLoop.c:2075)
15  CoreFoundation                  0x000000018ab5767c __CFRunLoopRun + 2168 (CFRunLoop.c:3098)
16  CoreFoundation                  0x000000018ab56adc CFRunLoopRunSpecific + 464 (CFRunLoop.c:3192)
17  GraphicsServices                0x0000000194adc328 GSEventRunModal + 104 (GSEvent.c:2246)
18  UIKitCore                       0x000000018ec51ae0 UIApplicationMain + 1936 (UIApplication.m:4773)
19  Runner                          0x0000000100666cec main + 96 (AppDelegate.swift:5)
20  libdyld.dylib                   0x000000018a9e0360 start + 4

We've tried to symbolicate the logs futher by following this guide https://github.com/flutter/flutter/wiki/Crashes . Using these steps:

  • Get our flutter engine revision
  • Download the right dSYM file for our version of the Flutter.framework
  • Try to symbolicate with:
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

cp -i /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/Resources/symbolicatecrash ./

symbolicatecrash 2020-01-11.crash Flutter.dSYM > symbolicated.crash

But it did not really improve, see changes in this gist

Any tips on where to start looking for the programming error that caused crashes like this. We're looking for both tips on debugging internal flutter crashes in general and this specific case.

Also, we're unable to reproduce this crash, since we don't know where to look.

Accordingly to your crash report VM Region Info: 0x3b3801090 is not in any region. The crash probably happens because some memory not allocated is being accessed... This could be happening because ___AXXMIGCopyMultipleAttributeValues_block_invoke is being called from outside the main thread (looks like according to the stack trace). But I don't know if you can debug the lib AXRuntime.

Have you tried to symbolicate the crash report with view logs window in xcode? (you must have an physical iphone X (iphone10) so the architecture doesn't get lost in the middle of the process... This page may help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM