• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tips for debugging stack smash?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Tips for debugging stack smash?
      • From: David A Rowland <email@hidden>
References: 
 >Tips for debugging stack smash? (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: Re: stop new header from being added to copy files?
  • Next by Date: Undefined symbols not listed!
  • Previous by thread: Tips for debugging stack smash?
  • Next by thread: Re: Tips for debugging stack smash?
  • Index(es):
    • Date
    • Thread