how to yield core file
By default, gdb is given on ubuntu desktop, so you can enjoy debugging applications (if you like :-)).
$ which gdb
/usr/bin/gdb
$ gdb -v
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
But it seems that core file of application is not yielded (quite natural). Here is a memo to describe procedure how to configure system to yield core file.
ulimit
Core file size is set to size zero.
$ ulimit -a
core file size (blocks, -c) 0
You can change size to some value by ulimit command. If you would like to set permanently, then configure its value in /etc/security/limits.conf.
* soft core unlimited
In this case, soft limit for default entry is set to unlimited. For details, please refer to man page of limits.conf.
core file pattern
By default, application failures will be reported back to developers via apport.
application failure is passed to apport application via pipe as described in /proc/sys/kernel/core_pattern file.
$ cat /proc/sys/kernel/core_pattern
\|/usr/share/apport/apport %p %s %c
Therefore you change output location of core file by manipulating core_pattern file. Following is the sample to configure core files will be yielded under /var/cores directory with file name of core.<executable_name>.<PID>.<timestamp>.
$ sudo mkdir /var/cores
$ sudo chmod a+w /var/cores
$ sudo bash -c "echo /var/cores/core.%e.%p.%t > /proc/sys/kernel/core_pattern"
permanent change
Above change will be lost upon system reboot. So as to make change reflected over reboot, add following line in /etc/sysctl.conf.
kernel.core_pattern=/var/cores/core.%e.%p.%t
Please be noted that apport will overwrite this kernel parameter as follows (/etc/init/apport.conf).
echo "\|/usr/share/apport/apport %p %s %c" > /proc/sys/kernel/core_pattern
This phenomenon seems to have already been discussed in bug #1080978.
As temporary measure to avoid this overwrite, let us disable apport for now (/etc/default/apport).
#enabled=1
enabled=0
summary
Now you will see core files. Enjoy your debugging life.
By the way, repetition of application failure will consume disk space. Please be careful and monitor free disk space.