1

我的 Mac OS X 应用程序随机崩溃,并且没有迹象表明我的代码中有错误。如何调试此类错误?我无法访问随机崩溃的用户计算机。

以下是崩溃日志的示例:

OS Version:      Mac OS X 10.8 (12A269)

Report Version:  10



Crashed Thread:  0  Dispatch queue: com.apple.main-thread



Exception Type:  EXC_BAD_ACCESS (SIGSEGV)

Exception Codes: KERN_INVALID_ADDRESS at 0x000000008fe00000



VM Regions Near 0x8fe00000:
MALLOC_SMALL           0000000082000000-0000000083800000 [ 24.0M] rw-/rwx SM=PRV  

__TEXT                 000000008fe05000-000000008fe38000 [  204K] r-x/rwx SM=COW  /usr/lib/dyld



Application Specific Information:

objc_msgSend() selector name: _absorbDeferredNeedsDisplayRegion





Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

0   libobjc.A.dylib                 0x994d3c0b objc_msgSend + 27

1   com.apple.AppKit                0x9502985f -[_NSDisplayOperationStack exitDisplayOperationForWindow:] + 602

2   com.apple.AppKit                0x95181f8b -[NSView(NSLayerKitGlue) _drawViewBackingLayer:inContext:drawingHandler:] + 2523

3   com.apple.AppKit                0x951814fe -[NSView(NSLayerKitGlue) drawLayer:inContext:] + 167

4   com.apple.QuartzCore            0x91fe2b6a -[CALayer drawInContext:] + 136

5   com.apple.QuartzCore            0x920e0b5f backing_callback(CGContext*, void*) + 88

6   com.apple.QuartzCore            0x91fe1bbd CABackingStoreUpdate_ + 3241

7   com.apple.QuartzCore            0x91fe0943 CA::Layer::display_() + 1369

8   com.apple.QuartzCore            0x91fe03e4 -[CALayer _display] + 20

9   com.apple.QuartzCore            0x91fe03c5 CA::Layer::display() + 221

10  com.apple.QuartzCore            0x91fe02e3 -[CALayer display] + 20

11  com.apple.QuartzCore            0x91fe020b CA::Layer::display_if_needed(CA::Transaction*) + 673

12  com.apple.QuartzCore            0x91fdfa84 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 38

13  com.apple.QuartzCore            0x91fd4cfa CA::Context::commit_transaction(CA::Transaction*) + 338

14  com.apple.QuartzCore            0x91fd4a70 CA::Transaction::commit() + 362

15  com.apple.QuartzCore            0x91fd487d CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 67

16  com.apple.CoreFoundation        0x98c7b51e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30

17  com.apple.CoreFoundation        0x98c7b45d __CFRunLoopDoObservers + 381

18  com.apple.CoreFoundation        0x98c54d85 CFRunLoopRunSpecific + 405

19  com.apple.CoreFoundation        0x98c54bdb CFRunLoopRunInMode + 123

20  com.apple.HIToolbox             0x9a0ef8aa RunCurrentEventLoopInMode + 242

21  com.apple.HIToolbox             0x9a0ef619 ReceiveNextEventCommon + 374

22  com.apple.HIToolbox             0x9a0ef494 BlockUntilNextEventMatchingListInMode + 88

23  com.apple.AppKit                0x94fefa5a _DPSNextEvent + 724

24  com.apple.AppKit                0x94fef28c -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 119

25  com.apple.AppKit                0x94fe56dc -[NSApplication run] + 855

26  com.apple.AppKit                0x94f888e6 NSApplicationMain + 1053

Thread 1:: Dispatch queue: com.apple.libdispatch-manager

0   libsystem_kernel.dylib          0x95af69ae kevent + 10

1   libdispatch.dylib               0x94e00cc5 _dispatch_mgr_invoke + 993

2   libdispatch.dylib               0x94e007fd _dispatch_mgr_thread + 53



