| ??? 01/05/01 01:48 Read: times |
#7793 - RE: Run Time Stack Monitor |
You can always initialize your stack by pushing the address of an error stack routine. This will only catch the case of excessive returns or pops.
If you have a background tasker, schedule a recurring task (or use an interrupt timer) to test for stack overflow. One method is to write values into the byte the stack SHOULD never overflow with a changing pattern. A good technique is to use a byte counter in RAM and first check the stack boundary to see if the last byte written to it has been modified. If so, a stack error is declared. If not, increment the counter and the value at the stack boundary. Repeat as often as the task runs. Some would suggest merely writing a 00 a FF but you may get unlucky and the stack is pushed with that value as it overflows. There is at 1 in 256 chance of that unless you want to enhance the prediction by practical addresses. Its fair to avoid the dynamics of the counter, particularly if you are only looking to track down a possible stack problem. There may be better methods. I would imaging that people using C and Basic have a lot less control over their stacks than we that use assembly language only. Stacks don't tend to runaway on me. :) aka j |
| Topic | Author | Date |
| Run Time Stack Monitor | 01/01/70 00:00 | |
| RE: Run Time Stack Monitor | 01/01/70 00:00 | |
| RE: Run Time Stack Monitor | 01/01/70 00:00 | |
| RE: Run Time Stack Monitor | 01/01/70 00:00 | |
| RE: Run Time Stack Monitor | 01/01/70 00:00 | |
RE: Run Time Stack Monitor | 01/01/70 00:00 |



