title: OS X: Generate core dump without bringing down the process?
body: <p>I know how to generate a core dump on OS X when a process crashes, but what I really need to do is attach to a process, generate a core dump, then resume that process (without killing it).</p>
  
  <p>A long time ago (maybe a year and a half ago) I had C code that would do this...  It used the OS X kernel libraries to connect to a process, read all of its thread states and memory, and write that into a Mach-O file on disk.  This worked great (and it's exactly what I'm looking for), but now I can't seem to find that code for the life of me.  I seem to recall that code was related somewhat to the OS X system internals book, but that's just a vague recollection.</p>
  
  <p>Does anyone know the code I'm talking about and could point me at it?  If not does anyone know a good way of doing this preferably with some example code?</p>
  
  <p>Edit:  Here is the answer.</p>
  
  <p>Information:  <a href="http://osxbook.com/book/bonus/chapter8/core/" rel="noreferrer">http://osxbook.com/book/bonus/chapter8/core/</a></p>
  
  <p>Program that will do it for you:  <a href="http://osxbook.com/book/bonus/chapter8/core/download/gcore-1.3.tar.gz" rel="noreferrer">http://osxbook.com/book/bonus/chapter8/core/download/gcore-1.3.tar.gz</a></p>