forked from len0rd/rockbox
Arm stack unwinder
Simplified stack unwinder for ARM. This is port of http://www.mcternan.me.uk/ArmStackUnwinding/ backtrace() is called from UIE() on native targets and from panicf() on both native and ARM RaaA. Change-Id: I8e4b3c02490dd60b30aa372fe842d193b8929ce0
This commit is contained in:
parent
680c6fcde1
commit
b4eab59951
23 changed files with 2630 additions and 18 deletions
|
@ -31,14 +31,42 @@
|
|||
#include "power.h"
|
||||
#include "system.h"
|
||||
|
||||
#if defined(CPU_ARM)
|
||||
#include "gcc_extensions.h"
|
||||
#include <backtrace.h>
|
||||
#endif
|
||||
|
||||
static char panic_buf[128];
|
||||
#define LINECHARS (LCD_WIDTH/SYSFONT_WIDTH) - 2
|
||||
|
||||
#if defined(CPU_ARM)
|
||||
void panicf_f( const char *fmt, ...);
|
||||
|
||||
/* we wrap panicf() here with naked function to catch SP value */
|
||||
void panicf( const char *fmt, ...)
|
||||
{
|
||||
(void)fmt;
|
||||
asm volatile ("mov r4, sp \n"
|
||||
"b panicf_f \n"
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* "Dude. This is pretty fucked-up, right here."
|
||||
*/
|
||||
void panicf_f( const char *fmt, ...)
|
||||
{
|
||||
int sp;
|
||||
|
||||
asm volatile ("mov %[SP],r4 \n"
|
||||
: [SP] "=r" (sp)
|
||||
);
|
||||
|
||||
int pc = (int)__builtin_return_address(0);
|
||||
#else
|
||||
void panicf( const char *fmt, ...)
|
||||
{
|
||||
#endif
|
||||
va_list ap;
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
||||
|
@ -82,6 +110,10 @@ void panicf( const char *fmt, ...)
|
|||
panic_buf[i+LINECHARS] = c;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPU_ARM)
|
||||
backtrace(pc, sp, &y);
|
||||
#endif
|
||||
#else
|
||||
/* no LCD */
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue