Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xcode

ios

lldb

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

like image 658
user1274177 Avatar asked Mar 16 '12 14:03

user1274177


2 Answers

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?

like image 106
karstux Avatar answered Nov 01 '22 11:11

karstux


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)

like image 2
Avishay Cohen Avatar answered Nov 01 '22 11:11

Avishay Cohen