Prepared by Alison Chaiken and offered under cc-by-sa
Using tools like gdb to examine core files can be extremely useful in debugging shaky programs on Linux. (My other favorite tools besides gdb for diagnosing crashes are strace and ltrace, which I learned about from Christopher Hallinan.) Frustratingly core files disappeared when abrtd appeared in Fedora, in release 12 if I recall correctly. According to Dave Neary, the traditional and simple "ulimit -c unlimited" is still all that's required to restore core files on Ubuntu, but Fedora expects more of their users.
abrt is a Fedora system which
semi-automatically provides information about defects and crashes on user system. It collects necessary data about the crash, generates a report with all information and based on user interaction sends it to some bug reporting system.The problem is, abrtd intercepts user-generated core files, even for the programs the user writes him- or herself. I have no problem with abrtd catching Gnome or Firefox core files, but the fact that my programs don't drop core in directories of my choice is simply unacceptable. Also, I find it very annoying that abrtd requires creation of yet another new account with new credentials. After all, I'm already logged into localhost; why not offer me the choice of sending my username and IP address? Fundamentally, abrtd is simply unacceptable to me, as much as I want to support Fedora debugging. Out it goes.
[alison@bonnet ~]$ ulimit -c unlimited -bash: ulimit: core file size: cannot modify limit: Operation not permitted [alison@bonnet ~]$ sudo set ulimit -c unlimited sudo: set: command not found
sudo service abrtd stop
sudo chkconfig --del abrtd
kernel.core_pattern = |/usr/libexec/abrt-hook-ccpp /var/spool/abrt %p %s %u %cto
kernel.core_pattern = core
* soft core unlimited(Yeah, "soft core". Actually "hard core" is legal too.)
# make sure it doesn't core dump anywhere unless requested corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}"That step appears to be unnecessary.
Now create a program that drops core. (I assume that the reader already knows how.)
[alison@bonnet ~]$ ulimit -c unlimited [alison@bonnet kernel_char]$ ./bit_palindrome Segmentation fault (core dumped)
Finally! A file called core.$PID will be dropped in $CWD. Now the user can "gdb $EXECUTABLE $CORE" to heart's content.