|
From: Christian P. <tr...@ge...> - 2005-08-26 19:30:07
|
On Friday 26 August 2005 18:55, Jeroen N. Witmond wrote:
> > 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 coredum=
p,
> > 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() =3D=3D 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.
Heya, I love that piece of code :-D
However, one question may remain: why SIGQUIT and not SIGSEGV? I mean, what=
's=20
SIGQUIT been used for usually?
Thanks for the hint,
Christian Parpart.
|