Friday, March 10, 2017

segmentation fault core dumped in ubuntu

segmentation fault core dumped in ubuntu




A segmentation fault is a common condition that causes programs to crash; they are often associated with a file named core . Segmentation faults are caused by a program trying to read or write an illegal memory location. 

What is a Sigsegv? 

This is an error caused by an invalid memory reference or segmentation fault. The most common causes are accessing an array element out of bounds, or using too much memory. 

It always difficult to find exact location of segmentation fault error in large program. so debugging of program correctly can give method details which generates this error.

Steps to debug c program in ubuntu

Example

gdb ./testfile
run
bt

it will give method name with stack trace.





download Source link 

http://www.digitalpadm.com 

Get  link for download