Linux under Core file settings (GO)

Source: Internet
Author: User

When an unusual program exits, the kernel generates a core file (a memory image, plus debugging information) in the current working directory. Using GDB to view the core file, you can indicate the number of files and rows in the code that caused the program to fail.


1.core file generation switch and size limit
1) Use the ULIMIT-C command to view the build switch for the core file. If the result is 0, this feature is turned off and the core file is not generated.
2) using the ulimit-c filesize command, you can limit the size of the core file (FileSize is KByte). If Ulimit-c Unlimited, the core file size is not restricted. If the generated information exceeds this size, it will be cropped, resulting in an incomplete core file. GDB will prompt for errors while debugging this core file.

The Ulimit-c unlimited can be written to the. Bashrc.


The name and build path of the 2.core file
Core file generation Path:
Enter the executable file under the same path to run the command.
If the system-generated core file does not have any other extension names, it is all named Core. The new core file generation will overwrite the original core file.

1)/proc/sys/kernel/core_uses_pid can control whether a PID is added as an extension in the file name of the core file. The file content is 1, which means adding a PID as the extension, the resulting core file format is core.xxxx, and 0 means that the resulting core file is named Core.
You can modify this file by using the following command:
echo "1" >/proc/sys/kernel/core_uses_pid

2) Proc/sys/kernel/core_pattern can control the core file save location and file name format.
You can modify this file by using the following command:
echo "/corefile/core-%e-%p-%t" > Core_pattern, the core file can be generated uniformly into the/corefile directory, resulting in a file named core-command name-pid-timestamp
The following is a list of parameters:
%p-insert pid into filename add PID
%u-insert current UID to filename to add the present UID
%g-insert current GID into filename to add an existing GID
%s-insert signal that caused the coredump into the filename adds a signal that causes the core to be generated
%t-insert Unix time, the coredump occurred into filename when you add a core file when you build Unix
%h-insert hostname where the coredump happened into filename adds host name
%e-insert coredumping executable name into filename add command name

Linux under Core file settings (GO)

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.