SIGSEGV崩溃,没有任何直接跟踪我的应用程序的代码

时间:2015-09-30 05:52:26

标签: objective-c macos crash nswindow sigsegv

我的某个应用的几个用户发生了随机崩溃。崩溃日志不包含对我自己编写的方法的任何引用,因此很难阅读。崩溃也很难重现,所以我不能使用NSZombieEnabled这样的工具来获取更多信息。

基于崩溃报告(见下文)我假设这是因为我的应用程序的NSWindow对象被请求(或通知)以动画方式调整大小(因此,计时器和延迟信息)但是有一个按钮(NSButton)这导致了一个问题(可能是因为我有一个SIGSEGV而被解除分配)。但是,我不明白为什么原因是“在当前参数寄存器中找到选择器名称:methodForSelector:”。

您是否可以从此崩溃日志中了解更多有用信息,以便了解导致此问题的原因?

Exception Type:  SIGSEGV
Exception Codes: SEGV_MAPERR at 0x295eeda4bec0
Crashed Thread:  0

Application Specific Information:
Selector name found in current argument registers: methodForSelector:

Thread 0 Crashed:
0   libobjc.A.dylib     0x00007fff848c70dd objc_msgSend + 29
1   AppKit              0x00007fff833a6aef safeARCWeaklyStore + 113
2   AppKit              0x00007fff833b2a5b -[NSActionCell setTarget:] + 99
3   AppKit              0x00007fff83610de1 -[NSActionCell copyWithZone:] + 285
4   AppKit              0x00007fff83611157 -[NSButtonCell copyWithZone:] + 98
5   AppKit              0x00007fff8360f81b -[NSButton baselineOffsetFromBottom] + 370
6   AppKit              0x00007fff835289c6 -[NSView(NSConstraintBasedLayout) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:] + 750
7   Foundation          0x00007fff8b86f003 lower_1_attribute + 157
8   Foundation          0x00007fff8b86e9e6 -[NSLayoutConstraint _lowerIntoExpression:reportingConstantIsRounded:] + 101
9   Foundation          0x00007fff8b86e686 -[NSLayoutConstraint _containerGeometryDidChange] + 87
10  AppKit              0x00007fff8341b8c6 _NSViewEnumerateConstraints + 252
11  AppKit              0x00007fff8352854b __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 322
12  Foundation          0x00007fff8b86e48e -[NSISEngine withBehaviors:performModifications:] + 154
13  AppKit              0x00007fff833ca1aa -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 69
14  AppKit              0x00007fff835283e8 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 481
15  AppKit              0x00007fff83401bcf -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 232
16  AppKit              0x00007fff835284e0 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 215
17  Foundation          0x00007fff8b86e48e -[NSISEngine withBehaviors:performModifications:] + 154
18  AppKit              0x00007fff833ca1aa -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 69
19  AppKit              0x00007fff835283e8 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 481
20  AppKit              0x00007fff83401bcf -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 232
21  AppKit              0x00007fff835284e0 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 215
22  Foundation          0x00007fff8b86e48e -[NSISEngine withBehaviors:performModifications:] + 154
23  AppKit              0x00007fff833ca1aa -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 69
24  AppKit              0x00007fff835283e8 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 481
25  AppKit              0x00007fff83401bcf -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 232
26  AppKit              0x00007fff835284e0 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke_2 + 215
27  Foundation          0x00007fff8b86e48e -[NSISEngine withBehaviors:performModifications:] + 154
28  AppKit              0x00007fff833ca1aa -[NSView(NSConstraintBasedLayout) _withAutomaticEngineOptimizationDisabled:] + 69
29  AppKit              0x00007fff835283e8 __52-[NSView(NSConstraintBasedLayout) _setLayoutEngine:]_block_invoke + 481
30  AppKit              0x00007fff83401bcf -[NSView(NSConstraintBasedLayout) _setLayoutEngine:] + 232
31  AppKit              0x00007fff835281df make_and_host_engine + 248
32  AppKit              0x00007fff83ced3ce -[NSView(NSConstraintBasedLayout) _rebuildLayoutFromScratch] + 134
33  AppKit              0x00007fff83b6fd91 -[NSWindow _setWindowResolution:displayIfChanged:] + 279
34  AppKit              0x00007fff83739361 -[NSWindow _updateInheritedBackingScaleFactorAndDisplayIfChanged:] + 131
35  AppKit              0x00007fff83609237 __67-[NSWindow _updateSettingsSendingScreenChangeNotificationIfNeeded:]_block_invoke + 193
36  AppKit              0x00007fff83482bdb NSPerformWithScreenUpdatesDisabled + 64
37  AppKit              0x00007fff8346c4c6 -[NSWindow _updateSettingsSendingScreenChangeNotificationIfNeeded:] + 365
38  AppKit              0x00007fff83469b54 -[NSWindow _setFrame:updateBorderViewSize:] + 1098
39  AppKit              0x00007fff8346912c -[NSWindow _oldPlaceWindow:] + 1117
40  AppKit              0x00007fff8346851d -[NSWindow _setFrameCommon:display:stashSize:] + 2561
41  AppKit              0x00007fff83560be3 -[NSWindow setValue:forKey:] + 180
42  Foundation          0x00007fff8b84f9d1 -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 338
43  AppKit              0x00007fff8365c926 _NSStopAnimation + 98
44  AppKit              0x00007fff8365c1fb __40+[NSAnimationManager performAnimations:]_block_invoke_2 + 756
45  AppKit              0x00007fff83482bdb NSPerformWithScreenUpdatesDisabled + 64
46  AppKit              0x00007fff8365beff __40+[NSAnimationManager performAnimations:]_block_invoke + 129
47  AppKit              0x00007fff8365ba66 +[NSAnimationManager performAnimations:] + 1155
48  AppKit              0x00007fff8358cbf6 -[NSScreenDisplayLink _fire] + 398
49  CoreFoundation      0x00007fff8d76b2e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
50  CoreFoundation      0x00007fff8d76af73 __CFRunLoopDoTimer + 1058
51  CoreFoundation      0x00007fff8d7de53d __CFRunLoopDoTimers + 300
52  CoreFoundation      0x00007fff8d726608 __CFRunLoopRun + 2023
53  CoreFoundation      0x00007fff8d725bd8 CFRunLoopRunSpecific + 295
54  HIToolbox           0x00007fff8fc4356f RunCurrentEventLoopInMode + 234
55  HIToolbox           0x00007fff8fc432ea ReceiveNextEventCommon + 430
56  HIToolbox           0x00007fff8fc4312b _BlockUntilNextEventMatchingListInModeWithFilter + 70
57  AppKit              0x00007fff834278ab _DPSNextEvent + 977
58  AppKit              0x00007fff83426e58 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 345
59  AppKit              0x00007fff8341caf3 -[NSApplication run] + 593
60  AppKit              0x00007fff83399244 NSApplicationMain + 1831
61  libdyld.dylib       0x00007fff891e25c9 start + 0

