mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
`s = m.lookup(k); s.count = 5` (and `s.count += 1`) compiled without an error to IR llc rejects: "invalid getelementptr indices" on `getelementptr inbounds i64*, i64** %s, i32 0, i32 0`. Both the assignment and augmented-assignment paths indexed into the local's own slot, which for a lookup or cast local holds a pointer to the struct, not the struct. Reads already got this right in access_struct_field. with_struct_field_ptr now resolves a field for a write the same way: directly for a struct local; for a pointer local, by loading the pointer, casting it to the struct type, and emitting the store only on the non-null path (emit_if_not_null, the write-side counterpart of _null_checked_operation). The write lands in the map entry itself, so `s.count += 1` is an in-place update with no update() call, and the maps/structs guide examples that did update(k, s) after a field assignment now just assign.
PythonBPF Documentation
This directory contains the Sphinx documentation for PythonBPF.
Building the Documentation
Prerequisites
Install the documentation dependencies:
Using uv (recommended):
uv pip install -r requirements.txt
# Or install the optional docs dependencies
uv pip install pythonbpf[docs]
Using pip:
pip install -r requirements.txt
# Or install the optional docs dependencies
pip install pythonbpf[docs]
Build HTML Documentation
make html
The generated documentation will be in _build/html/. Open _build/html/index.html in a browser to view.
Other Build Formats
make latexpdf # Build PDF documentation
make epub # Build ePub format
make clean # Clean build artifacts
Documentation Structure
index.md- Main landing pagegetting-started/- Installation and quick start guidesuser-guide/- Comprehensive user documentationapi/- API reference documentationconf.py- Sphinx configuration_static/- Static files (images, CSS, etc.)
Writing Documentation
Documentation is written in Markdown using MyST-Parser. See the existing files for examples.