feat(ebpf/python): add CPython 3.14 offsets#3
Conversation
Python 3.14 processes were not profiled: pyVersions had no {3, 14, *}
entry, so GetUserOffsets returned "unsupported version" (patch-guessing
only spans a single major.minor). Add the 3.14.0 offsets for amd64 and
arm64, generated by python_dwarfdump from a release-config CPython 3.14.0
build (--enable-shared, -gdwarf-4, no --with-pydebug). amd64 and arm64
offsets are identical, matching the existing 3.13 entries.
Offsets reflect real 3.14 layout changes verified with pahole, e.g.
PyTupleObject gained Py_hash_t ob_hash, moving ob_item from 24 to 32.
The offset-driven eBPF unwinder and the existing >= Py313 code path
handle 3.14 with no further changes.
Also make python_dwarfdump tolerant of forward-declaration DIEs
(DW_AT_declaration, no byte_size) that modern GCC emits across
compilation units: GetTypeByName2 now skips the incomplete entry and
keeps the complete definition instead of panicking.
Signed-off-by: Gaál György <gb12335@gmail.com>
|
Some verification notes for reviewers. How the offsets were producedGenerated with this repo's own ./configure --enable-shared CFLAGS="-O2 -gdwarf-4" # no --with-pydebug
make -j
go run ./cmd/python_dwarfdump libpython3.14.so.1.0No Proofsamd64 and arm64 offsets are identical (as with every existing entry — these fields are LP64 layout-independent). The one surprising value is real. Resolution + no code-path change. Runtime A/B against a live
Fixes the Python 3.14 profiling gap reported in coroot/coroot-node-agent#318. What's nextAfter this merges I'll bump the |
Problem
Python 3.14 processes are not profiled.
pyVersionshas no{3, 14, *}entry, so
GetUserOffsetsreturnsunsupported version— patch-guessingonly spans a single
major.minor, so it never falls back across a minorboundary. This surfaces downstream as coroot/coroot-node-agent#318 (no
profiles for Python 3.14 workloads).
Change
Add the CPython 3.14.0 offsets for
amd64andarm64.Offsets were produced by the existing
python_dwarfdumpgenerator from arelease-configuration CPython 3.14.0 build (
./configure --enable-shared CFLAGS="-O2 -gdwarf-4", no--with-pydebug), so the layout matchesthe official
python:3.14images (PyObjectis 16 bytes — a GIL build,not free-threaded). The amd64 and arm64 rows are identical, consistent
with every existing entry.
The offsets reflect real 3.14 layout changes, cross-checked with
pahole:PyTupleObjectgainedPy_hash_t ob_hashat offset 24, movingob_itemfrom 24 to 32.
_PyInterpreterFramelocalsplus/ownerand_PyRuntimeStategilstate/autoTSSkeyshifted.No unwinder changes are needed: the eBPF program is offset-driven and the
existing
version.Compare(Py313) >= 0code path (PyCFrame removed,current_frameused as the frame field) applies unchanged to 3.14. Alocal test confirms
GetUserOffsetsresolves 3.14.0 exactly and3.14.x via patch-guessing.
Generator robustness
python_dwarfdumppanicked on the 3.14 build: modern GCC emits aforward-declaration DIE for
pyruntimestate(DW_AT_declaration, nobyte_size) in one compilation unit alongside the complete definitions inothers.
GetTypeByName2now skips the incomplete entry and keeps thecomplete definition instead of panicking.