When we write the service-side program, because of multi-threaded and complex environment, the program may be in the case of uncertain conditions of the outage, not good again, this is how we get the program error message, a method by logging, sometimes some error logs can not be reflected, then use our core Dump file. Typically, COREDMP contains memory, register status, stack pointers, memory management information, and so on when the program runs. It can be understood that the current state of the program's work is stored as a file. Many programs and operating systems automatically generate a core file when errors occur. 1 Our system is generally the default is the core dump turned off, can be viewed through ulimit-c if 0 is closed, we can open by Ulimit-c N, you are setting the Coredump file maximum KB, or directly set unlimited ulimit–c Unlimited2 after Setup we write an error program experiment//main.cppint Main () {int *XCJ = 0;*XCJ = 10;return 0;} 3 compile, remember to add-G debugging information into the program, and then run the program g++ MA In.cpp-o main-g
./main
4 using GDB to view debug information GDB main core
You can see the wrong information through GDB. More content can be searched online for "Xia Chaojun" to get my course or to see my video course at Csdn College http://edu.csdn.net/course/detail/3738
How to view error messages through GDB after a Linux program is down