mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/heap_trace_invalid_addr_v3.3' into 'release/v3.3'
heap: fix backtrace termination (v3.3) See merge request espressif/esp-idf!13899
This commit is contained in:
commit
e2015eb371
@ -69,3 +69,15 @@ TEST_CASE("Test backtrace from interrupt watchdog timeout", "[reset_reason][rese
|
|||||||
backtrace_trigger_source = ACTION_INT_WDT;
|
backtrace_trigger_source = ACTION_INT_WDT;
|
||||||
recursive_func(RECUR_DEPTH, SW_ISR_LEVEL_1); //Trigger lvl 1 SW interrupt at max recursive depth
|
recursive_func(RECUR_DEPTH, SW_ISR_LEVEL_1); //Trigger lvl 1 SW interrupt at max recursive depth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void write_char_crash(char c)
|
||||||
|
{
|
||||||
|
ets_write_char_uart(c);
|
||||||
|
*(char*) 0x00000001 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Test backtrace with a ROM function", "[reset_reason][reset=StoreProhibited,SW_CPU_RESET]")
|
||||||
|
{
|
||||||
|
ets_install_putc1(&write_char_crash);
|
||||||
|
ets_printf("foo");
|
||||||
|
}
|
||||||
|
@ -271,6 +271,15 @@ inline static uint32_t get_ccount(void)
|
|||||||
return ccount;
|
return ccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Architecture-specific return value of __builtin_return_address which
|
||||||
|
* should be interpreted as an invalid address.
|
||||||
|
*/
|
||||||
|
#ifdef __XTENSA__
|
||||||
|
#define HEAP_ARCH_INVALID_PC 0x40000000
|
||||||
|
#else
|
||||||
|
#define HEAP_ARCH_INVALID_PC 0x00000000
|
||||||
|
#endif
|
||||||
|
|
||||||
// Caller is 2 stack frames deeper than we care about
|
// Caller is 2 stack frames deeper than we care about
|
||||||
#define STACK_OFFSET 2
|
#define STACK_OFFSET 2
|
||||||
|
|
||||||
@ -278,8 +287,9 @@ inline static uint32_t get_ccount(void)
|
|||||||
if (STACK_DEPTH == N) { \
|
if (STACK_DEPTH == N) { \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
callers[N] = __builtin_return_address(N+STACK_OFFSET); \
|
callers[N] = __builtin_return_address(N+STACK_OFFSET); \
|
||||||
if (!esp_ptr_executable(callers[N])) { \
|
if (!esp_ptr_executable(callers[N]) \
|
||||||
|
|| callers[N] == (void*) HEAP_ARCH_INVALID_PC) { \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user