From 981e9728390b401404c36241e2ce6bd4cfcb723d Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 16 May 2022 14:33:26 +0100 Subject: mips: add native backtrace implementation Should make debugging crashes on native MIPS targets far easier. This is by no means a 100% complete or robust implementation but it seems to handle the vast majority of functions. Change-Id: Id5f430270e02b5092b79026b6876675c784aa649 --- firmware/panic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'firmware/panic.c') diff --git a/firmware/panic.c b/firmware/panic.c index fcfa8b2bb8..586ecb6e0a 100644 --- a/firmware/panic.c +++ b/firmware/panic.c @@ -32,9 +32,9 @@ #include "system.h" #include "logf.h" -#if defined(CPU_ARM) +#ifdef HAVE_RB_BACKTRACE #include "gcc_extensions.h" -#include +#include "backtrace.h" #endif static char panic_buf[128]; @@ -65,6 +65,12 @@ void panicf_f( const char *fmt, ...) ); int pc = (int)__builtin_return_address(0); +#elif defined(BACKTRACE_MIPSUNWINDER) +void panicf( const char *fmt, ... ) +{ + /* NOTE: these are obtained by the backtrace lib */ + const int pc = 0; + const int sp = 0; #else void panicf( const char *fmt, ...) { -- cgit v1.2.3