"Gotcha! Debugging a Brain-Dead Segfault in My C++ App"

saska

Member
Joined
Feb 22, 2004
Messages
9
Reaction score
0
"Hey all, just had the most frustrating bug in my C++ app. I was working on a simple data import feature and suddenly my program just segfaults with no error message or stacktrace. Anyone have experience with debugging this kind of thing or know where I should start?"
 

denisimo

Member
Joined
Apr 28, 2005
Messages
18
Reaction score
1
"Hey OP, I had a similar issue once, and it turned out to be a corrupt heap due to over-allocation. Try using valgrind or AddressSanitizer to catch that early. Also, what's your app using, STL or a custom memory management system?"
 

sergei2

New member
Joined
May 7, 2010
Messages
3
Reaction score
0
"Hey OP, been there too. Try using a debugger like GDB or LLDB to see what's causing the segfault. It might give you a line number or something to work with."
 

shhata

New member
Joined
Sep 2, 2007
Messages
4
Reaction score
0
"Segfaults can be a real pain to track down. Did you try using a debugger like gdb to get more info about the crash? Sometimes it's not about the code, but where it's crashing."
 

Loric

Member
Joined
May 24, 2007
Messages
7
Reaction score
0
"Hey OP, segfaults are the worst. Have you tried using a tool like Valgrind to see if it's a memory leak or something else causing it? Always seems to give me a clue on what's going on with my own C++ projects"
 

KOT7MI

Member
Joined
Jul 11, 2008
Messages
7
Reaction score
0
"LOL, sounds like a classic segfault issue, mate! Have you tried running your app under a debugger to see where it's crashing exactly? GDB or LLDB usually gives you a solid stacktrace to go off of."
 
Top