2

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.

  • What core file? Can you give an example of where you're finding these? – HalosGhost Feb 26 '15 at 14:49
  • 1
    @HalosGhost en.wikipedia.org/wiki/Core_dump – goldilocks Feb 26 '15 at 14:56
  • I am using c,c++ in linux environment. when i complie c program in linux environment will get core file OR not. – user2931858 Feb 26 '15 at 14:56
  • @goldilocks, I am aware of core dumps; the user seems to think there might be a difference between core dumps and whatever ey's talking about. – HalosGhost Feb 26 '15 at 14:58
  • "Core files" == "core dumps" is the answer to #5. You do not get them when you compile, you get them when you run is the answer to #4. – goldilocks Feb 26 '15 at 14:59
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.