[maemo-developers] Help debugging segfaults

From: Simon Pickering S.G.Pickering at bath.ac.uk
Date: Tue Feb 27 12:19:14 EET 2007
> > I don't have much experience debugging segfaults and would appreciate 
> > any pointers.
> pun intended?  ;-)  C pointers and string operations are the 
> first place to start looking for segmentation faults.


<snip lots of gdp output>

> Hint "std::string::compare ()"
> Hint "std::operator< <char, std::char_traits<char>"
> I'd start here.  It has been a long time since I looked at 
> gdb output of someone else's code.  The thing that I see as a 
> hint is string::compare from the std library.  I am thinking 
> <<stdio.h>> operations, etc but this looks to be c++ code.  
> So go back and check how you handle your string compare 
> operations.  What are the inputs to the string comparisons, 
> etc.  Are your string lengths long enough?  Do you have null 
> terminated strings.  Have you properly initialized the 
> variables that are being used.  These are things that I would 
> look for in a segmentation fault.  These ideas may help with 
> a porting issue too.

I'd also noticed that and hoped that gdb would narrow down where I need to look
as this is also not my code. Thanks for the pointer though.

> However, I have been successfully sleeping through the night 
> for many years now.  Moreover, If gdb is taxing your mind, 
> there's nothing that says you can put some printf statements 
> to locate where the program segfaults.

I think that may be the way I go if re-compiling libgiac doesn't provide any
more clues.

> I hope this helps.

Many thanks,


More information about the maemo-developers mailing list