The use of core dump files under Linux __linux

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.