Home > Article > Operation and Maintenance > What is core dumped in linux?
In Linux, the segmentation fault "core dumped" refers to the behavior that when a program terminates abnormally or crashes during running, the operating system records the memory status of the program at that time and saves it in a file. ; In addition to memory information, some key program running status will also be dumped at the same time.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
When a program terminates abnormally or crashes while it is running, the operating system will record the memory status of the program at that time and save it in a file. This behavior is It's called Core Dump (some Chinese are translated as "core dump").
We can think of core dump as a "memory snapshot", but in fact, in addition to memory information, some key program running status will also be dumped at the same time, such as register information (including program pointer, stack pointer) 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 are difficult to reproduce, such as pointer exceptions, and core dump files can reproduce the situation when the program went wrong.
The example is as follows:
Background: Linux environment, enter su and a segfault (core dumped) occurs after entering the password
Reason: The handicap modified ~/.bashrc File
Solution: sudo su, press Enter and then CTRL C and then use vim to change the ~/.bashrc file back to its original content
Recommended learning: Linux video tutorial
The above is the detailed content of What is core dumped in linux?. For more information, please follow other related articles on the PHP Chinese website!