Core dump refers to the mechanism by which kernel writes the current memory of a process to a file when the process has an exception and exits execution. The core dump mechanism is very important in the process of program development, and the core file can be used to track the occurrence point of anomaly effectively.
1.linux does not generate a core file by default, so you must first set it up with the Ulimit command before using core dump.
The 2.ULIMIT-C command allows you to view the lay of the core dump file, by default 0, by setting the core file size to 1KB through ulimit-c 1024, or by setting the Ulimit-c unlimited without limiting the core file size.
3.core files generally output to the current directory, but you can modify the kernel in some of the parameters to change the core dump file path and name, the specific method:
1. Modify the 0 in the/proc/sys/kernel/core_uses_pid to 1, so that the PID becomes the core filename.
2. Modify the/proc/sys/kernel/core_pattern of the core file generation path and the birth of Fame, specific parameters of Google.
Note: The above changes will only affect the operation of this system, when the system is restarted, will no longer be effective, through sysctl kernel.core_uses_pid=1 and sysctl kernel.core_pattern=xxxxx to achieve permanent change.
4.core files can be viewed through gdb to see the anomaly, in the form of GDB Your_program Core_file, note that only the program you generate is a program with debugging information, GDB can correctly load the core files.