If a program runs for 3 days before it goes wrong, this time
Do we have to use GDB to debug the program for 3 days?
At this point we need to use the core dump:
1, Core dump is also called kernel dump. When an exception occurs while the program is running, the Linux system can store the contents of the memory in a core file when the program goes wrong
, this process is called core Dump.
2. What kind of mistake does core dump use to deal with? It is mainly a segment error (segment fault) ...
The general performance is: A. Array access out of bounds B. Access null pointer c. stack Overflow d. Modify read-only memory
3. On Linux systems, the core dump function is turned off by default, but can be turned on/off via the Ulimit command
Open: Ulimit-c Unlimited
Close: ulimit-c 0
4. After core dump occurs, you can use GDB to view the contents of the core file and locate the error location of the program
Usage: GDB Program name core file name
GdB./test core.122223
5. Complete Example:
Gdb-c core.id Program Name
Input: Where. You can know who is calling and which line is down in which function.
or enter BT
Coredump Fault Analysis