int main () {
allocating_resource();
call_other_libs();
...
release_resource();
return 0;
}
After the program runs, the main returns.
And after it accessed returne 0
, the stack pointer points to a bad address in main(), then the executable crashed.
Program received signal SIGSEGV, Segmentation fault.
GI __libc_free(mem=0x3f21a843) at malloc.c:2020
I guess there are some illegal memory accesses, but the code base is too large to check. Review and analyse all the code is not realistic.
Disable some code is also unacceptable due to large code base.
With core dump there 's no hint I can use due to it's crashed at the main stack and after the return clause executed.
I know how to use gdb, but the project is so large that it seems to hard to find the root cause.
valgrind --tool=memcheck seems to no help.
How to solve such problem?