Registry / devops / esp-coredump

esp-coredump

JSON →
library1.16.0pypypi✓ verified 24d ago

esp-coredump is a Python-based utility that aids in the post-mortem analysis of core dumps generated by Espressif chips (e.g., ESP32, ESP32-S3). It helps users retrieve and analyze the software state at the moment of an unrecoverable error, providing insights into crashed tasks, registers, and call stacks. The library is currently at version 1.16.0 and maintains an active release cadence, frequently adding support for new Espressif chips and addressing bugs.

pip install esp-coredump==1.16.0
INSTALL
IMPORT
SIG · ESP-COREDUMP
E
esp-coredump
devopspythonv1.16.0
Install
6.7s avg
Import
307ms
Disk
58MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.16.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.328s · 60.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.7s · import 0.286s · 62MB
58MB installed
● package 58MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CoreDump
from esp_coredump import CoreDump
This is the primary class for interacting with core dump functionality programmatically.

This quickstart demonstrates how to programmatically use `esp-coredump` to analyze a core dump file. It sets up a `CoreDump` object with dummy files for illustration and attempts to retrieve core dump information. For actual usage, replace the dummy paths with your device's core dump and application ELF files.

import os from esp_coredump import CoreDump # --- This is a demonstration with dummy files. --- # In a real scenario, 'coredump.b64' would come from an ESP device # and 'program.elf' would be your firmware's ELF file with debug symbols. # Create dummy core dump and ELF files for the example to run dummy_coredump_b64_content = "hDEAAAEAAAAOAAAAbAEAAA==" # Minimal valid-looking base64 dummy_elf_content = b"\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00" # Minimal ELF header with open("dummy_coredump.b64", "w") as f: f.write(dummy_coredump_b64_content) with open("dummy_program.elf", "wb") as f: f.write(dummy_elf_content) try: # Instantiate the CoreDump object. # 'chip' must match your target Espressif chip (e.g., 'esp32', 'esp32s3', 'esp32c3'). # 'core' is the path to your core dump file, and 'core_format' specifies its type. # 'prog' is the path to your application's ELF file containing debug symbols. coredump = CoreDump( chip='esp32', core='./dummy_coredump.b64', core_format='b64', prog='./dummy_program.elf', # If GDB is not in your system's PATH, specify its location: # gdb=os.environ.get('ESP_GDB_PATH', None) ) print("--- Attempting to retrieve Core Dump Info ---") # This will print information about the core dump, including task states and call stacks. # With dummy files, this will likely raise an error but demonstrates API usage. coredump.info_corefile() # To start an interactive GDB debugging session: # print("\n--- Starting GDB session (interactive, will block) ---") # coredump.dbg_corefile() except Exception as e: print(f"An error occurred (expected with dummy files for full analysis): {e}") finally: # Clean up dummy files if os.path.exists("dummy_coredump.b64"): os.remove("dummy_coredump.b64") if os.path.exists("dummy_program.elf"): os.remove("dummy_program.elf")
esp-coredump --version
Debug
Known issues
gotchaStandalone usage outside of ESP-IDF requires manual installation of the correct GDB toolchain (e.g., `xtensa-esp-elf-gdb` or `riscv-esp-elf-gdb`) and ensuring it's in your system's PATH. The GDB version must be compatible with the ESP-IDF version used to compile your firmware.
fix
Install the ESP-IDF framework, or download the appropriate `esp-gdb` toolchain (matching your chip and ESP-IDF version) and add its executable directory to your system's PATH. Consult ESP-IDF documentation for specific toolchain versions.
affects: All versions
gotchaInsufficient partition size allocated for the core dump on flash can lead to 'Not enough space to save core dump!' errors during a crash. This prevents the core dump from being saved.
fix
Ensure your `partitions.csv` file defines a `coredump` partition of type 'data' and subtype 'coredump' with adequate size. The required size depends on the number of tasks and stack sizes in your application.
affects: All versions
gotchaWhen Flash Encryption is enabled on the ESP device, core dumps saved to an encrypted flash partition cannot be directly read using `idf.py coredump-info` or `idf.py coredump-debug` from the host. Reading must happen from the ESP, which handles decryption.
fix
To analyze core dumps from encrypted flash, read them directly from the ESP device using `idf.py coredump-info -c <path-to-core-dump>` after the device decrypts and sends it. Alternatively, disable flash encryption for debugging purposes if feasible for development builds.
affects: All versions
breakingPython 3.12 removed the `distutils` module. Older versions of `esp-coredump` might fail if they still rely on `distutils` for setup or internal operations.
fix
Upgrade `esp-coredump` to version 1.12.0 or newer (e.g., `pip install --upgrade esp-coredump`). Version 1.12.0 includes a fix to replace `distutils` with `shutil` for Python 3.12 compatibility.
affects: <1.12.0
gotchaGDB may fail to parse call stacks that involve ROM functions due to missing debug information for the ROM. This can lead to incomplete backtraces.
fix
The ESP-IDF monitor typically handles this by automatically loading the appropriate ROM ELF files based on the target and its revision. When debugging manually, ensure that ROM ELF files are available and loaded if needed.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'esp_coredump'
The 'esp-coredump' Python package is not installed in the active Python environment or its dependencies are missing.
fix
Install the package using pip: `python -m pip install esp-coredump`
GDB executable not found.
The GDB toolchain (e.g., `xtensa-esp32-elf-gdb` or `riscv32-esp-elf-gdb`) required by esp-coredump is not installed, not in the system's PATH, or the ESP-IDF environment variables are not correctly sourced.
fix
Ensure the ESP-IDF toolchain is fully installed and that the ESP-IDF environment script (`export.sh` or `export.bat`) has been sourced in your terminal session to add the toolchain executables to the system's PATH.
PermissionError: [Errno 13] Permission denied
The user lacks the necessary permissions to access the serial port (e.g., `/dev/ttyUSB0` on Linux/macOS) or to create/write temporary files during the core dump analysis process.
fix
For serial port access, add your user to the `dialout` group (Linux: `sudo usermod -a -G dialout $USER` and reboot) or run the command with `sudo`. For temporary file issues, check permissions of the working directory or temporary directories.
A fatal error occurred: Corrupt data, expected X bytes but received Y bytes.
The core dump data read from the device is corrupted, incomplete, or the core dump partition configuration (e.g., size, offset) on the device does not match the expectations of the `esp-coredump` utility.
fix
Verify your core dump partition configuration in `idf.py menuconfig` and your `partitions.csv` file. Ensure the core dump partition size is sufficient and correctly aligned. Sometimes, performing a full chip erase and re-flashing the firmware can resolve data corruption issues.
Upgrade
Version history
1.16.0latest on PyPI · released Apr 8, 2026
Audit
Dependencies
pythonrequiredRuntime requirement
esptoolrequiredUsed internally for flash operations and chip detection; often invoked as a subprocess.
esp-gdb (e.g., xtensa-esp-elf-gdb)requiredRequired for debugging (dbg_corefile) and backtrace analysis, especially when running outside the ESP-IDF environment. Must match the target chip architecture and ESP-IDF version.
Agent activity
17 hits · last 30 days
node
16
Resources
esp-coredump — pip install esp-coredump · libregistry