When I run into a fault handler on my ARM cortex-M4 (Thumb) I get a snapshot of the CPU register just before the fault occured. With this information I can find the stack pointer where it was. Now, what I want is to backtrace through all functions it passed. The only problem I see here is that I don't have a frame pointer, so I cannot really see where a certain subroutine has saved the LR, ad infinitum.
How would one tackle this problem if the frame pointer is not available in r7?
while (1)
's, or otherwise), won't push the LR, as it'll never use it again. In these cases you can use a non-const object-global variable in the while (while (dummy == 0)
), to trick the compiler, and make it think the function can return. Could this match the problem you have? – dromtrund