AnsweredAssumed Answered

gdb backtrace/ exception handlers

Question asked by brown.geoffrey on May 24, 2012
Latest reply on Jun 5, 2012 by brown.geoffrey
Very occasionally, my code takes an unexpected exception and ends up in a default handler :)

I'd like to write such a handler so that GDB can successfully unwind the stack.  For example,

default_handler (void) { asm("ldr lr, [sp, #28]"); while(1); }

loads the link register from the value stored when the exception was taken (actually, it should be 24, but this is a quick hack because gcc does an extra push).   With that I can at least see the call chain, but of course the register values aren't right and I don't see the frame that caused the exception.   I'm thinking there's a magic incantation that would set things up so that gdb could properly unwind the stack (e.g. make it look a call to a signal handler ??)

Any thoughts ?