|
From: Jeroen N. W. <jn...@xs...> - 2005-08-26 16:55:47
|
> On Friday 26 August 2005 09:50, Dennis Lubert wrote:
> I would like to be able to dump them into a file (just like the coredump,
> but
> w/o crashing), and review them with a hex-editor (for example).
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
/* Brute force method of dumping core on the fly. */
void dump_core()
{
if (fork() == 0)
raise(SIGQUIT);
}
/* Simple program to test it. */
#include <stdio.h>
int main(int argc, char** argv)
{
printf("About to dump ...");
dump_core();
printf(" done.\n");
}
Core dumps must be enabled. (`ulimit -c unlimited` under bash.) gdb likes
the resulting core file just fine.
Jeroen.
|