如何在LLDB下排查message sent to deallocated instance问题
来源:互联网 发布:腾飞中国龙美工教案 编辑:程序博客网 时间:2024/04/30 13:18
转载:http://www.devdiv.com/home.php?mod=space&uid=50901&do=blog&id=50856
谁实话,找了好久,好兴奋。
在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];
对themePath进行排查,就找到了崩溃的罪魁祸首
[代码]c#/cpp/oc代码:
1
[themePath release];
0 1
- 在LLDB下排查message sent to deallocated instance问题
- 如何在LLDB下排查message sent to deallocated instance问题
- 如何在LLDB下排查message sent to deallocated instance问题
- 如何在LLDB下排查message sent to deallocated instance问题
- 如何在LLDB下排查message sent to deallocated instance问题
- 如何在LLDB下排查message sent to deallocated instance问题
- 排查message sent to deallocated instance问题
- 如何调试 message sent to deallocated instance 的问题
- 解决LLDB模式下出现message sent to deallocated instance错误
- message sent to deallocated instance问题的解决方法(gdb和lldb)
- message sent to deallocated instance问题的解决方法(gdb和lldb)
- Xcode做ios开发时 message sent to deallocated instance问题的解决方法(gdb和lldb)
- Xcode做ios开发时 message sent to deallocated instance问题的解决方法(gdb和lldb)
- message sent to deallocated instance问题的解决方法(gdb和lldb)
- message sent to deallocated instance问题的解决方法(gdb和lldb)
- Xcode做ios开发时 message sent to deallocated instance问题的解决方法(gdb和lldb)
- message sent to deallocated instance 0x7f9a6d85dca0 错误的排查
- message sent to deallocated instance
- Nginx的Rewrite配置
- 使用 Ant 打包 Android 应用
- A book list for CS students(general)
- ios第三方库3
- 电脑中的照片丢了如何找回
- 如何在LLDB下排查message sent to deallocated instance问题
- Object-C 结构体学习
- maven学习3:编写maven插件
- C++中struct和class的区别
- DataFormatString
- Android操作HTTP实现与服务器通信
- Typecho安装在根目录下与子目录的区别
- 风电场管理程序漏洞警告
- 手把手教你ARC——iOS/Mac开发ARC入门和使用