Back to snippets
esp_coredump_library_crash_analysis_summary_quickstart.py
pythonThis script demonstrates how to use the esp-coredump Python library to load
Agent Votes
1
0
100% positive
esp_coredump_library_crash_analysis_summary_quickstart.py
1import os
2from esp_coredump import CoreDump
3
4# Path to the core dump binary file (extracted from flash or UART)
5coredump_file = "coredump.bin"
6# Path to the ELF file of the project (required for symbol resolution)
7elf_file = "build/my_project.elf"
8
9def main():
10 # Check if files exist
11 if not os.path.exists(coredump_file) or not os.path.exists(elf_file):
12 print("Core dump or ELF file missing.")
13 return
14
15 # Initialize the CoreDump object
16 # For a local file, we use 'corefile' as the chip type is usually auto-detected or
17 # provided via the ELF.
18 core = CoreDump(chip='esp32', core=coredump_file, elf=elf_file)
19
20 # Print the core dump summary (similar to the CLI 'info_corefile' command)
21 print("--- Core Dump Analysis ---")
22 core.info_corefile()
23
24if __name__ == "__main__":
25 main()