崩溃报告未显示后台线程中崩溃的代码行

时间:2017-04-06 06:20:54

标签: ios xcode crash-reports

我正在学习如何分析崩溃报告。我故意在我的swift应用程序代码中添加错误并查看生成的崩溃报告。当错误出现在后台异步线程中运行的代码块中时,崩溃报告不会识别崩溃的代码行号。

是否可以从崩溃中获取此行号?

以下是崩溃报告的一部分:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001020791fc
Triggered by Thread:  5

Filtered syslog:
None found

Global Trace Buffer (reverse chronological seconds):
2.965970     AppleJPEG                  0x000000018300e26c [0x13e05f000] Created session



Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   QuartzCore                      0x00000001840921f4 slab_alloc + 392
1   QuartzCore                      0x0000000184092058 magazine_alloc_ + 304
2   QuartzCore                      0x0000000184092058 magazine_alloc_ + 304
3   QuartzCore                      0x000000018408eee8 x_mem_alloc_bucket + 144
4   QuartzCore                      0x000000018408eb94 CA::AttrList::set(unsigned int, _CAValueType, void const*) + 160
5   QuartzCore                      0x0000000184092398 CA::Layer::setter(unsigned int, _CAValueType, void const*) + 208
6   QuartzCore                      0x0000000184099ec4 -[CALayer setOpacity:] + 48
7   UIKit                           0x00000001869a7678 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke_2 + 1072
8   UIKit                           0x000000018671b5b4 +[UIView(Animation) performWithoutAnimation:] + 80
9   UIKit                           0x00000001869068d4 __53-[_UINavigationParallaxTransition animateTransition:]_block_invoke + 260
10  UIKit                           0x0000000186a26334 +[UIView(Internal) _performBlockDelayingTriggeringResponderEvents:] + 220
11  UIKit                           0x000000018690644c -[_UINavigationParallaxTransition animateTransition:] + 1060
12  UIKit                           0x00000001868c0818 -[UINavigationController _startCustomTransition:] + 3544
13  UIKit                           0x00000001867cbe40 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688
14  UIKit                           0x00000001867cbb1c -[UINavigationController __viewWillLayoutSubviews] + 60
15  UIKit                           0x00000001867cba84 -[UILayoutContainerView layoutSubviews] + 208
16  UIKit                           0x00000001867081e4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 656
17  QuartzCore                      0x000000018409a994 -[CALayer layoutSublayers] + 148
18  QuartzCore                      0x00000001840955d0 CA::Layer::layout_if_needed(CA::Transaction*) + 292
19  QuartzCore                      0x0000000184095490 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
20  QuartzCore                      0x0000000184094ac0 CA::Context::commit_transaction(CA::Transaction*) + 252
21  QuartzCore                      0x0000000184094820 CA::Transaction::commit() + 500
22  QuartzCore                      0x000000018408dde4 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 80
23  CoreFoundation                  0x0000000181564728 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
24  CoreFoundation                  0x00000001815624cc __CFRunLoopDoObservers + 372
25  CoreFoundation                  0x00000001815628fc __CFRunLoopRun + 928
26  CoreFoundation                  0x000000018148cc50 CFRunLoopRunSpecific + 384
27  GraphicsServices                0x0000000182d74088 GSEventRunModal + 180
28  UIKit                           0x0000000186776088 UIApplicationMain + 204
29  MargRiver                       0x00000001000fc378 main (AppDelegate.swift:27)
30  libdyld.dylib                   0x000000018102a8b8 start + 4

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x00000001811494d8 kevent_qos + 8
1   libdispatch.dylib               0x000000018100c7d8 _dispatch_mgr_invoke + 232
2   libdispatch.dylib               0x0000000180ffb648 _dispatch_source_invoke + 0

Thread 2:
0   libsystem_kernel.dylib          0x0000000181148b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000181211530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000181211020 start_wqthread + 4

Thread 3:
0   libsystem_kernel.dylib          0x0000000181148b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000181211530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000181211020 start_wqthread + 4

