Is there a way to get a core dump (or something similar) for a process without actually killing the processes? I have a multithreaded python process running on an embedded system. And I want to be able to get a snapshot of the process under normal conditions (ie with the other processes required to be running), but I don't have enough memory to connect gdb (or run it under gdb) without the python process being the only one running.
I hope this question makes sense.
Best Answer
The usual trick is to have something (possibly a signal like
SIGUSR1
) trigger the program tofork()
, then the child callsabort()
to make itself dump core.and during initialization
Used this way,
fork
won't consume much extra memory because almost all of the address space will be shared (which is also why this works for generating the core dump).Once upon a time this trick was used with a program called
undump
to generate an executable from a core dump to save an image after complex initialization;emacs
used to do this to generate a preloaded image fromtemacs
.