Examining Core Files Using the GNU Debugger
When an executable file terminates with a segmentation fault, using the GNU Debugger to examine the contents of the core dump file can sometimes provide valuable information pointing to the cause of the segmentation fault.
The following steps describe how to setup your program to generate a core dump file, then examine its contents using the GNU Debugger:
- Recompile the executable with the additional "-g" flag.
- In your job submission script, set your shell's ulimit core dump file size to unlimited:
- bash users: check your current ulimits with "ulimit -a"; set your ulimit to unlimited with "ulimit -c unlimited".
- csh/tcsh users: check you current ulimits with "limit"; set your ulimit to unlimited with "unlimit coredumpsize".
- Rerun your executable with the updated job submission script.
- Verify the core dump file was written following the program's expected segementation fault.
- Examine the core dump contents by entering "gdb executable core-dump-file" where the name of your executable and the name of your core dump file replace the words "executable" and "core-dump-file".