Thread 0 crashed with X86-64 Thread State:
rip: 0x00007fff848c70dd    rbp: 0x00007fff57ac7fd0    rsp: 0x00007fff57ac7f98    rax: 0x0000000000000001 
rbx: 0x00007fff83d68df7    rcx: 0x00007fff833a7973    rdx: 0x00007fff83d68df7    rdi: 0x000060000011a820 
rsi: 0x00007fff83d66b5c     r8: 0x0000000000000000     r9: 0xffffffffffffffff    r10: 0x00007fff83d66b5c 
r11: 0x0000295eeda4bea8    r12: 0x000060000011a820    r13: 0x00007fff848c70c0    r14: 0x00006000002e2d28 
r15: 0x0000000000000000 rflags: 0x0000000000010202     cs: 0x000000000000002b     fs: 0x0000000000000000 
gs: 0x0000000000000000 

谢谢!

2 个答案:

答案 0 :(得分:1)

Xcode 6+有一个很棒的功能,可以列出用户崩溃并在你的iphone或模拟器中重新模拟它们来检查它...希望它有助于你或者你必须以艰难的方式去追踪它们的去除"去神秘化& #34;

http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs

https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AnalyzingCrashReports/AnalyzingCrashReports.html

答案 1 :(得分:0)

我不是专家,但这是我的猜测......

-[NSWindow _updateInheritedBackingScaleFactorAndDisplayIfChanged:]

...也许屏幕分辨率刚刚改变了?例如,用户在“系统偏好设置”中进行了更改>显示,或者可能将应用程序的窗口从非视网膜拖到视网膜显示器上?

Selector name found in current argument registers: methodForSelector:

Thread 0 Crashed:
objc_msgSend
safeARCWeaklyStore
-[NSActionCell setTarget:]
-[NSActionCell copyWithZone:]
-[NSButtonCell copyWithZone:]
-[NSButton baselineOffsetFromBottom]
-[NSView(NSConstraintBasedLayout) nsli_lowerAttribute:intoExpression:withCoefficient:forConstraint:]

...自动布局重新计算布局,并在应用中向NSButton询问了baselineOffsetFromBottom。这导致按钮要求NSButtonCell的副本(我不知道为什么)。在制作副本时,NSButtonCell尝试设置副本的target,但此处存在问题。也许是使用methodForSelector:来读取目标地址以便将其写入副本?

你是否有可能没有设定目标的NSButton?或者它被声明为weak,而strong在这里是必要的吗?

我希望大部分都是错的,但也许这有助于思考过程......祝你好运......