program received signal SIGSEGV, segmentation faul

2019-08-20 14:25发布

问题:

I am running a program in multi threaded environment it fails at some point. when i tried it with gdb than it is shoing the following error.

program received signal SIGSEGV, segmentation fault.

[switching to thread 0x7fff677b700 (LWP 2777)] 0x00007ffff7aa42b9 in process_incomplete_rows (resultset=0x507950) at c/mgmt.c:479 479 c/mgmt.c: No such file or directory.

mgmt.c file is there and this code is working fine for some options but 2 or three options its giving this error. What could be the cause of this error. Its error in comiplation or in coe? or its error while accessing some data?

回答1:

A segmentation fault is a runtime error that is usually due to referencing an invalid pointer. Usually that invalid pointer has never been initialized, but sometimes it is reusing an old pointer or writing past the end of an allocated memory chunk (such as past the end of a string).



回答2:

It probably means that your node variable is either NULL or corrupted. Run your program in the debugger, stepping through it from some point prior to the crash up until it and see where you've messed it up. Or use one of the automated tools like Purify or Insure++ to track it down for you.