问题描述
好的,我收到了一个应用程式的当机报告,但我发誓我100%感到困惑。
OK, SO I've received a crash report for one of my apps, but I swear I'm 100% confused.
这是核心它的一部分看起来像:
This is what the "core" part of it looks like :
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
VM Regions Near 0:
-->
__TEXT 0000000100000000-0000000100015000 [ 84K] r-x/rwx SM=COW /Applications/MY_APP/Contents/MacOS/MY_APP
Application Specific Information:
objc[337]: garbage collection is ON
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_c.dylib 0x00007fff90128650 strlen + 16
1 MY_BUNDLE_ID 0x0000000100008f12 0x100000000 + 36626
2 MY_BUNDLE_ID 0x000000010000b435 0x100000000 + 46133
3 MY_BUNDLE_ID 0x0000000100003c90 0x100000000 + 15504
4 com.apple.CoreFoundation 0x00007fff9065147a _CFXNotificationPost + 2554
5 com.apple.Foundation 0x00007fff8e5fe846 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
6 com.apple.AppKit 0x00007fff9a7894a7 -[NSTableView textDidChange:] + 377
7 com.apple.CoreFoundation 0x00007fff9065147a _CFXNotificationPost + 2554
8 com.apple.Foundation 0x00007fff8e5fe846 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
9 com.apple.AppKit 0x00007fff9a15c260 -[NSTextView(NSSharing) didChangeText] + 339
10 com.apple.AppKit 0x00007fff9a7f8381 _NSDoUserReplaceForCharRange + 390
11 com.apple.AppKit 0x00007fff9a7f85b1 _NSDoUserDeleteForCharRange + 38
12 com.apple.AppKit 0x00007fff9a7e1e72 -[NSTextView(NSKeyBindingCommands) deleteBackward:] + 440
13 com.apple.AppKit 0x00007fff9a18a1cc -[NSResponder doCommandBySelector:] + 75
14 com.apple.AppKit 0x00007fff9a18a02e -[NSTextView doCommandBySelector:] + 197
15 com.apple.AppKit 0x00007fff9a20cf4e -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCommand:forClient:] + 2200
16 com.apple.AppKit 0x00007fff9a20c3bb -[NSTextInputContext handleEvent:] + 939
17 com.apple.AppKit 0x00007fff9a20bf87 -[NSView interpretKeyEvents:] + 183
18 com.apple.AppKit 0x00007fff9a158f67 -[NSTextView keyDown:] + 723
19 com.apple.AppKit 0x00007fff9a374120 -[NSWindow sendEvent:] + 9687
20 com.apple.AppKit 0x00007fff9a36f744 -[NSApplication sendEvent:] + 5761
21 com.apple.AppKit 0x00007fff9a2852fa -[NSApplication run] + 636
22 com.apple.AppKit 0x00007fff9a229cb6 NSApplicationMain + 869
23 MY_BUNDLE_ID 0x0000000100002014 0x100000000 + 8212
你有什么想法可能会出错吗?
Do you have any idea what might be going wrong?Or could you just point me to the right direction?
作为一个旁白:
任何人都可以指导我如何做 0x00007fff90128650
更多...有意义,并使它(在某些未来的崩溃报告)也显示函数的名称?
Could anyone guide me how to make e.g. 0x00007fff90128650
more... meaningful and make it (in some future crash report) also show the name of the function?
推荐答案
你的崩溃日志给你很多信息:
首先你崩溃,因为你试图访问地址0到ur程序和内核不快乐。
Your crash log give you lot of informations: first you crashed because you tried to access to address 0 into ur program and kernel is not happy.
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
看到,你得到一个分割,按照它开始到0x00地址的方式,所以它就像你直接访问一个0 / nil指针。
像这样
See, you get a segmentation, by the way it's starting to the 0x00 address, so it's like you're directly accessing a 0 / nil pointer.Like this
char* adress = 0;
printf("get %p", adress); // will output 0x0
printf("get %p", adress[0]); // will make a EXC_BAD_ACCESS
你应该真正关注这个。
从崩溃堆栈有三个有趣的事情:
From the crash stack there is three interesting things:
6 com.apple.AppKit 0x00007fff9a7894a7 -[NSTableView textDidChange:] + 377
5 com.apple.Foundation 0x00007fff8e5fe846 -[NSNotificationCenter postNotificationName:object:userInfo:] + 64
0 libsystem_c.dylib 0x00007fff90128650 strlen + 16
[textDidChange]是导致崩溃的最后一个调用者之一,按照您在[textDidChange]触发时发送通知的方式。最后一行实际使崩溃:strlen + 16是因为有一些人认为它可以从有效的指针地址获得一个char长度,而实际上不是这样。
[textDidChange] is one of the last call who caused the crash, by the way you're sending a notification when the [textDidChange] is fired. And last line who actually make the crash: strlen + 16 is because there's something who think it can get a char length from a valid pointer address and it's actually not the case.
根据我,您应该检查发送到您的通知中的内容。
According to me, you should check what you're sending into your notification.
_NSDoUserReplaceForCharRange
_NSDoUserDeleteForCharRange
当你深入研究堆栈崩溃时,它看起来是当你进行细胞插入/删除ur tableViewController。
When you look deeply into the stack crash, it really seems that's it's appearing when you make cell - insertion / deletion into ur tableViewController. You should check that sometime someone push invalid data, or not using the edit cell the way it's supposed to be.
这里是简历:
1有人编辑一个tableViewCell,他没有插入或者代码不插入它应该是什么。
2您发送的通知中包含无效的数据。
3当strlen(invalid_dataStructure)被触发,它使得应用程序崩溃
So here's the resume:1 Someone edit a tableViewCell, he doesn't insert or code doesn't insert what it's supposed to be.2 You're sending a notification with a non-valid data inside it.3 When the strlen(invalid_dataStructure) is fired, it make ur app crash
顺便说一句,我只是猜,因为我不知道实际上你的代码实现。但我希望它可以给你很多的线索调试会话。
By the way i'm just "guessing", since i don't know actually your code implementation. But i hope it can give you lots of clues for your debugging session.
这篇关于遇到崩溃报告时遇到问题 - EXC_BAD_ACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!