Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] Use C++ type traits check to catch bugs in Python API
@ 2026-05-15 10:00 Andrew Burgess
  2026-05-15 10:00 ` [PATCH 1/3] gdb/python: add type traits check for all PyObject sub-classes Andrew Burgess
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Andrew Burgess @ 2026-05-15 10:00 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

While looking at a bug with the Python API I realised that we could
make use of static_assert and C++ type traits to catch this class of
bug.

This series has 3 patches, #1 adds the static_assert check to every
place in GDB where we don't currently have a bug.  Patch #2 fixes an
existing bug in GDB, and then adds the final static_assert which
covers this case.  Patch #3 adds a new test that scans the GDB source
code to make sure that there is a suitable static_assert for every
PyObject sub-class, this ensures the static_assert will be added to
any new code going forward.

Thanks,
Andrew

---

Andrew Burgess (3):
  gdb/python: add type traits check for all PyObject sub-classes
  gdb/python: fix use of frame_info_ptr within pending_frame_object
  gdb/testsuite: add a test to check for Python traits static_assert

 gdb/python/py-arch.c                          |   2 +
 gdb/python/py-block.c                         |   4 +
 gdb/python/py-breakpoint.c                    |   2 +
 gdb/python/py-cmd.c                           |   2 +
 gdb/python/py-color.c                         |   2 +
 gdb/python/py-connection.c                    |   2 +
 gdb/python/py-corefile.c                      |   4 +
 gdb/python/py-disasm.c                        |   8 +
 gdb/python/py-events.h                        |   2 +
 gdb/python/py-frame.c                         |   2 +
 gdb/python/py-instruction.c                   |   2 +
 gdb/python/py-lazy-string.c                   |   2 +
 gdb/python/py-linetable.c                     |   6 +
 gdb/python/py-membuf.c                        |   2 +
 gdb/python/py-micmd.c                         |   2 +
 gdb/python/py-param.c                         |   2 +
 gdb/python/py-prettyprint.c                   |   2 +
 gdb/python/py-record-btrace.c                 |   2 +
 gdb/python/py-record.c                        |   2 +
 gdb/python/py-record.h                        |   4 +
 gdb/python/py-ref.h                           |   3 +
 gdb/python/py-registers.c                     |   8 +
 gdb/python/py-style.c                         |   2 +
 gdb/python/py-symbol.c                        |   2 +
 gdb/python/py-symtab.c                        |   4 +
 gdb/python/py-tui.c                           |   2 +
 gdb/python/py-type.c                          |   4 +
 gdb/python/py-unwind.c                        |  55 +++---
 gdb/python/py-value.c                         |   2 +
 gdb/python/python-internal.h                  |   2 +
 gdb/python/python-traits.h                    |  92 +++++++++++
 gdb/testsuite/gdb.gdb/python-traits-check.exp | 156 ++++++++++++++++++
 32 files changed, 368 insertions(+), 20 deletions(-)
 create mode 100644 gdb/python/python-traits.h
 create mode 100644 gdb/testsuite/gdb.gdb/python-traits-check.exp


base-commit: 80491726b42ff67e06e07068e0e29b66b7595a73
-- 
2.25.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-16 12:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-15 10:00 [PATCH 0/3] Use C++ type traits check to catch bugs in Python API Andrew Burgess
2026-05-15 10:00 ` [PATCH 1/3] gdb/python: add type traits check for all PyObject sub-classes Andrew Burgess
2026-05-15 17:10   ` Tom Tromey
2026-05-16 12:27     ` Andrew Burgess
2026-05-15 10:00 ` [PATCH 2/3] gdb/python: fix use of frame_info_ptr within pending_frame_object Andrew Burgess
2026-05-15 17:22   ` Tom Tromey
2026-05-16 12:28     ` Andrew Burgess
2026-05-15 10:00 ` [PATCH 3/3] gdb/testsuite: add a test to check for Python traits static_assert Andrew Burgess
2026-05-15 17:31   ` Tom Tromey
2026-05-16 12:29     ` Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox