c - OS X: Generate core dump without bringing down the process? -


I know how a core dump is generated on OS X when a process crashes, but I Actually what a process to do, produces a core dump, then start the process again (without killing it).

A long time ago (maybe a year and a half years ago) I had a code that would have to do this ... it is used to connect OS X kernel libraries to a process, its All thread reads states and memory, and writes in a MchOo file on disk. It did great work (and what I actually see), but now I can not get that code for my life. I remember that this code was somewhat related to the OS X System Internal Book, but it Just remember a vague one.

Does anyone know the code about which I am talking about and can talk to me on that? If someone does not know any good way to do this with some example code?

EDIT: Here is the answer.

Information:

Program that

I believe That you are looking for

:

Specifically: / P>

  / * Unix third edition, beginning in approximately 1973 / / * Ken / Sig. C / core () {int s, * ip; Exercise Shear; / * The user is user area / / u.u_error = 0; / * Error error code "no error" * / u.u_dirp = "core"; To search for / * file name * / ip = namei (& amp; schar, 1); / * make a discovery; Schar means this is a kernel string / / (ip == faucet) {/ * * / if (u.u_error) / * fails to find * due to some error * / return (0); / * Such bail * / ip = machodd (0666); / * did not exist; Then create it * /} if (! Access (IP, IWRETE)) {/ * "Write" permission; 0 means ok * / iTrunak (ip); / * Minimize the original file * / / * First we write user fields / / u.u_offset [0] = 0; / * Offset I / O * / u.u_offset [1] = 0; / * Offset I / O * / u.u_base = & amp; U; / * Aadhaar address for the Io (in user area only) * / u.u_count = USIZE * 64; Balance / bytes for I / O; USIZE = 8 * / u.u_segflg = 1; / * Specify kernel address space * / writei (ip); / * Write * / / * * u_procp indicates process structure * Size of swappable image of the p_size process (x64 bytes) * / * / s = u.u_procp- & gt; P_size - USIZE; / * Size size to write * / / * * sets the software prototype segmentation registers to specify this text (* = 0), data (= s here), and stack (= 0 here) * / Astache (0, S, 0); U.u_base = 0; / * Base address for the I / O (beginning of space) * / u.u_count = s * 64; / * S is in units of 64 bytes, so adjust * / u.u_segflg = 0; / * Specify user address space / / write (IP); / * Write * /} iput (ip); / * Less IOD reference calculation * / return (u.u_error == 0); / * Done * /}  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -