开发者

Interpreting a Crash Log Objective C

I'm trying to interpret this crash log below, but I'm not sure if I understand it correctly. objc_msgSend() means that I'm sending a message to something that's already dealloced. So basically the data source disappears before the tableview can draw its cells?

How can I find the cause of this problem? I've tried using the atos tool to find the location of the crash by the hex it returns, but no avail.

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000020
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
objc_msgSend() selector name: tableView:objectValueForTableColumn:row:


Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x93f89ed7 objc_msgSend + 23
1   com.apple.AppKit                0x936143ea -[NSTableView preparedCellAtColumn:row:] + 335
2   com.apple.AppKit                0x9362e8bc -[NSTableView _drawContentsAtRow:column:withCellFrame:] + 56
3   com.apple.AppKit                0x9362d92a -[NSTableView drawRow:clipRect:] + 1131
4   com.apple.AppKit                0x9362d362 -[NSTableView drawRowIndexes:clipRect:] + 360
5   com.apple.AppKit                0x9362bd3b -[NSTableView drawRect:] + 1144
6   com.apple.AppKit                0x936218fd -[NSView _drawRect:clip:] + 3721
7   com.apple.AppKit                0x9361efc9 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 2217
8   com.apple.AppKit                0x9361f95c -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
9   com.apple.AppKit                0x9361f95c -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
10  com.apple.AppKit                0x9361f95c -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity开发者_如何学Go:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
11  com.apple.AppKit                0x9361f95c -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 4668
12  com.apple.AppKit                0x9361e55b -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 265
13  com.apple.AppKit                0x9361aea2 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 3309
14  com.apple.AppKit                0x9357ba57 -[NSView displayIfNeeded] + 818
15  com.apple.AppKit                0x93544d40 -[NSWindow displayIfNeeded] + 204
16  com.apple.AppKit                0x9357628a _handleWindowNeedsDisplay + 696
17  com.apple.CoreFoundation        0x94f0ae02 __CFRunLoopDoObservers + 1186
18  com.apple.CoreFoundation        0x94ec6d8d __CFRunLoopRun + 557
19  com.apple.CoreFoundation        0x94ec6464 CFRunLoopRunSpecific + 452
20  com.apple.CoreFoundation        0x94ec6291 CFRunLoopRunInMode + 97
21  com.apple.HIToolbox             0x94188004 RunCurrentEventLoopInMode + 392
22  com.apple.HIToolbox             0x94187cf7 ReceiveNextEventCommon + 158
23  com.apple.HIToolbox             0x94187c40 BlockUntilNextEventMatchingListInMode + 81
24  com.apple.AppKit                0x9354c78d _DPSNextEvent + 847
25  com.apple.AppKit                0x9354bfce -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
26  com.apple.AppKit                0x9350e247 -[NSApplication run] + 821
27  com.apple.AppKit                0x935062d9 NSApplicationMain + 574
28  ...yapp.com 0x00003032 0x1000 + 8242


Greg Parker is an engineer fir the Objective-C runtime. His blog post on interpreting crashes in objc_msgSend is essentially the definitive source: http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html.

Short answer: you have a memory corrupting bug.


This is the classic symptom of a memory management error. NSTableView is attempting to access some piece of data (perhaps an object value or an item or something?) that has been deallocated, but that the tableview still references.

There are a couple ways to solve this:

  • Run the static analyzer on your code. This will find any obvious leaks
  • Run your code using Instruments, specifically with the Zombies tool turned on. That will keep track of when you try to send a message to an object that's already been deallocated. It will also include tons of useful information, like when and where the object was created, when and where it was retained, released, and autoreleased, and finally where it was deallocated.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