Reputation: 3048
In the course of development of some application we came to a need of possibly getting a complete core dump without completely stopping execution of a program completely.
Granted there are conditions that generate core dump where continuation may not be safely possible but we are not talking about memory corruption, and such.
What I am looking to do is send a signal to the program and generate a complete core without or minimally impacting program execution
Is this possible? If so how?
Upvotes: 0
Views: 1269
Reputation: 47020
Coredumpber is for Linux and obviously a great idea if that's your OS.
For other Posix-like systems, something like this ought to work fine:
#include <stdlib.h>
#include <process.h>
// Fork and abort for a core dump. This process keeps running.
if (fork() == 0) abort();
Of course the environment must be set to dump core on SIGABRT
. You could also try raise(SIGTERM)
, which is like kill -9
.
Upvotes: 0
Reputation: 24414
See this Google library, it might help: http://code.google.com/p/google-coredumper/
The coredumper library can be compiled into applications to create core dumps of the running program -- without terminating.
Upvotes: 3