You know Andrew, catchsegv(1) does exactly that :)