Program received signal SIGSEGV, Segmentation fault
hey there!
I'm trying to debug my program. i use the gdb as my debugging application. first i link all my source codes using make (makefile), then i use gdb test to debug the program. after which, i use the run command [ (gdb) run] to check for any possible error on my program. below are the result messages: Starting program: [Thread debugging using libthread_db enabled] [New Thread - 1211099440 (LWP 5322)] Program received signal SIGSEV, segmentation fault [switching to thread - 1211099440 (LWP 5322) 0xb7f73442 in pthread_cond_destroy@@GLIBC_2.3.2 Can somebody explain to me what does this mean? I'm just a newbie user of gdb. Thanks a lot! |
Wow.
Where to begin? First, I imagine that you typed the output by hand, because that should not be SIGSEV, but SIGSEGV. SIG stands for signal. For more information, google this: Code:
Unix signal tutorial
Further, it's evident from the output that you're debugging a program using POSIX threads. If you are discovering at this point what SIGSEGV means, and you're already debugging a POSIX threads program, you're in an unenviable position. May I ask whether you wrote this program yourself or whether it's an older program you're being asked to debug as part of your job, or what? |
yap...type-error...
about the source code, I ported a source from win32 to C++ in Linux platform. There is already a source code from win32, so my work is to port the program in linux. Thanks for your help. |
When gdb says "Program received SIGSEGV", you could type "where" -- it should spit out a list of which function called which. That may tell you which part of your program called pthread_cond_destroy -- directly or indirectly. But for case 3 (some other part of the program stomped the pointer) that won't help that much.
You could also give valgrind a quick try. It's usually used to find memory leaks (not your problem here), but it's quite good at reporting other suspicious things going on with your memory. It's not certain to find the problem, but not much effort to try. |
Yeah I second the recommendation to try valgrind. It helped me figure out a strange segfault in my own application.
|
All times are GMT -5. The time now is 05:25 AM. |