Turn from: http://blog.csdn.net/ljx0305/article/details/4065082
Today, debug a program, with the core dump, so write it, remember that.
What is Core Dump?
Core means memory, dump means to throw it out and heap it out.
When you develop and use a UNIX program, sometimes the program is inexplicably down, without any hints (sometimes prompting the core dumped). At this time you can see if there is a core. Process number of the file generation, this file is the operating system when the program down when the memory content thrown out to generate, it can be used as a reference to debug the program.
Core dump is also called the central Dump, when the program runs abnormal, the program abnormal exit, the program's current memory state of the system stored in a core file, called Core dump.
How do I use core files?
Gdb-c core file path [path of application]
Enter the where you want to return, and you can show which line the program is in and in which function.
Why is there no core file generation?
Sometimes the program down, but the core file is not generated. The core file generation is related to your current system environment settings, you can set it up with the following statement, and then run the program to generate the core file.
Ulimit-c Unlimited
Core files are generated in the same location as the path where the program is run, and the filename is typically core. Process number
4. View core files with GDB:
Here we can take a core dump when a run-time signal causes an error.
After core dump occurs, use GDB to view the contents of the core file to locate the row in the file that is causing the core dump.
GDB [exec file] [core file]
Such as:
GdB./test Test.core
After entering GDB, check backtrace with the BT command to check where the program is running to locate the file-> line of core dump.