Jump to content
IGNORED

How to detect stack overflow on CC65?


Recommended Posts

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 by KanedaFr
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...