Linux system opens the configuration "go" of core dump

Source: Internet
Author: User

What is core dump

Core dump is also called the kernel dump, when the program runs the exception, when the program exits unexpectedly, the operating system to the program's current memory state stored in a core file, called Core dump. Core dump is helpful in diagnosing the problem after the application has been crash off. The core dump is off when it is installed by default.

How to see if the system has core dump turned on

Use "ulimit-c" to see if the core dump is open. If the result is 0, this feature is turned off and the core file is not generated

How to open core dump

Method One: The command line mode "Ulimit-c 1024", in this example opened the core dump and limit the file size of 1024k, now the program occupies a fierce memory, the previous write C program needs to calculate the memory of the era has passed. If there is no limit, maybe a core file, a few G went out ~, of course there is no restriction of the way there are "Ulimit-c unlimited"

Method Two: Configure the profile file, open the/etc/profile file, inside can find "Ulimit-s-C 0 >/dev/null 2>&1", change it to "ulimit-s-C unlimited >/dev /null 2>&1 "
Method Three: Modify the/etc/security/limits.conf file, add "* Soft core 0", this method can open core dump "user soft core 0 or @group soft core 0" for the specified user or user group. However, it is important to use this method to comment out the line mentioned in method two, and not to exist simultaneously.

How to view the save path and file name format for a core file

By default, when the core is turned on, if the app occurs crash, a core is generated in the app's location. "Apply pid" file, filename is not very readable, management is not convenient.
View the path and format of the core file you are using "More/proc/sys/kernel/core_pattern"
The configuration of the auto-add PID is configured in "More/proc/sys/kernel/core_uses_pid", if 1 is automatically added

How to modify the save path and file name format for a core file

Modify the/etc/sysctl.conf file "vi/etc/sysctl.conf", add the path you want to save "Kernel.core_pattern =/tmp/corefile/core.%e.%t", It is important to note that the path must have write permissions applied, or the core file will not be generated. Then execute the command "sysctl-p" to take effect. About core_users_pid Default in the Sysctl file already exists, do not need to change, PID is very important information.

Attach a list of formats supported by the core file:
%p–insert pid into filename "pid"
%u–insert current UID into filename "UID"
%g–insert current GID into filename "gid"
%s–insert signal that caused the coredump into the filename "core signal"
%t–insert Unix time that the coredump occurred to filename "core file when it was generated"
%h–insert hostname where the coredump happened into filename "host name"
%e–insert coredumping executable name into filename "app names"

How to use the core generated by the test program [C-sharp]View PlainCopy
    1. #include <iostream>using namespace Std;int main () {* (char *) 1=1; return 0;}

Turn from

Linux system opens the configuration of core dump and throws CORE-CSDN blog with shortest program

6577604

Linux system opens the configuration "go" of core dump

Related Article

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.