Thread 2:: com.apple.CFSocket.private

0   libsystem_kernel.dylib          0x95af5be6 __select + 10

1   com.apple.CoreFoundation        0x98c99320 __CFSocketManager + 1632

2   libsystem_c.dylib               0x9918b557 _pthread_start + 344

3   libsystem_c.dylib               0x99175cee thread_start + 34



Thread 3:

0   libsystem_kernel.dylib          0x95af37d2 mach_msg_trap + 10

1   libsystem_kernel.dylib          0x95af2cb0 mach_msg + 68

2   com.apple.CoreFoundation        0x98c4fcc9 __CFRunLoopServiceMachPort + 185

3   com.apple.CoreFoundation        0x98c556af __CFRunLoopRun + 1247

4   com.apple.CoreFoundation        0x98c54d6a CFRunLoopRunSpecific + 378

5   com.apple.CoreFoundation        0x98c54bdb CFRunLoopRunInMode + 123

6   com.apple.Foundation            0x97b2ca86 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 278

7   com.apple.Foundation            0x97abe8f0 -[NSRunLoop(NSRunLoop) run] + 76

8   [cut by author]                0x003de1dd +[HTTPServer bonjourThread] + 173

9   com.apple.Foundation            0x97b27318 -[NSThread main] + 45

10  com.apple.Foundation            0x97b2729b __NSThread__main__ + 1396

11  libsystem_c.dylib               0x9918b557 _pthread_start + 344

12  libsystem_c.dylib               0x99175cee thread_start + 34



Thread 4:: com.apple.NSURLConnectionLoader

0   libsystem_kernel.dylib          0x95af37d2 mach_msg_trap + 10

1   libsystem_kernel.dylib          0x95af2cb0 mach_msg + 68

2   com.apple.CoreFoundation        0x98c4fcc9 __CFRunLoopServiceMachPort + 185

3   com.apple.CoreFoundation        0x98c556af __CFRunLoopRun + 1247

4   com.apple.CoreFoundation        0x98c54d6a CFRunLoopRunSpecific + 378

5   com.apple.CoreFoundation        0x98c54bdb CFRunLoopRunInMode + 123

6   com.apple.Foundation            0x97ac329a +[NSURLConnection(Loader) _resourceLoadLoop:] + 395

7   com.apple.Foundation            0x97b27318 -[NSThread main] + 45

8   com.apple.Foundation            0x97b2729b __NSThread__main__ + 1396

9   libsystem_c.dylib               0x9918b557 _pthread_start + 344

10  libsystem_c.dylib               0x99175cee thread_start + 34



Thread 5:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 6:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 7:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 8:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 9:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 10:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 11:

0   libsystem_kernel.dylib          0x95af60ee __workq_kernreturn + 10

1   libsystem_c.dylib               0x9918e04c _pthread_workq_return + 45

2   libsystem_c.dylib               0x9918de19 _pthread_wqthread + 448

3   libsystem_c.dylib               0x99175cca start_wqthread + 30



Thread 0 crashed with X86 Thread State (32-bit):

  eax: 0x818950b0  ebx: 0xac76a5d8  ecx: 0x9592966f  edx: 0x90000000

  edi: 0x8fe00000  esi: 0x00000000  ebp: 0xbfff8c88  esp: 0xbfff8c54

   ss: 0x00000023  efl: 0x00010282  eip: 0x994d3c0b   cs: 0x0000001b

   ds: 0x00000023   es: 0x00000023   fs: 0x00000000   gs: 0x0000000f

  cr2: 0x8fe00000

Logical CPU: 2
4

1 回答 1

1
  1. 启用 NSZombie (Product->Edit Scheme->Diagnostics)
  2. 添加异常断点(Cmd-6,然后按左下角的+按钮)

之后你应该有更好的堆栈跟踪

于 2012-10-02T19:56:29.617 回答