Stack leak detection
Posted: Thu Dec 11, 2014 11:18 am
Hi,
I'd like some feedback on a stack leak detection mechanism I've come up with.
Without nested interrupts the usage of MSTACK should be the same, if captured only in the SYSTEM_TICK_EVENT_HOOK().
I've put this together by writing SP of MSTACK to variable from the event hook. In main the value of that variable is checked against what it was the first time it was written. If it is not, chDbgPanic.
Now, on seemingly random occasions, it throws an chDbgPanic.
From what the registry tells me, this happens soon after it ran threads working with Serial or with Can.
But there is no evidence that excludes ethernet or sdio.
Is this method of detecting stack leaking effective, and reliable?
I am after all assuming ChibiOS is not using nested interrupts, right?
Thanks!
Edit: I now know there is a 40 byte mismatch.
I'd like some feedback on a stack leak detection mechanism I've come up with.
Without nested interrupts the usage of MSTACK should be the same, if captured only in the SYSTEM_TICK_EVENT_HOOK().
I've put this together by writing SP of MSTACK to variable from the event hook. In main the value of that variable is checked against what it was the first time it was written. If it is not, chDbgPanic.
Now, on seemingly random occasions, it throws an chDbgPanic.
From what the registry tells me, this happens soon after it ran threads working with Serial or with Can.
But there is no evidence that excludes ethernet or sdio.
Is this method of detecting stack leaking effective, and reliable?
I am after all assuming ChibiOS is not using nested interrupts, right?
Thanks!
Edit: I now know there is a 40 byte mismatch.