Core files
Core files capture the state of a failing program at the point that it terminates. You don't even have to be in the room with a debugger when the bug manifests itself. So, when you see Segmentation fault (core dumped)
, don't shrug; investigate the core file and extract the goldmine of information in there.
The first observation is that core files are not created by default, but only when the core file resource limit for the process is non-zero. You can change it for the current shell using ulimit -c
. To remove all limits on the size of core files, type the following command:
$ ulimit -c unlimited
By default, the core file is named core
and is placed in the current working directory of the process, which is the one pointed to by /proc/<PID>/cwd
. There are a number of problems with this scheme. Firstly, when looking at a device with several files named core
, it is not obvious which program generated each one. Secondly, the current working directory...