How can I manually create a core dump (or equivalent) in lldb connected to iOS

Sometimes I try to find a very rare error in an iOS application. I hit it in the debugger after several hours, trying to play just to have xcode or lldb crash on me while I am debugging (usually if I go through C ++ code). This is more than enraging.

With gdb, you can use generate-core-dump to create the main dump of the file so that I can reload it into gdb and at least look at all the memory. What I want is the ability to do something similar in lldb, so that when xcode crashes (as is always the case at worst), I can restore the debugging session without having to crash again.

The app runs on a non-jailbroken iPhone, so I don't have much access to the OS to do something like a memory dump.

One possible answer is simply to use gdb instead of lldb, but I think it causes some other problems that I don’t remember at the moment, plus it doesn’t have some functions useful in lldb.

+8
ios xcode lldb
source share
2 answers

UPDATE : Xcode 6, released in the fall of 2014, includes a new process save-core command in lldb - lldb can now generate a coredump of a user process. e.g. (lldb) process save-core /tmp/corefile and wait a bit.

The original answer for Xcode 5 and earlier lldb's was:

This feature is not yet implemented in lldb. This feature is also not implemented in the gdb version for Apple.

While this is not a frequently requested feature, this is what other people have said would be helpful. Hopefully someone will be motivated enough to add this ability to lldb. I'm not sure how well it will work on an iOS device, since it will include gigantic amounts of data transferred to the Mac, using a protocol that is not very efficient for large data transfers. I expect this to be remarkably slow.

The main file can be opened with lldb -c / tmp / corefile

+12
source share

It is worth noting that the process explorer tool for iOS can generate core dumps of any PID (provided that you have root or the same UID as you), without affecting the process.

0
source share

All Articles