]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: add experimental option --enable-py-limited-api
authorMatthieu Longo <matthieu.longo@arm.com>
Fri, 11 Jul 2025 16:39:41 +0000 (17:39 +0100)
committerMatthieu Longo <matthieu.longo@arm.com>
Wed, 15 Oct 2025 15:23:21 +0000 (16:23 +0100)
commitabe6b29caf476f9760ce4b7bedf982e4ca762649
tree10a5bb8f506cc12601ce611064f12f18b2efa55d
parent5643188363374dfa776497b2b42b5c9920b2349c
gdb: add experimental option --enable-py-limited-api

Today, GDB links against the Python library using the unstable API. This
approach causes portability issues of the generated GDB artifact. Indeed
the built artifact is tighly coupled with the specific version of Python
that it was compiled with. Using a slighly minor version of Python can
cause unpredictable crashes at runtime due to ABI instability between
the Python versions, even minor ones.

The solution would consist in restricting the usage of Python functions
to the limited C API controlled via Py_LIMITED_API that must be defined
before the inclusion of <Python.h>.

This patch does not aim at porting the whole GDB codebase to the Python
limited C API, but rather enabling a development mode where developers
can experiment with the Python limited C API, and fix issues.
This development mode is accessible with the configure option
--enable-py-limited-api which is set by default to 'no'.

Note: the version of the Python limited API is currently set to 3.11
because of PyBuffer_FillInfo and PyBuffer_Release. This choice is not
frozen, and could be reviewed later on depending on newly discovered
issues during the migration.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23830
Approved-By: Tom Tromey <tom@tromey.com>
gdb/config.in
gdb/configure
gdb/configure.ac