Generate Linux Core Files: Step-by-Step Guide
Core files can be generated in a Linux system by following these steps:
- Open the terminal and navigate to the directory where the program that needs to generate core files is located.
- Set the size limit of core files using the ulimit command. For example, you can use the following command to set the size limit of core files to unlimited:
ulimit -c unlimited
- Run the program that generates core files.
- A core file is automatically generated when a program crashes or encounters a severe error, and the default name for the core file is typically “core”.
- You can use the gdb tool to debug core files. For example, you can use the following command to load the core file and check the program’s status:
gdb <程序名> core
By following the above steps, you can generate core files and debug in a Linux system.