What is the "debug" Core dump? How do I properly and permanently open Linux?

Source: Internet
Author: User
Tags terminates

650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Iahl5mqlicpyp9021xzq0t2xhdiar7xhzwcysxnaakoemicq4soiccjyvqsjic8bltwuw8yricaniamgfwc9vchbpobndg/0?wx_fmt=jpeg " alt= "0?wx_fmt=jpeg"/>

Content Introduction

What is the "debug" Core dump? How do I properly and permanently open Linux?


What is Core dump? How do I properly and permanently open Linux?


What is Core dump?


Core dump sounds abstract at first blush.


When the program runs abnormally terminates or crashes, the operating system records the memory state of the program at the time and saves it in a file, which is called the core dump (translated into "kernel dumps" in Chinese).


We can assume that core dump is a "memory snapshot", but in fact, in addition to the memory information, there are some key program run states also dump down, such as register information (including program pointers, stack pointers, etc.), memory management information, other processor and operating system status and information.


Core dump is very helpful for programmers to diagnose and debug programs, because some program errors can be difficult to reproduce, such as a pointer exception, and the core dump file reproduces the scenario when the program goes wrong.


Before the semiconductor was used as a computer memory material, the computer's memory was using core memory (magnetic core memories), and the core in core Dump followed the core expression of core memory. The figure is a unit of core memory from Wikipedia.


650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz/ Iahl5mqlicpypmvgcrfubornqpxyrpam2y7j8fwxx0ajrdabiazxc86vemdcmujoneib1ldcm74mbcjyov7icnfx38a/0?wx_fmt=jpeg "alt= "0?wx_fmt=jpeg"/>


In the Book of Apue (Advanced Programming for UNIX environments), the author has a sentence that reads:


Because The file is named core, it shows how long this feature have been part of the Unix System.


The core here is used in the early computer core memory expression, but also can see the UNIX system core dump mechanism of a long history.


Dump refers to copying a portion of a storage medium to another storage medium, or printing, displaying, or other output devices. The contents of the dump are formatted and can be parsed using some tools.


In modern operating systems, a core dump is used to indicate that when a program terminates abnormally or crashes, the contents of the process's memory are copied to a disk file for easy debugging by the programmer.


How do I open core Dump?


Temporarily turn on core Dump and set the size unlimited:


Command Line Input:


Ulimit-c Unlimited


To permanently open core dump and make it unlimited in size, there are two ways to do it online:


1. Open Core Dump function

      1. Enter the command in the terminal ulimit -c , the result of the output is 0, the default is to turn off core dump, that is, when the program terminates abnormally, the core dump file will not be generated.

      2. We can use the command ulimit -c unlimited to open the core dump function, and do not limit the size of the core dump file, if you need to limit the size of the file, change the unlimited to the maximum size you want to generate the core file, note the unit is blocks (KB).

      3. Using the command above will only be valid for the current terminal environment, if you want to be permanent, you can modify the file /etc/security/limits.conf file. Add a line:


* Soft Core Unlimited


2. Add in the /etc/profile


Ulimit-c Unlimited



I tried both of these methods, but the input


Ulimit-c


The output is always 0.


Later I thought of a way, under Ubuntu can:


Edit the. bashrc file:

VI ~/.BASHRC


Add to:

Ulimit-c Unlimited


Save, exit.

SOURCE ~/.BASHRC


The source command causes the modification to take effect immediately.

This article is from the "Programmer Alliance Frogoscar" blog, so be sure to keep this source http://4526621.blog.51cto.com/4516621/1712284

What is the "debug" Core dump? How do I properly and permanently open Linux?

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.