I have some doubts about core file.
1) what is core file. 2) where it is located. 3) what is the use of core fie. 4) How to generate core files while compiling c programs. 5) what is the difference between core file and core dump.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
1) what is core file.
It is a file that contains a core dump. Certain abnormal program terminations such as executing an illegal instruction cause a core dump to be generated by default.
2) where it is located.
Usually it is a file called
core in whatever was the current directory of the process that caused it to be generated, but in some operation systems like Linux it is possible to reconfigure this so that it is saved to a different file, or so that it is piped to a program. For Linux, looks in
/proc/sys/kernel/core_pattern to find the name of the file in which core dumps will be placed.
3) what is the use of core fie.
A core dump can be loaded into a debugger like gdb. This enables examining the state of the program just as it was when it got terminated. It can come in handy for the developer to determine why the program crashed.
4) How to generate core files while compiling c programs.
That's on odd question. I guess the answer is that in order to generate a core dump while compiling C programs oyu'd have to cause the compiler to crash! For example you could find and exploit a bug in the compiler! Or you could just send it a
SIGQUIT by pressing Ctrl^ which by default forcibly terminates programs with a core dump.
5) what is the difference between core file and core dump.
I guess you could define it as: a core file is a file that contains a core dump. But generally I think that most people would use the terms interchangeably.