panic: skip over the first invalid PC in case of InstrFetchProhibited

InstrFetchProhibited usually occurs because of a jump to an invalid
pointer. In this case, PC in the exception frame is the address of
the jump destination. 'esp_ptr_executable' check in print_backtrace
function recognizes the first frame as invalid, and the backtrace is
interrupted. This prevents the user from finding the location where
the invalid pointer is dereferenced.

Bypass the 'esp_ptr_executable' check if the exception cause is
InstrFetchProhibited. Update the test case to no longer ignore this
issue.
This commit is contained in:
Ivan Grokhotkov
2020-07-29 12:20:52 +02:00
parent 48b659b474
commit 5ff9cd495e
3 changed files with 10 additions and 7 deletions
@@ -76,6 +76,10 @@ class PanicTestMixin(object):
elf_sha256_len = int(sdkconfig.get("CONFIG_APP_RETRIEVE_LEN_ELF_SHA", "16"))
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):
self._raw_data = None
return self