This document explains how ot use gdb, a debugger for the unix environment, to examine a core file. If you have questions on how to compile source code in the unix environment and/or gdb in general, look at the quickstarts for gdb, make and compiling code.
A core file is an image of a process that has crashed It contains all process information pertinent to debugging: contents of hardware registers, process status, and process data. Gdb will allow you use this file to determine where your program crashed.
First, the program must be compiled with debugging information otherwise the information that gdb can display will be fairly cryptic. Second, the program must have crashed and left a core file. It should tell you if it has left a core file with the message "core dumped".
The command line to start gdb to look at the core file is:
The last line that gdb will print before the "(gdb)" prompt will be something like:
You can find out which function called the current function by using the "up" command which will print out a similar line. The "down" command does the opposite of the "up" command. Finally, to view the entire stack frame, use the "backtrace" command or it's abbreviation "bt".