调试SIGSEGV崩溃

时间:2012-10-20 03:38:39

标签: objective-c ios crash sigsegv

用户一直在报告我很难复制的SIGSEGV崩溃 - 它经常发生在他们身上,但我从来没有能够重现它。从阅读其他StackOverflow帖子,我知道我应该打开NSZombies找到僵尸对象,但无论我在仪器中做什么我都不能让任何僵尸出现。

请注意,我正在使用ARC。

任何人都可以从这两个崩溃报告中找到任何意义,所以我至少知道从哪里开始寻找僵尸?有没有人有关于如何让僵尸出现在乐器中的任何提示?谢谢!

崩溃报告#1:

0 MyApp 0x000e4972 testflight_backtrace + 238
1 MyApp 0x000e565c TFSignalHandler + 264
2 libsystem_c.dylib 0x31cd37ec _sigtramp + 48
3 UIKit 0x33e47bde -[UIViewController unloadViewForced:] + 250
4 UIKit 0x33f8f498 -[UIViewController purgeMemoryForReason:] + 64
5 Foundation 0x37f264fe __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 18
6 CoreFoundation 0x376c8546 ___CFXNotificationPost_block_invoke_0 + 70
7 CoreFoundation 0x37654096 _CFXNotificationPost + 1406
8 Foundation 0x37e9a3ea -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
9 Foundation 0x37e9bc1a -[NSNotificationCenter postNotificationName:object:] + 30
10 UIKit 0x33f5a270 -[UIApplication _performMemoryWarning] + 80
11 UIKit 0x33f5a36a -[UIApplication _receivedMemoryNotification] + 174
12 libdispatch.dylib 0x349572e0 _dispatch_source_invoke + 516
13 libdispatch.dylib 0x34954b80 _dispatch_queue_invoke$VARIANT$mp + 52
14 libdispatch.dylib 0x34954ec0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 156
15 CoreFoundation 0x376cf2ac __CFRunLoopRun + 1268
16 CoreFoundation 0x376524a4 CFRunLoopRunSpecific + 300
17 CoreFoundation 0x3765236c CFRunLoopRunInMode + 104
18 GraphicsServices 0x3255f438 GSEventRunModal + 136
19 UIKit 0x33dd6e7c UIApplicationMain + 1080
20 MyApp 0x0001b65e main (main.m:16)
21 MyApp 0x000115af start + 39

崩溃报告#2:

0 MyApp 0x0018e972 testflight_backtrace + 238
1 MyApp 0x0018f65c TFSignalHandler + 264
2 libsystem_c.dylib 0x31d067ec _sigtramp + 48
3 UIKit 0x33e7abde -[UIViewController unloadViewForced:] + 250
4 UIKit 0x33fc2498 -[UIViewController purgeMemoryForReason:] + 64
5 MyApp 0x000ec988 -[MyTableController didReceiveMemoryWarning] (MyTableController.m:129)
6 MyApp 0x0010a8a8 -[FeaturedViewController didReceiveMemoryWarning] (FeaturedViewController.m:65)
7 Foundation 0x37f594fe __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_0 + 18
8 CoreFoundation 0x376fb546 ___CFXNotificationPost_block_invoke_0 + 70
9 CoreFoundation 0x37687096 _CFXNotificationPost + 1406
10 Foundation 0x37ecd3ea -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
11 Foundation 0x37ecec1a -[NSNotificationCenter postNotificationName:object:] + 30
12 UIKit 0x33f8d270 -[UIApplication _performMemoryWarning] + 80
13 UIKit 0x33f8d36a -[UIApplication _receivedMemoryNotification] + 174
14 libdispatch.dylib 0x3498a2e0 _dispatch_source_invoke + 516
15 libdispatch.dylib 0x34987b80 _dispatch_queue_invoke$VARIANT$mp + 52
16 libdispatch.dylib 0x34987ec0 _dispatch_main_queue_callback_4CF$VARIANT$mp + 156
17 CoreFoundation 0x377022ac __CFRunLoopRun + 1268
18 CoreFoundation 0x376854a4 CFRunLoopRunSpecific + 300
19 CoreFoundation 0x3768536c CFRunLoopRunInMode + 104
20 GraphicsServices 0x32592438 GSEventRunModal + 136
21 UIKit 0x33e09e7c UIApplicationMain + 1080
22 MyApp 0x000c565e main (main.m:16)
23 MyApp 0x000bb5af start + 39

1 个答案:

答案 0 :(得分:2)

当您的应用收到内存警告时,看起来某些内容出错了。您可以使用调试菜单在模拟器上强制执行此操作,或者通过发送(非法生产代码)_performMemoryWarning方法在设备上强制执行此操作:

[[UIApplication sharedApplication] _performMemoryWarning];

您可以将其放在重复计时器上以定期发送警告。我建议将其包装在#IFDEF DEBUG中,以防止它投入生产。

这不会解决您的问题,但它可以帮助您重现崩溃,这是至关重要的第一步。