itron

Is there a programmatic way to check stack corruption

跟風遠走 提交于 2019-12-03 17:37:03
问题 I am working with a multithreaded embedded application. Each thread is allocated stack sizes based on its functionality. Recently we found that one of the thread corrupted the stack by defining a array of local variables that was more than the stack size. The OS is uItron. My solution, I registered a timer for 10 mS, and this timer will check for stack corruption. Stack corruption checking method, 1. Initialize the stack memory with some unique pattern (I use 0x5A5A5A5A) 2. Check from the

Is there a programmatic way to check stack corruption

浪子不回头ぞ 提交于 2019-12-03 06:30:28
I am working with a multithreaded embedded application. Each thread is allocated stack sizes based on its functionality. Recently we found that one of the thread corrupted the stack by defining a array of local variables that was more than the stack size. The OS is uItron. My solution, I registered a timer for 10 mS, and this timer will check for stack corruption. Stack corruption checking method, 1. Initialize the stack memory with some unique pattern (I use 0x5A5A5A5A) 2. Check from the time if top of the stack memory is still 0x5A5A5A5A My question, Is there a better way to check this type