Sunday, 27 March 2016

Analyzing Core Dump using gdb

Most of us us see segmentation fault and program crashing but very few of us know what exactly happened in the background. Lets first try to understand segmentation fault and core dump before moving to the analysis.

A segmentation fault occurs when a process attempts to access memory(reading/writing) the process is not authorized to so access. For example, processes do not have access to the page of memory beginning at Ox0 Or dereferencing the NULL pointer results in a segmentation fault which results in core dump.

core dump ,memory dump, or system dump consists of the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (crashed). If you dont see core dump getting created in your system, check  ulimit using below command
 ulimit -c 

 If result comes out to be 0, change it to appropriate size or unlimited

ulimit -c SIZE OR ulimit -c unlimited 

You can analyse the core dump by using gdb

Command : gdb <executable/binary path> <core Path>

After running this command please type bt(backtrace) on console to see where program actually got crashed.

shared_ptr

Coming Soon