
Detecting stack overflows on an embedded system - _fs
http://www.netburner.com/learn/detecting-stack-overflows-on-an-embedded-system
======
zwieback
With most ARM processors you can also use the DWT to set hardware watchpoints
on data accesses. The advantage of that approach is that it runs at full speed
and you don't have to instrument your code so you can set guards around your
stack and the debugger/trace unit catches bad accesses.

~~~
_fs
Interesting. I believe this is the same as the hardware watchpoint I
mentioned. I'm not usually working with ARMs, so I do not know for sure.

How would you deal with multiple tasks running? Do you have multiple
watchpoints you can set with an ARM, or would the watch space need to be
changed when switching tasks.

~~~
zwieback
It's at the lowest level so it's unaware of multiple tasks. If there are
multiple stacks you'd have to switch. At that point an MMU would be more
suited to the job but of course that's a whole different environment.

