This article was reproduced from: http://blog.csdn.net/sky_qing/article/details/8548989
If you experience a process with high CPU utilization during testing or if you need to debug the process while you are stuck, you can use the GDB command to generate the Coredump file and then debug the Coredump file to locate the problem.
So how do I use GDB to generate a coredump file? In fact, the steps are simple:
1. Install GDB and then use the command ' GDB '. (Assuming the process number to debug is 21509)
2. Attach gdb to process 21509 using the ' Attach 21590 ' command.
3. Generate the Coredump file core_name using the ' gcore core_name ' command.
4. Disconnect using the ' Detach ' command.
5. Use the ' q ' command to exit GDB.
At this point, a coredump file named Core_name is generated in the current directory. You can use the GDB tool to debug the Coredump file below.
Using GDB to generate the Coredump file "reprint"