CodeWarrior 8- & 16-bit tools: Manage the Stack

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CodeWarrior 8- & 16-bit tools: Manage the Stack

1,806 Views
marc_paquette
Contributor V
To help you find solutions to problems that have already been solved, we have posted this message. It contains an entire topic ported from a separate forum. The original message and all replies are in this single message.
 
Posted: Nov 04, 2005 - 10:10 AM   
 
Hello
 
What kind of results do I expect when the stack overflows?
 
Gabriel 
 
 
  
Posted: Nov 04, 2005 - 10:26 PM   
 
Very weird things can happen if the stack overflows. Have you checked your map file to see where your last variables are located. You could then look at your map file to get some idea of the level of calls that your code is going through. But it also depends on the number of parameters passed in on the stack.
 
On the Mac there used to be a stack snifer that would run off a timer interrupt and look at the stack.
 
jon 
 
 
Posted: Nov 12, 2005 - 10:50 AM   
 
I ALWAYS fill my memory space with an init pattern. That way I can easily look at the top of memory and see how far down the stack grows anytime you halt execution. If you start seeing it growing down further than you expect, then start looking for problems.
 
Also, keep 'strings' or other benign stuff up top in the space you use, so that if the stack clobbers something, you might get away with just a corrupted string that will show what happened but still be functional.
 
 
Labels (1)
Tags (1)
0 Kudos
0 Replies