Skip to content

Add kdumpling Python library for building Linux kdump files#1

Merged
sdimitro merged 7 commits intodevelopfrom
claude/kdump-python-library-YjHVx
Jan 28, 2026
Merged

Add kdumpling Python library for building Linux kdump files#1
sdimitro merged 7 commits intodevelopfrom
claude/kdump-python-library-YjHVx

Conversation

@sdimitro
Copy link
Copy Markdown
Owner

Implements a minimal MVP with:

  • KdumpBuilder class with fluent API for creating vmcore files
  • Support for setting vmcoreinfo metadata
  • Support for adding memory segments at physical addresses
  • ELF64 header and program header generation
  • PT_NOTE section with VMCOREINFO
  • PT_LOAD sections for memory data
  • Multi-architecture support (x86_64, aarch64, s390x, ppc64, riscv64)

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU

Implements a minimal MVP with:
- KdumpBuilder class with fluent API for creating vmcore files
- Support for setting vmcoreinfo metadata
- Support for adding memory segments at physical addresses
- ELF64 header and program header generation
- PT_NOTE section with VMCOREINFO
- PT_LOAD sections for memory data
- Multi-architecture support (x86_64, aarch64, s390x, ppc64, riscv64)

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add comprehensive pytest tests using pyelftools for ELF validation
- Add type hints and py.typed marker for PEP 561 compliance
- Set up GitHub Actions CI workflow with:
  - Linting and formatting (ruff)
  - Type checking (mypy)
  - Tests across Python 3.8-3.12
- Configure ruff and mypy in pyproject.toml

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add cpu_context.py with architecture-specific register layouts:
  - x86_64: 27 registers (RIP, RSP, RBP, RAX, etc.)
  - aarch64: 34 registers (X0-X30, SP, PC, PSTATE)
  - s390x, ppc64, riscv64: basic support
- Add pack_prstatus() for creating NT_PRSTATUS note data
- Add KdumpBuilder.add_cpu_context() method for fluent API
- Add tests for single/multiple CPU contexts
- Verified with drgn debugger (opens and recognizes as Linux kernel dump)

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add test_drgn_integration.py with 6 tests validating:
  - drgn can open generated vmcores
  - Platform/architecture detection works correctly
  - Linux kernel flag is recognized
  - CPU context notes are accepted
  - Endianness is correctly detected
- Add drgn as optional test dependency
- Update CI to run drgn tests on Python 3.9+
- Add release.yml workflow that:
  - Triggers on version tags (vX.Y.Z)
  - Builds source and wheel distributions
  - Tests the built package
  - Publishes to TestPyPI and PyPI
  - Creates GitHub release with artifacts

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add install-libkdumpfile.sh script to build from source with Python bindings
- Add test_libkdumpfile_integration.py with 6 tests:
  - Opening vmcore files
  - Reading vmcoreinfo attributes
  - Memory segment access
  - CPU context support
  - Architecture detection
  - Multiple memory segments
- Add CI job to run libkdumpfile tests (builds from Codeberg source)
- Tests gracefully skip when kdumpfile module is not installed

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add DumpStats dataclass with statistics about dumps (architecture,
  memory segments, CPU contexts, sizes, etc.)
- Add stats property to KdumpBuilder for inspection
- Add human-readable size formatting methods
- Add 8 new tests for statistics API (41 total tests)
- Create ReadTheDocs documentation with Sphinx config
- Add quickstart guide and API reference docs
- Create README.md with CI, PyPI, Python version, and license badges

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
- Add logo to README.md and docs homepage
- Create tests/conftest.py with shared fixtures:
  - Common vmcoreinfo constants for all architectures
  - vmcore_output_path fixture for automatic cleanup
  - Test data constants (patterns, addresses)
- Refactor test_drgn_integration.py to use shared fixtures
- Refactor test_libkdumpfile_integration.py to use shared fixtures
- Remove duplicated vmcoreinfo definitions across test files

https://claude.ai/code/session_017YyEoftir1U4kuDrRffjjU
@sdimitro sdimitro merged commit 2449ef2 into develop Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants