Core files are handy to have around if your program crashes with a SEGV, bus error, or if it raises an abort(). You can dig into the core file withgdb
There are two ways to enable core files:
- in your C shell do
% limit coredumpsize unlimited
(you can put this into your.cshrc
. I don't know what to do forbash
)
- Or in your program do
struct rlimit corelimit = { RLIM_INFINITY, RLIM_INFINITY };
You may need to also add
setrlimit (RLIMIT_CORE, &corelimit);
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>Core files seem to be getting dumped into
/cores
, rather than the directory the program was run from.