From: Matthieu Longo <matthieu.longo@arm.com>
To: <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>, Matthieu Longo <matthieu.longo@arm.com>
Subject: [PATCH v2 0/6] gdb: minor fixes for Python limited C API support
Date: Tue, 27 Jan 2026 17:02:09 +0000 [thread overview]
Message-ID: <20260127170215.1803582-1-matthieu.longo@arm.com> (raw)
This patch series fixes a set of minor issues encountered while enabling the Python limited C API in GDB, and starts preparing the ground for migrating the existing C extension types from static types to heap-allocated ones, by removing the dependency on tp_dictoffset, which is unavailable when using the limited API. Those fixes were accumulated during the migration work, and are intentionally split out from an upcoming larger patch series. The first three patches in the series are small, and self-contained fixes. The next three ones continue the work undertaken in the third one, and have a dependency on previous patches.
All changes were tested by building GDB against the limited API and unlimited API, and no regressions were observed in the testsuite.
# Revision 1 -> 2
Patch series v1: https://inbox.sourceware.org/gdb-patches/20260107165606.1719366-1-matthieu.longo@arm.com
Major changes since the last revision:
- addressed minor comments on patch 1 and 2.
- patch 3: inherits from PyObject.
New:
- patch 4: inherits from PyObject, but also had to provide a different approach to provide a dict because offsetof does not work anymore with inheritance. Anyway, this had to be fixed so two birds with one stone.
- patch 5: enforces that the template type is a subclass of PyObject in gdbpy_ref_policy.
- patch 6: finish migrating all the remaing declarations.
Regards,
Matthieu
Matthieu Longo (6):
Python limited API: migrate Py_CompileStringExFlags and PyRun_SimpleString
Python limited API: migrate PyImport_ExtendInittab
gdbpy_registry: cast C extension type object to PyObject * before Py_XINCREF
gdb: new setters and getters for __dict__, and attributes
gdb: cast all Python extension objects passed to gdbpy_ref_policy to PyObject*
gdb: make remaining Python extension objects inherit from PyObject
gdb/python/py-arch.c | 4 +-
gdb/python/py-block.c | 8 +--
gdb/python/py-breakpoint.c | 4 +-
gdb/python/py-cmd.c | 4 +-
gdb/python/py-color.c | 4 +-
gdb/python/py-connection.c | 4 +-
gdb/python/py-corefile.c | 26 +++-------
gdb/python/py-disasm.c | 16 ++----
gdb/python/py-event.c | 10 ++--
gdb/python/py-event.h | 8 +--
gdb/python/py-events.h | 4 +-
gdb/python/py-frame.c | 4 +-
gdb/python/py-gdb-readline.c | 5 +-
gdb/python/py-inferior.c | 29 ++---------
gdb/python/py-infthread.c | 10 ++--
gdb/python/py-instruction.c | 5 +-
gdb/python/py-lazy-string.c | 5 +-
gdb/python/py-linetable.c | 12 ++---
gdb/python/py-membuf.c | 5 +-
gdb/python/py-micmd.c | 4 +-
gdb/python/py-objfile.c | 18 +++----
gdb/python/py-param.c | 4 +-
gdb/python/py-prettyprint.c | 6 +--
gdb/python/py-progspace.c | 18 +++----
gdb/python/py-record-btrace.c | 5 +-
gdb/python/py-record.c | 4 +-
gdb/python/py-record.h | 8 +--
gdb/python/py-ref.h | 47 ++++++++++++++++-
gdb/python/py-registers.c | 20 +++-----
gdb/python/py-style.c | 4 +-
gdb/python/py-symbol.c | 4 +-
gdb/python/py-symtab.c | 8 +--
gdb/python/py-tui.c | 4 +-
gdb/python/py-type.c | 26 ++++------
gdb/python/py-unwind.c | 8 +--
gdb/python/py-utils.c | 95 +++++++++++++++++++++++++++++++----
gdb/python/py-value.c | 4 +-
gdb/python/python-internal.h | 47 ++++++++++++-----
gdb/python/python.c | 27 ++++------
39 files changed, 281 insertions(+), 247 deletions(-)
--
2.52.0
next reply other threads:[~2026-01-27 17:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 17:02 Matthieu Longo [this message]
2026-01-27 17:02 ` [PATCH v2 1/6] Python limited API: migrate Py_CompileStringExFlags and PyRun_SimpleString Matthieu Longo
2026-01-27 17:54 ` Tom Tromey
2026-01-27 17:02 ` [PATCH v2 2/6] Python limited API: migrate PyImport_ExtendInittab Matthieu Longo
2026-01-27 17:54 ` Tom Tromey
2026-01-27 17:02 ` [PATCH v2 3/6] gdbpy_registry: cast C extension type object to PyObject * before Py_XINCREF Matthieu Longo
2026-01-27 18:01 ` Tom Tromey
2026-01-27 18:29 ` Tom Tromey
2026-01-28 11:58 ` Matthieu Longo
2026-01-27 17:02 ` [PATCH v2 4/6] gdb: new setters and getters for __dict__, and attributes Matthieu Longo
2026-01-27 19:06 ` Tom Tromey
2026-01-28 11:57 ` Matthieu Longo
2026-01-28 17:43 ` Matthieu Longo
2026-01-28 17:51 ` Tom Tromey
2026-01-27 17:02 ` [PATCH v2 5/6] gdb: cast all Python extension objects passed to gdbpy_ref_policy to PyObject* Matthieu Longo
2026-01-27 18:28 ` Tom Tromey
2026-01-28 11:58 ` Matthieu Longo
2026-01-27 17:02 ` [PATCH v2 6/6] gdb: make remaining Python extension objects inherit from PyObject Matthieu Longo
2026-01-27 18:29 ` Tom Tromey
2026-01-28 11:58 ` Matthieu Longo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260127170215.1803582-1-matthieu.longo@arm.com \
--to=matthieu.longo@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox