Catching core dumps in a shell script

Brett Worth brettw at cray.com.au
Mon Feb 4 13:27:49 EST 2002


On Mon, 4 Feb 2002, Michael Still wrote:

> Is there a generic way of catching a core dump in a program which is run
> in a shell script? Some sort of signal handler perhaps?

I dont know about generic...

Does an exit status > 128 indicate a core dump has occured?:

[jade] cat x.c
#include <signal.h>
main()
{
        raise(SIGSEGV);
}
[jade] grep SIGSEGV /usr/include/asm/signal.h
#define SIGSEGV         11
[jade] cc -o x x.c
[jade] ./x
Memory fault (core dumped) 
[jade] echo $?
139
[jade] echo 139 - 11 | bc
128

Brett





More information about the linux mailing list