Re: Tips for debugging stack smash?
Re: Tips for debugging stack smash?
- Subject: Re: Tips for debugging stack smash?
- From: Cameron Hayne <email@hidden>
- Date: Wed, 2 Aug 2006 13:32:18 -0400
On 2-Aug-06, at 12:27 PM, Scott Ribe wrote:
Sigh... I'm smashing the stack, leaving things where XCode doesn't
show any
useful info when it breaks.
Suggestions:
1) Look carefully at what is on the stack. Try to figure out what
those hex bytes might represent - that could give you a clue. If
there is a common pattern of hex bytes on the stack when the problem
occurs, maybe installing a conditional break point in gdb will allow
you to determine where the problem occurs.
2) Scan your code for functions whose return values are larger than
what would fit in a register - e.g. functions that return a struct or
object by value. Look carefully at those functions. I've some times
seen cases where the return statement was missing and, for some
reason that I don't understand, the compiler wasn't complaining.
3) Turn on all warnings in gcc. Also try running 'lint' on your code.
4) Try divide & conquer techniques like commenting out half of your
code and seeing if the problem occurs.
--
Cameron Hayne
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden