Exploring RAM contents

I would like to explore the contents of the RAM my application is using? I would like to see if I can find that string I allocated. Any suggestions to print out the entire contents of my application's memory to the terminal?


Solution 1:

To find the C string ”FooBar” in your heap:

  1. $ lldb PathToYourAppBundle/Contents/MacOS/YourAppName
  2. (lldb) command script import lldb.macosx.heap
  3. (lldb) r
  4. Pause execution with ControlC.
  5. (lldb) cstr_refs -m FooBar