GDB debugging under Linux (2)

Today, we will introduce the core dump file. Core dump is called a core dump. It is a memory snapshot of a process when it crashes suddenly. When an exception occurs in a program and the exception is not caught in the process, the operating system will dump the process memory, register status, run stack and other information in a file. < / P > < p > based on the snapshot function of core file, we can debug and analyze the cause of program crash. GDB debugs a running program and core file at the same time, then debug GDB steps, and then view the system information at the moment of code crash. < / P > < p > although we know that a process will produce a core file during coredump, sometimes we find that although the process crashes, we can’t find the core file. < / P > < p > this is because the size of the memory dump file is set to zero by default, so we need to reconfigure it. Ulimit – C can set the size of the core file. If the value is 0, the core file will not be generated. If the value is too small, the core file will not be generated, because the core file is generally large. Run. / compiled executable file, the core dump file of memory dump generated by code crash. LS can see a file named core with process number as suffix < / P > < p > this is the GDB core dump generation and debugging method I share. If you have any better ideas, please share them. Fifth personality will be updated, please remember your game account, otherwise you may not be able to play normally