Stack Overflow

Question: How to Find Stack Overflow

 

Answer:

In the events window, enable 8-bit thread where it lets you select an input that you can compare with a low and a high value. If the low and the high values as set are shown to be FF, and the input selected is SP, it will check when stack reaches the end. Setting the state logic to break will halt the program at that point. If it breaks midway through the code, the stack pointer is full and wraps back to 00.

Set Debug/Trace Mode to PC/registers mode. Then go to Debug/Trace. This will show at what instruction, the stack pointer starts overflowing.

Alternatively, the .mp file (one of the output files) also shows where the user variables end and how much space is left for use while running the program. For example, if the end of user variables is 00_E6 (bss_end), there are 26 available spaces.