If you have ever debugged some application, you may have heard about the term called core dumps. Here we will see about the core dump.
What is a core dump?
When a computer program is crashed, you can copy all the contents of the RAM to a hard disk. It can be then analyzed to see why the program has crashed. A core dump will contain all the details of the process at the time when the program crashed unexpectedly.
There are several reasons why a core dump file will be created.
- Corrupted data can create a core dump file.
- Hardware issues like overheating.
- An outdated version of the operating system.
- Program not compatible with the operating system.
- Files of the program are infected with viruses.
How to enable core dumps in Linux.
Before you enable core dumps on the system you will need to update the soft limits to unlimited. It can be done using the command below.
ulimit -S -c unlimited
To make it permanent you will need to open the file
/etc/security/limits.conf and add the line below.
#* soft core 0
In the same file, you will also need to mention the core dump file.
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t fs.suid_dumpable = 2
Open file vi
/etc/sysconfig/init and add the line below.
And finally, run the command
sysctl -p for the changes to take effect.
The above way is to enable core dumps in the kernel.
How to analyze a core dump file?
To analyze a core dump file, you will need a program called gdb, you can install it by using the command below on a centos system.
yum install gdb
I hope you have found the information above useful; I would request your support in reviewing the contents posted on justgeek.net. If you have found the issues in the command or the information you can comment below or use the contact page and I will respond to you as soon as possible.
You would also like to learn more about Linux Basics.
You can read more about core dumps on Wikipedia.