How to load core dump in GDB

Running an erroneous program may result it in exiting and dumping a core dump file named core. For example:

$ ./a.out
./a.out terminated by signal SIGSEGV (Address boundary error)

We need to load the core dump file in GDB to begin investigating the cause of the error. This is typically done using the command:

$ gdb ./a.out core

GDB loads the program and using the information from the core dump, the program stack and other information is restored to the point where it encountered the error.

A common first step in investigation is print the stack frames at this point:

(gdb) backtrace

Tried with: GDB 7.7.1, GCC 5.1.0 and Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s