如何在LLDB下排查message sent to deallocated instance问题
2015-07-09 19:23
531 查看
如何在LLDB下排查message sent to deallocated instance问题
热度 2已有 5742 次阅读 2013-5-1611:33 |系统分类:移动互联网
在XCode的以前版本中,如果遇到了
[代码]c#/cpp/oc代码:
1 | message sent to deallocated instance 0x6d564f0 |
在新的XCode里,调试器默认使用LLDB,我就讲一下如何在LLDB状态下定位到由于内存操作不当引起的Crash
首先我有一段会发生崩溃的代码:
[代码]c#/cpp/oc代码:
1 | NSString *themePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:themePathTmp]; |
2 | if (themePath) |
3 | self.backgroundIV.image = [UIImage imageWithContentsOfFile:[themePath stringByAppendingPathComponent: @"mask_1.png" ]]; |
4 |
5 | [themePath release]; |
运行代码,出现下面的崩溃现象
下面我们打开“活动监视器”,找到我们对应的PID,我们的Target为HPThemeManager,只要找到HPThemeManager对应的PID就可以(HPThemeManager是在论坛里下载的,本来正在看代码,就直接拿他来作试验了)
现在,我们得到了两个主要的信息:
进程ID:50127
崩溃地址:0x6d564f0
我们打开终端,输入以下命令:
[代码]c#/cpp/oc代码:
1 | sudo malloc_history 50127 0x6d564f0 |
这样我们用能定位到这行代码
[代码]c#/cpp/oc代码:
1 | NSString *themePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:themePathTmp]; |
[代码]c#/cpp/oc代码:
1 | [themePath release]; |
相关文章推荐
- Access to SQLserver 数据库生迁脚本编写器(DB_CreateSqlEV1.06下载)
- WMA To MP3 Encoder6.15绿色版含注册文件 下载
- C# LINQ to XML应用介绍
- Linq to SQL Delete时遇到问题的解决方法
- How to Auto Include a Javascript File
- Easy RM RMVB to DVD Burner v1.3.8 汉化版 下载 附注册码
- MySQL错误ERROR 2002 (HY000): Can't connect to local MySQL server through socket
- android的消息处理机制(图文+源码分析)―Looper/Handler/Message
- apache You don't have permission to access /test.php on this server解决方法
- Nginx出现The plain HTTP request was sent to HTTPS port问题解决方法
- Unable to instantiate default tuplizer [org.hib...
- Auto Layout on iOS Versions prior to 6.0 解决办法
- EJB3.0 JBoss的JMS实例
- Ora2Pg安装配置
- IBM WebSphere MQ介绍安装以及配置服务详解
- start: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart:
- vsftpd: refusing to run with writable root inside chroot()
- How to create a simple rubics cube
- CentOS网络启动错误
- Failed to start component [StandardEngine[Catalin