Programmatically generating the core dump

Eljay Love-Jensen eljay@adobe.com
Thu May 5 09:43:00 GMT 2005


Hi VM,

Your question is off-topic on this forum.

Anyway, trying to answer your question, what OS are you using?

On the many flora of Unix (that conform to SVID 3, POSIX, BSD 4.3, and/or ISO 9899), you can use the abort() function from C's <stdlib.h> / C++'s <cstdlib>.

I find it to be useful to instrument the throw action to cause the program to fork, have the child fork abort() so it creates a core dump, and the main fork continue with the throw action.

Even better if you can get the core file to be "core.$PID" instead of just "core".  :-)

For other OS's, I'm not sure.

HTH,
--Eljay



More information about the Gcc-help mailing list