Debugging a program today, using the core dump, so write it, remember it.
What is Core Dump?
The core means memory, and dump means to throw it out and heap it out.
When developing and using UNIX programs, sometimes the program is inexplicably down, without any hint (sometimes prompting the core dumped). At this time, you can look at the shape of the core. Process number of the file generation, this file is the operating system to drop the memory content of the program is generated, it can be used as a reference for debugging programs.
Core dump is also called the kernel dump, when the program runs the exception, when the program exits unexpectedly, the operating system to the program's current memory state stored in a core file, called Core dump.
How do I use the core file?
Gdb-c core file path [application path]
After entering the where enter, you can show the program in which line is dropped, in which function.
Why is there no core file generation?
Sometimes the program is down, but the core file is not generated. The build of the core file is related to the environment settings of your current system, you can set it up with the following statement, and then run the program to generate the core file.
Ulimit-c Unlimited
The core file is generated in the same way as the running program, and the file name is typically core. Process number
4. View the core file with GDB:
Below we can take the core dump in case of an error caused by a runtime signal.
After core dump occurs, use GDB to view the contents of the core file to locate the row in the file that raised the core dump.
GDB [exec file] [core file]
Such as:
GdB./test Test.core
After entering GDB, use the BT command to view the backtrace to check where the program is running to locate the file-and-line of core dump.
Core Dump Debugging method