Keil MDK ARM has cool feature named "Call Stack + Locals". While debugging in this windows we can see order of functions call (stacktrace) and local variables. Is it possible with MDK ARM save the stack trace in MCU's memory?
But if the system has access to nonvolatile memory, it can be an idea to store the registers + stack content
As I mentioned before, that idea suffers from the problem that once you're in such a dire situation that performing this core dump turns into a good idea, the system is most likely no longer able to do this, nor send the crash dump over some communication link.
Now you might think you can get around this problem by setting the stack reserve threshold for triggering the core-dump so high that the dump itself will always work. Unfortunately that means you have to dump core in quite a few situations when this would not otherwise have been necessary. I.e. this approach would make worse the disease it was supposed to help diagnose.