LLDB equivalent to GDB's “info malloc-history <address>” command?

社会主义新天地 提交于 2019-11-27 09:21:59

问题


I am trying to resolve a "message sent to deallocated instance " error in iOS.


回答1:


See the LLDB-GDB command map (http://lldb.llvm.org/lldb-gdb.html) - you have to import a script, and the command is named malloc_info now. Obviously, malloc stack logging still needs to be turned on in the scheme options.

(lldb) script import lldb.macosx.heap
(lldb) malloc_info --stack-history 0x10010d680

Unfortunately, it doesn't show dealloc's - didn't GDBs malloc-history show that as well?




回答2:


Use instruments, you'll get the exact line -

(In XCode) Run it through "Product" -> "Profile".

This will start Instruments, there you should choose "Zombies" and reproduce the bug event.

You'l get a pop-up once a zombie is called, press the chevron to see the exact line.

Problem is usually a bad __bridge (optional bridges __brige_retained / __bridge_transfer / __bridge)




回答3:


You used to be able to use the malloc_history command-line tool from a shell and give it the process ID and address of interest. It appears this command is no longer installed by the latest Xcode's command line tools. :-(



来源:https://stackoverflow.com/questions/9738994/lldb-equivalent-to-gdbs-info-malloc-history-address-command

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!