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

14,900

Solution 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?

Solution 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)

Share:
14,900
user1274177
Author by

user1274177

Updated on July 30, 2022

Comments

  • user1274177
    user1274177 almost 2 years

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

  • manylegged
    manylegged almost 11 years
    malloc_history is installed and working for me, with xcode 4.6.3.
  • Walt Sellers
    Walt Sellers over 10 years
    when I looked at the linked page, it showed those commands as "available on Mac OS X only"
  • Shaun Budhram
    Shaun Budhram over 9 years
    For me, the first line had to be 'command script import lldb.macosx.heap', otherwise the console would report 'error: 'malloc_info' is not a valid command.' (Mac OS)
  • tinkl
    tinkl about 8 years
    (lldb) script import lldb.macosx.heap >>> "crashlog" and "save_crashlog" command installed, use the "--help" option for detailed help "malloc_info", "ptr_refs", "cstr_refs", "find_variable", and "objc_refs" commands have been installed, use the "--help" options on these commands for detailed help.
  • lwdthe1
    lwdthe1 over 7 years
    I'm not quite seeing the exact line. What might I be doing wrong?
  • Avishay Cohen
    Avishay Cohen over 7 years
    @lwdthe1 You can see in Xcode output the deallocated Class that the message was sent to - it would give you a hint regarding the deallocated instance.