How to generate coredump in Linux (for GDB debugging)

Source: Internet
Author: User

In case of a task exception, you need to record the last words and use GDB for debugging. Therefore, you need to record the coredump file.

View settings:

Run sysctl-A | grep core under the root user to check whether the core file is correctly configured.

Command settings:

1) run the ulimit-C unlimited command to set the maximum space available for coredump files;

Or modify it in VI/etc/security/limits. conf.

2)/proc/sys/kernal/core_pattern you can set the path and file name format generated by coredump. If not modifiedProgramGenerated under the execution directory.

Or use the command to modify:

Sysctl-W kernel. core_pattern =/CORE. % E. % P

If the above two points are set, coredump still cannot be generated, which may be due to the following reasons:

1) Some semaphores do not generate coredump by default. You can use man signal to check them.

2) the hard disk space is insufficient, and coredump requires a lot of hard disk space (upper GB space );

3) The ulimit-C command is valid only on the current terminal, that is, the terminal setting of the program startup. This command is invalid. Of course, coredump cannot be generated.

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.