Linux program debugging assistant-core, resolving segment errors!

Source: Internet
Author: User

If a problem occurs, you do not know how to solve it. If a segment error occurs, the problem cannot be solved. Try the core file information!

Core File Method
1. Where can I create a core file?

Create in the current working directory of the process. It is usually in the same path as the program. However, if the chdir function is called in the program, the current working directory may be changed. The core file is created under the path specified by chdir. Many programs have crashed, but we cannot find the location of the core file. It is related to the chdir function. Of course, not all core files are generated when the program crashes.

2. When will the core file not be generated?

Core files are not generated under the following conditions:

(A) The process is set-user-ID, and the current user is not the owner of the program file;
(B) The process is set-group-ID, and the current user is not the group owner of the program file;
(C) The user has no permission to write the current working directory;
(D) The file is too large. Core File Permission (assuming that the file does not exist before) is usually User read/write, Group read and other reads.

3. How to generate a core file?
By default, the system prohibits the generation of core files.

[Root @ localhost ~] # Ulimit-C
0
[Root @ localhost ~] # Ulimit-C 1000

Allows the generation of core files with a size limit of 1000
If the core file still cannot be generated, check whether the program has the current directory permission.

[Root @ localhost ~] # GDB quesimv Core

The specific error location is located.

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.