KanedaFr Posted March 15 Share Posted March 15 (edited) Hi, Are you aware of a way to detect stack overflow with CC65 ? We allocated space memory on the config file using __STACKSIZE__: but how do we know if it's enough or not ? Of course, I doubt everything could be checked at compile time (recursive calls for exemple) so is there a trick to know our program eat all the stack ? Something like using the last byte of the stack for example .... Edited March 15 by KanedaFr Quote Link to comment Share on other sites More sharing options...
42bs Posted March 15 Share Posted March 15 You can fill the stack with a virgin pattern and then check from bottom to top until the first byte != virgin pattern. You get both, check for overflow and actual usage. Quote Link to comment Share on other sites More sharing options...
obschan Posted March 15 Share Posted March 15 You also have those in cc65 https://bitbucket.org/atarilynx/lynx/src/master/tools/cc65/libsrc/runtime/stkchk.s Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.