Inspect the return value of a function in lldb

Answer is wrong so I will post correct one.

To inspect return value you need to (lldb) finish (abbr. for thread step-out) from function which return value you want to examine and then use:

(lldb) thread info

This will give you output similar to this:

thread #1: tid = 0x28955, (frame variables  and stuff), stop reason = step out
Return value: (NSMenu *) $3 = 0x0000600000065280

Having this you can just:

(lldb) po $3

Note that gdb way of inspecting return value by just using finish doesn't print anything for lldb.

Additionally as SFeng pointed out if you use Xcode you can just see it in UI inspector after you stepped out from previous function or method.


Step out of the function, and see return value in inspector. Here is my screenshot:

enter image description here

See article for more details: https://gist.github.com/schwa/7812916