From 112cf24d5be890fd50808d924f951a1f5f0953fa Mon Sep 17 00:00:00 2001 From: Jaroslav Burian Date: Mon, 5 Aug 2024 13:55:16 +0200 Subject: [PATCH] fix: Catch exception when the ELF file is modified This commit fixes the issue where the ELF file is modified while the panic decoder is running. The decoder now catches the exception and prints a error message. Closes https://github.com/espressif/esp-idf-panic-decoder/issues/1 --- esp_idf_panic_decoder/pc_address_decoder.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esp_idf_panic_decoder/pc_address_decoder.py b/esp_idf_panic_decoder/pc_address_decoder.py index dc6144a..7161313 100644 --- a/esp_idf_panic_decoder/pc_address_decoder.py +++ b/esp_idf_panic_decoder/pc_address_decoder.py @@ -61,4 +61,7 @@ def lookup_pc_address(self, pc_addr: str, is_rom: bool = False) -> Optional[str] return decoded if not is_rom else decoded.replace('at ??:?', 'in ROM') except OSError as err: red_print(f'{" ".join(cmd)}: {err}') + except subprocess.CalledProcessError as err: + red_print(f'{" ".join(cmd)}: {err}') + red_print('ELF file is missing or has changed, the build folder was probably modified.') return None