SIGSEGV- segmentation fault during execution
I am getting a SIGSEGV- segmentation fault
I have studied the code but cannot find out much. wut are the most common problems for this error.:( |
As far as i have known The reason for this error is Invalid memory access. The most common way of commiting this mistake is while you are doing string operations, closing the file pointer more than once, and wrting on readonly memory.
Use debuggers or printf to find out the error. check the return values of each and every library function. Thats all i know about it. Bye, Eshwar. |
You can find the place (function) your program has a problem using
gdb progname run (the program will run, when it segfaults: ) bt (shows an 'execution trace', function at the top was stared as the last one, there's a high probability there's a problem in it - or it uses data that's incorrect) |
Segmentation faults occur when a process tries to access memory outside its bounds.
In processes that arent trying to do something malicious, this usually happens when a pointer is returned from a function and is not tested whether it is valid. Look at your code and make sure your error checking uses == and not =. If you still cant find it, post your code. |
Quote:
if (t_ptr=NULL) FREE(t_ptr); Or missing & or * in front of function arguments or assignements. Chris |
get a program called valgrind. It will tell you all the invalid reads/writes in your prog.
|
All times are GMT -5. The time now is 11:34 AM. |