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:

  1. Recompile the executable with the additional "-g" flag.
  2. 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".
  3. Rerun your executable with the updated job submission script.
  4. Verify the core dump file was written following the program's expected segementation fault.
  5. 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".
Back to Top