What exactly is a core file and why is it useful? What exactly is a core file and why is it useful? unix unix

What exactly is a core file and why is it useful?


A core file is, essentially, a dump of the memory and registers of the program at the time that it crashed. When viewed in a debugger, you can get information on where the program was at the time of the crash, as well as getting stack traces or viewing the state of heap memory. Basically it lets you do anything you could with a debugger attached at the time of the crash, short of actually running code.


It basically contains the memory of the process and allows you to see/understand what caused the problem (stacktrace, examine variables etc.) For more details see man core


It's basically a snapshot of a process's memory.

It's usually created automatically when process ends abnormally (e.g. segmentation fault).

It can be loaded by debugging tools like gdb to try to determine the cause of the crash. For example, one can examine what the process was executing at the time of the failure, the values the variables had, the stack backtrace (the function that called the function that had the problem, the function that called it, and so on), etc.