The core dump file (in a Unix System) consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (for example when a crash happens). 

The core dump files contains also other key pieces of program state:

  • the processor registers, 
  • memory management information
  • other processor and operating system flags and information.

Core dumps are often used to assist in diagnosing and debugging errors in computer programs.

All this iformation can be used to debug programs in conjuction with the use of the gdb debugger.

To generate this file the kernel shall know if it has to generate the core file and what the maximum dimension is. As default Ubuntu does not generate the core dump files, so the user has to instruct the kernel.

gdb guru

The dirty and fast way

From the bash issue the following command:

localhost:~ $ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

then issue:

localhost:~ $ ulimit -c unlimited

and last:

localhost:~ $ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

As you can see now the core file can be created and it can be unlimited. (this procedure also works on Mac OS X)

The clean way

The clean way to do the job, consists in editing the /etc/sec

urity/ulimits.conf file. You must be root or you must use sudo.

At the end of the add the following line:

*  soft  core  unlimited

save the file and reboot the system. After the login check for the result:

localhost:~ $ ulimit -a

core file size          (blocks, -c) unlimited

......................

......................

......................

 

Under Darwin/Mac OS X.  To re-enable core dumps, a privileged user must do one of the following

     * Edit /etc/launchd.conf or $HOME/.launchd.conf and add a line specifying the limit limit core
     unlimited

     * A privileged user can also enable cores with

# launchctl limit core unlimited

Gg1