Thread 4:
0   libsystem_kernel.dylib          0x0000000181148b48 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000181211530 _pthread_wqthread + 1284
2   libsystem_pthread.dylib         0x0000000181211020 start_wqthread + 4

Thread 5 name:  Dispatch queue: com.apple.root.background-qos
Thread 5 Crashed:
0   libswiftCore.dylib              0x00000001020791fc 0x101f38000 + 1315324
1   libswiftCore.dylib              0x00000001020791fc 0x101f38000 + 1315324
2   MargRiver                       0x00000001000ea908 EntriesListController.(loadEntries(completion : () -> ()?) -> ()).(closure #1) (EntriesListController.swift:0)
3   MargRiver                       0x00000001000ae798 thunk (MoreViewController.swift:0)
4   libdispatch.dylib               0x0000000180ff94bc _dispatch_call_block_and_release + 24
5   libdispatch.dylib               0x0000000180ff947c _dispatch_client_callout + 16
6   libdispatch.dylib               0x0000000181007914 _dispatch_root_queue_drain + 2140
7   libdispatch.dylib               0x00000001810070b0 _dispatch_worker_thread3 + 112
8   libsystem_pthread.dylib         0x0000000181211470 _pthread_wqthread + 1092
9   libsystem_pthread.dylib         0x0000000181211020 start_wqthread + 4

Thread 5 crashed with ARM Thread State (64-bit):
    x0: 0x00000001028d1400   x1: 0x000000018120a8f4   x2: 0x000000013d512300   x3: 0x0000000000000008
    x4: 0x0000000000000000   x5: 0x0000000000000010   x6: 0x0000000000000000   x7: 0x0000000000000fa0
    x8: 0x00000001028d1408   x9: 0x0000000000001000  x10: 0x000000013d514000  x11: 0x0000000000000fff
   x12: 0x000000013d510000  x13: 0x0000000000003fff  x14: 0xffffffffffffc000  x15: 0x0000000000003fff
   x16: 0x0000000181174168  x17: 0x000000010215c048  x18: 0x0000000000000000  x19: 0x0000000000000000
   x20: 0x0000000000000002  x21: 0x0000000000000039  x22: 0x0000000100727500  x23: 0x0000000000000002
   x24: 0x000000000000000b  x25: 0x000000010072753a  x26: 0x000000016e2470e0  x27: 0x000000016e2470e0
   x28: 0x0000000000000000  fp: 0x000000016e246720   lr: 0x00000001020791fc
    sp: 0x000000016e2466e0   pc: 0x00000001020791fc cpsr: 0x20000000

这是loadEntries()函数的开头:

fileprivate func loadEntries(completion: (() -> Void)?) -> Void {
    let timeStartDb = Date()
    var timeEndDb: Date!
    var sqlStatement: String!
    var newEntries = [Entry]()
    var newSelectedSegment = false // true => the selected segment control button is different from last time loadEntries() was called

    DispatchQueue.global(qos: .background).async {

        if (self.listOrderSegControl.selectedSegmentIndex != self.previousSelectedSegmentIndex) {
           newSelectedSegment = true
           self.previousSelectedSegmentIndex = self.listOrderSegControl.selectedSegmentIndex
        }

        switch (self.listOrderSegControl.selectedSegmentIndex) {
        case EntriesListController.LIST_ORDER_DISTANCE:
            sqlStatement = self.sqlSubStatement + self.distanceSortOrder
        case EntriesListController.LIST_ORDER_AZ:
            sqlStatement = self.sqlSubStatement + "title"
        case EntriesListController.LIST_ORDER_RECOMMENDED:
            sqlStatement = self.sqlSubStatement + "prio"
        default:
            sqlStatement = self.sqlSubStatement + "prio"
            self.previousSelectedSegmentIndex = EntriesListController.LIST_ORDER_RECOMMENDED
        }

代码在switch语句中崩溃,因为self.sqlSubStatement = nil。正如我上面提到的,我故意添加了这个bug,以便学习如何使用崩溃报告。然而,崩溃报告没有识别出包含该错误的代码行。是否可以识别它?

0 个答案:

没有答案