forked from espressif/esp-idf
Merge branch 'bugfix/panic_instr_fetch_prohibited_v4.2' into 'release/v4.2'
panic: don't interrupt the backtrace for InstrFetchProhibited exceptions (v4.2) See merge request espressif/esp-idf!10293
This commit is contained in:
@ -158,7 +158,9 @@ static void print_backtrace(const void *f, int core)
|
|||||||
|
|
||||||
//Check if first frame is valid
|
//Check if first frame is valid
|
||||||
bool corrupted = !(esp_stack_ptr_is_sane(stk_frame.sp) &&
|
bool corrupted = !(esp_stack_ptr_is_sane(stk_frame.sp) &&
|
||||||
esp_ptr_executable((void *)esp_cpu_process_stack_pc(stk_frame.pc)));
|
(esp_ptr_executable((void *)esp_cpu_process_stack_pc(stk_frame.pc)) ||
|
||||||
|
/* Ignore the first corrupted PC in case of InstrFetchProhibited */
|
||||||
|
frame->exccause == EXCCAUSE_INSTR_PROHIBITED));
|
||||||
|
|
||||||
uint32_t i = ((depth <= 0) ? INT32_MAX : depth) - 1; //Account for stack frame that's already printed
|
uint32_t i = ((depth <= 0) ? INT32_MAX : depth) - 1; //Account for stack frame that's already printed
|
||||||
while (i-- > 0 && stk_frame.next_pc != 0 && !corrupted) {
|
while (i-- > 0 && stk_frame.next_pc != 0 && !corrupted) {
|
||||||
@ -457,7 +459,7 @@ static void frame_to_panic_info(XtExcFrame *frame, panic_info_t *info, bool pseu
|
|||||||
|
|
||||||
info->description = "Exception was unhandled.";
|
info->description = "Exception was unhandled.";
|
||||||
|
|
||||||
if (info->reason == reason[0]) {
|
if (frame->exccause == EXCCAUSE_ILLEGAL) {
|
||||||
info->details = print_illegal_instruction_details;
|
info->details = print_illegal_instruction_details;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,8 +174,8 @@ menu "FreeRTOS"
|
|||||||
|
|
||||||
config FREERTOS_ISR_STACKSIZE
|
config FREERTOS_ISR_STACKSIZE
|
||||||
int "ISR stack size"
|
int "ISR stack size"
|
||||||
range 2100 32768 if ESP32_COREDUMP_DATA_FORMAT_ELF
|
range 2096 32768 if ESP32_COREDUMP_DATA_FORMAT_ELF
|
||||||
default 2100 if ESP32_COREDUMP_DATA_FORMAT_ELF
|
default 2096 if ESP32_COREDUMP_DATA_FORMAT_ELF
|
||||||
range 1536 32768
|
range 1536 32768
|
||||||
default 1536
|
default 1536
|
||||||
help
|
help
|
||||||
|
@ -192,10 +192,16 @@ int xt_clock_freq(void) __attribute__((deprecated));
|
|||||||
#define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE
|
#define configIDLE_TASK_STACK_SIZE CONFIG_FREERTOS_IDLE_TASK_STACKSIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The Xtensa port uses a separate interrupt stack. Adjust the stack size */
|
/* Stack alignment, architecture specifc. Must be a power of two. */
|
||||||
/* to suit the needs of your specific application. */
|
#define configSTACK_ALIGNMENT 16
|
||||||
|
|
||||||
|
/* The Xtensa port uses a separate interrupt stack. Adjust the stack size
|
||||||
|
* to suit the needs of your specific application.
|
||||||
|
* Size needs to be aligned to the stack increment, since the location of
|
||||||
|
* the stack for the 2nd CPU will be calculated using configISR_STACK_SIZE.
|
||||||
|
*/
|
||||||
#ifndef configISR_STACK_SIZE
|
#ifndef configISR_STACK_SIZE
|
||||||
#define configISR_STACK_SIZE CONFIG_FREERTOS_ISR_STACKSIZE
|
#define configISR_STACK_SIZE ((CONFIG_FREERTOS_ISR_STACKSIZE + configSTACK_ALIGNMENT - 1) & (~(configSTACK_ALIGNMENT - 1)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Minimal heap size to make sure examples can run on memory limited
|
/* Minimal heap size to make sure examples can run on memory limited
|
||||||
|
@ -10,7 +10,7 @@ def test_panic_task_wdt(env, extra_data):
|
|||||||
dut.expect("CPU 0: main")
|
dut.expect("CPU 0: main")
|
||||||
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
||||||
dut.expect_none("register dump:")
|
dut.expect_none("register dump:")
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("CORRUPTED", "Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
@ -21,12 +21,12 @@ def test_panic_int_wdt(env, extra_data):
|
|||||||
with get_dut(env, "panic", "test_int_wdt", qemu_wdt_enable=True) as dut:
|
with get_dut(env, "panic", "test_int_wdt", qemu_wdt_enable=True) as dut:
|
||||||
dut.expect_gme("Interrupt wdt timeout on CPU0")
|
dut.expect_gme("Interrupt wdt timeout on CPU0")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect_reg_dump(1)
|
dut.expect_reg_dump(1)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ def test_cache_error(env, extra_data):
|
|||||||
dut.expect("Re-enable cpu cache.")
|
dut.expect("Re-enable cpu cache.")
|
||||||
dut.expect_gme("Cache disabled but cached memory region accessed")
|
dut.expect_gme("Cache disabled but cached memory region accessed")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -48,12 +48,12 @@ def test_panic_int_wdt_cache_disabled(env, extra_data):
|
|||||||
dut.expect("Re-enable cpu cache.")
|
dut.expect("Re-enable cpu cache.")
|
||||||
dut.expect_gme("Interrupt wdt timeout on CPU0")
|
dut.expect_gme("Interrupt wdt timeout on CPU0")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect_reg_dump(1)
|
dut.expect_reg_dump(1)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +62,8 @@ def test_panic_abort(env, extra_data):
|
|||||||
with get_dut(env, "panic", "test_abort") as dut:
|
with get_dut(env, "panic", "test_abort") as dut:
|
||||||
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
||||||
dut.expect_none("register dump:")
|
dut.expect_none("register dump:")
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -72,9 +72,9 @@ def test_panic_storeprohibited(env, extra_data):
|
|||||||
with get_dut(env, "panic", "test_storeprohibited") as dut:
|
with get_dut(env, "panic", "test_storeprohibited") as dut:
|
||||||
dut.expect_gme("StoreProhibited")
|
dut.expect_gme("StoreProhibited")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +84,9 @@ def test_panic_stack_overflow(env, extra_data):
|
|||||||
dut.expect_gme("Unhandled debug exception")
|
dut.expect_gme("Unhandled debug exception")
|
||||||
dut.expect("Stack canary watchpoint triggered (main)")
|
dut.expect("Stack canary watchpoint triggered (main)")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -95,9 +95,9 @@ def test_panic_illegal_instruction(env, extra_data):
|
|||||||
with get_dut(env, "panic", "test_illegal_instruction") as dut:
|
with get_dut(env, "panic", "test_illegal_instruction") as dut:
|
||||||
dut.expect_gme("IllegalInstruction")
|
dut.expect_gme("IllegalInstruction")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
|
|
||||||
|
|
||||||
@ -106,10 +106,7 @@ def test_panic_instr_fetch_prohibited(env, extra_data):
|
|||||||
with get_dut(env, "panic", "test_instr_fetch_prohibited") as dut:
|
with get_dut(env, "panic", "test_instr_fetch_prohibited") as dut:
|
||||||
dut.expect_gme("InstrFetchProhibited")
|
dut.expect_gme("InstrFetchProhibited")
|
||||||
dut.expect_reg_dump(0)
|
dut.expect_reg_dump(0)
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
# At the moment the backtrace is corrupted, need to jump over the first PC in case of InstrFetchProhibited.
|
|
||||||
# Fix this and change expect to expect_none.
|
|
||||||
dut.expect("CORRUPTED")
|
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("Guru Meditation")
|
dut.expect_none("Guru Meditation")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
@ -119,9 +116,9 @@ def test_panic_instr_fetch_prohibited(env, extra_data):
|
|||||||
def test_coredump_uart_abort(env, extra_data):
|
def test_coredump_uart_abort(env, extra_data):
|
||||||
with get_dut(env, "coredump_uart", "test_abort") as dut:
|
with get_dut(env, "coredump_uart", "test_abort") as dut:
|
||||||
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation", "Re-entered core dump")
|
dut.expect_none("Guru Meditation", "Re-entered core dump")
|
||||||
dut.expect(dut.COREDUMP_UART_END)
|
dut.expect(dut.COREDUMP_UART_END)
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
dut.process_coredump_uart()
|
dut.process_coredump_uart()
|
||||||
@ -148,9 +145,9 @@ def test_coredump_uart_int_wdt(env, extra_data):
|
|||||||
def test_coredump_flash_abort(env, extra_data):
|
def test_coredump_flash_abort(env, extra_data):
|
||||||
with get_dut(env, "coredump_flash", "test_abort") as dut:
|
with get_dut(env, "coredump_flash", "test_abort") as dut:
|
||||||
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
dut.expect(re.compile(r"abort\(\) was called at PC [0-9xa-f]+ on core 0"))
|
||||||
dut.expect("Backtrace:")
|
dut.expect_backtrace()
|
||||||
dut.expect_elf_sha256()
|
dut.expect_elf_sha256()
|
||||||
dut.expect_none("CORRUPTED", "Guru Meditation", "Re-entered core dump")
|
dut.expect_none("Guru Meditation", "Re-entered core dump")
|
||||||
dut.expect("Rebooting...")
|
dut.expect("Rebooting...")
|
||||||
dut.process_coredump_flash()
|
dut.process_coredump_flash()
|
||||||
# TODO: check the contents of core dump output
|
# TODO: check the contents of core dump output
|
||||||
|
@ -76,6 +76,10 @@ class PanicTestMixin(object):
|
|||||||
elf_sha256_len = int(sdkconfig.get("CONFIG_APP_RETRIEVE_LEN_ELF_SHA", "16"))
|
elf_sha256_len = int(sdkconfig.get("CONFIG_APP_RETRIEVE_LEN_ELF_SHA", "16"))
|
||||||
self.expect("ELF file SHA256: " + elf_sha256[0:elf_sha256_len])
|
self.expect("ELF file SHA256: " + elf_sha256[0:elf_sha256_len])
|
||||||
|
|
||||||
|
def expect_backtrace(self):
|
||||||
|
self.expect("Backtrace:")
|
||||||
|
self.expect_none("CORRUPTED")
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self._raw_data = None
|
self._raw_data = None
|
||||||
return self
|
return self
|
||||||
|
Reference in New Issue
Block a user