)]}'
{
  "commit": "60cd57ff6ea641cd1261bd7f16f11f2ad6aab727",
  "tree": "e4c4814032acc0cd38a3f98ab609b6e86025e313",
  "parents": [
    "469dcb143c6d19cd741fbf904188534e7696658b"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Thu May 14 09:39:57 2026 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sat May 16 12:44:37 2026 +0100"
  },
  "message": "gdb/python: add type traits check for all PyObject sub-classes\n\nAll of our custom Python types are created as structs, like this:\n\n  struct some_new_type : public PyObject\n  {\n    ... various fields ...\n  };\n\nThen instances of this struct are created by calling PyObject_New,\neither directly within GDB\u0027s C++ code, or within Python when a user\u0027s\nPython script creates an instance of that class.\n\nThe problem is that Python is written in C, and PyObject_New doesn\u0027t\ncall any constructors for `some_new_type`, nor for any of the fields\nwithin `some_new_type`.\n\nIf `some_new_type` is Plain Old Data (POD), then this is fine.  Or, to\nbe more C++ specific, if `some_new_type` is trivially default\nconstructable, then we\u0027re fine.\n\nBut if a field within `some_new_type` has a non-trivial constructor,\nthen we\u0027re in trouble as that constructor will never be run.\n\nAn example of a problematic field type is frame_info_ptr.  The\nconstructor for this type registers the new object with a central\nmanagement object, recording the `this` pointer, using this type within\n`some_new_type` will not work as expected; frame invalidation will not\nshow up within the frame_info_ptr as you might expect.\n\nAnd so, this type trait exists.  Whenever a struct is created to define\na new Python type we should add a line like:\n\n  static_assert (gdb::is_python_allocatable_v\u003csome_new_type\u003e);\n\nThis will fail if any field of `some_new_type` are unsuitable for this\nuse.\n\nWe don\u0027t actually check is_trivially_default_constructible here.  Some\ntypes, e.g. ui_file_style::color, have non-trivial (or no default)\nconstructors, but are still safe to use within `some_new_type` because\ntheir constructors just initialise data fields; there\u0027s nothing\n\"special\" that the constructor does that cannot be achieved by\nassigning the fields after creation with PyObject_New.\n\nWhat actually matters is that the type is trivially destructible\n(Python won\u0027t call C++ destructors, so destructors with side effects,\nlike deregistering from a list, would be skipped) and trivially\ncopyable (Python may copy objects with memcpy).  Types like\nframe_info_ptr, whose constructors and destructors have side effects\nsuch as registering with a central management object, will be caught\nbecause they are neither trivially destructible nor trivially copyable.\nSimple POD types like ui_file_style are trivially destructible and\ncopyable, so pass this trait.\n\nThis commit adds the new type trait, and makes use of it in all cases\nbut one, pending_frame_object in python/py-unwind.c, has a field of\ntype frame_info_ptr, which is currently broken.  This will be fixed,\nand the static_assert added, in the next commit.\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "ac0c40dcf45c7075dcde1f20043e55688ab8e134",
      "old_mode": 33188,
      "old_path": "gdb/python/py-arch.c",
      "new_id": "7a0cb0a2a59802b48e09e93d80af182c81088c21",
      "new_mode": 33188,
      "new_path": "gdb/python/py-arch.c"
    },
    {
      "type": "modify",
      "old_id": "6fe18e455640eccf2505ee7746fc63a58f7f8bfc",
      "old_mode": 33188,
      "old_path": "gdb/python/py-block.c",
      "new_id": "903f800683a06944352470cdec4f9c70ecaa659c",
      "new_mode": 33188,
      "new_path": "gdb/python/py-block.c"
    },
    {
      "type": "modify",
      "old_id": "68d4f77c608357f6a5a8a1147cef70800f883e27",
      "old_mode": 33188,
      "old_path": "gdb/python/py-breakpoint.c",
      "new_id": "d1fec6a770062537d75908a8997455a612cbdab0",
      "new_mode": 33188,
      "new_path": "gdb/python/py-breakpoint.c"
    },
    {
      "type": "modify",
      "old_id": "c515446dad8036953a777537905511c3d446ace5",
      "old_mode": 33188,
      "old_path": "gdb/python/py-cmd.c",
      "new_id": "24938fcda15f44d70373010aab018ce878ef9e70",
      "new_mode": 33188,
      "new_path": "gdb/python/py-cmd.c"
    },
    {
      "type": "modify",
      "old_id": "971209958cf7da0eff5c4c4f8564f9a043bc06b6",
      "old_mode": 33188,
      "old_path": "gdb/python/py-color.c",
      "new_id": "29a42977adc963f54a4c6247586323b05fc98fc7",
      "new_mode": 33188,
      "new_path": "gdb/python/py-color.c"
    },
    {
      "type": "modify",
      "old_id": "43e03ad81f79314b5f220a82c181bbbce21da873",
      "old_mode": 33188,
      "old_path": "gdb/python/py-connection.c",
      "new_id": "02330b2806818f90ed109eb5ffa5c3738a1fd9a9",
      "new_mode": 33188,
      "new_path": "gdb/python/py-connection.c"
    },
    {
      "type": "modify",
      "old_id": "5acfd98d32620947a6554340538b01efa2525b65",
      "old_mode": 33188,
      "old_path": "gdb/python/py-corefile.c",
      "new_id": "fbefbd267f48030657d804c079c06f8fb6f9940b",
      "new_mode": 33188,
      "new_path": "gdb/python/py-corefile.c"
    },
    {
      "type": "modify",
      "old_id": "d4d50e90035c4b7918ab2436e34f2ad5b751fe36",
      "old_mode": 33188,
      "old_path": "gdb/python/py-disasm.c",
      "new_id": "e5d7174b7d6bf8c0111945faa9596ac187048e62",
      "new_mode": 33188,
      "new_path": "gdb/python/py-disasm.c"
    },
    {
      "type": "modify",
      "old_id": "e44b4b4a7616427dd057482038385cf88e9f1c29",
      "old_mode": 33188,
      "old_path": "gdb/python/py-events.h",
      "new_id": "169a5f4a4dbeb2042cd0d5433e2312b3f8e5eeb3",
      "new_mode": 33188,
      "new_path": "gdb/python/py-events.h"
    },
    {
      "type": "modify",
      "old_id": "374b934a0d9c8f69528e2c0eabe75717195fc676",
      "old_mode": 33188,
      "old_path": "gdb/python/py-frame.c",
      "new_id": "0a1a0dffbf9059ad69e7e4aaf3d0442ae26ce561",
      "new_mode": 33188,
      "new_path": "gdb/python/py-frame.c"
    },
    {
      "type": "modify",
      "old_id": "df64d85988fecdc8f4f9e4498d0d80ee0aaf964a",
      "old_mode": 33188,
      "old_path": "gdb/python/py-instruction.c",
      "new_id": "d8dad094ee9acf98691004cc2615a16e8082fe4b",
      "new_mode": 33188,
      "new_path": "gdb/python/py-instruction.c"
    },
    {
      "type": "modify",
      "old_id": "ba3920e07c32705382cbfc25528a10f7c11ec1d3",
      "old_mode": 33188,
      "old_path": "gdb/python/py-lazy-string.c",
      "new_id": "c9d06338b0a86a92050443555cd2f209974217e1",
      "new_mode": 33188,
      "new_path": "gdb/python/py-lazy-string.c"
    },
    {
      "type": "modify",
      "old_id": "d2d85026a321a4b3fbe3586bb0e03a059dccd9c5",
      "old_mode": 33188,
      "old_path": "gdb/python/py-linetable.c",
      "new_id": "1db13af4c12c88077e5e168c757151e535a8973b",
      "new_mode": 33188,
      "new_path": "gdb/python/py-linetable.c"
    },
    {
      "type": "modify",
      "old_id": "e3bf5e2ceabdf5235885824282da7ba94dd57779",
      "old_mode": 33188,
      "old_path": "gdb/python/py-membuf.c",
      "new_id": "fa5156b885e514b0452911a6eb20eb607355b9fc",
      "new_mode": 33188,
      "new_path": "gdb/python/py-membuf.c"
    },
    {
      "type": "modify",
      "old_id": "73f5297bd70d122dda31c8922151731fa325f7cd",
      "old_mode": 33188,
      "old_path": "gdb/python/py-micmd.c",
      "new_id": "9ae7fc51bee4488dbdcf829af618aabefb5d4ccd",
      "new_mode": 33188,
      "new_path": "gdb/python/py-micmd.c"
    },
    {
      "type": "modify",
      "old_id": "bc028f1746c6f3fff8307759984e66837f2f844c",
      "old_mode": 33188,
      "old_path": "gdb/python/py-param.c",
      "new_id": "35f55c3dbd067a8d099751262270954719e10eab",
      "new_mode": 33188,
      "new_path": "gdb/python/py-param.c"
    },
    {
      "type": "modify",
      "old_id": "72ad5efcf0773604ec3940fc05c37c1e50108dba",
      "old_mode": 33188,
      "old_path": "gdb/python/py-prettyprint.c",
      "new_id": "d3faf861fcfba7d7cc5789f781a8c220d39c455c",
      "new_mode": 33188,
      "new_path": "gdb/python/py-prettyprint.c"
    },
    {
      "type": "modify",
      "old_id": "f46b434313e7dad7d273d9410e21d8d736da3f87",
      "old_mode": 33188,
      "old_path": "gdb/python/py-record-btrace.c",
      "new_id": "e60bc44e81fece3fd1da6b5a088ffb00b9e485dc",
      "new_mode": 33188,
      "new_path": "gdb/python/py-record-btrace.c"
    },
    {
      "type": "modify",
      "old_id": "3ceedecc16565cf5dc30085c0f454220d1282420",
      "old_mode": 33188,
      "old_path": "gdb/python/py-record.c",
      "new_id": "15e1b9f33161cc2ebbeeb8cde75fef7ac47e2cde",
      "new_mode": 33188,
      "new_path": "gdb/python/py-record.c"
    },
    {
      "type": "modify",
      "old_id": "35ab54cf6abf35ebe5925a5e2c1d64005a2946d1",
      "old_mode": 33188,
      "old_path": "gdb/python/py-record.h",
      "new_id": "f62fcc2a7e9f8d8ce9682947b00baad2dba4f5cf",
      "new_mode": 33188,
      "new_path": "gdb/python/py-record.h"
    },
    {
      "type": "modify",
      "old_id": "dc0b14814afb3be951af59718ce9c4bb43c08e51",
      "old_mode": 33188,
      "old_path": "gdb/python/py-ref.h",
      "new_id": "3d2906fd7f5a0b41435b158b0d259e339a030e45",
      "new_mode": 33188,
      "new_path": "gdb/python/py-ref.h"
    },
    {
      "type": "modify",
      "old_id": "14cf19a6e66f5ac5df2c4886dc9c2d2d933056e3",
      "old_mode": 33188,
      "old_path": "gdb/python/py-registers.c",
      "new_id": "cc7b09079da9ac017dfb2c47587cc9a9c5495eb6",
      "new_mode": 33188,
      "new_path": "gdb/python/py-registers.c"
    },
    {
      "type": "modify",
      "old_id": "60a9ea4792ffaef67d52929496b60e4ead425a4d",
      "old_mode": 33188,
      "old_path": "gdb/python/py-style.c",
      "new_id": "c45eba60867e71306e9b8c2be12e009d07bb2534",
      "new_mode": 33188,
      "new_path": "gdb/python/py-style.c"
    },
    {
      "type": "modify",
      "old_id": "76255f53f852303538ee30c14318b1276aa72c79",
      "old_mode": 33188,
      "old_path": "gdb/python/py-symbol.c",
      "new_id": "5b1d843a36f6f4c95ff9e244d128f00ccdade5f6",
      "new_mode": 33188,
      "new_path": "gdb/python/py-symbol.c"
    },
    {
      "type": "modify",
      "old_id": "f1fbfa58d652588f1abc43080b41067823fc92e8",
      "old_mode": 33188,
      "old_path": "gdb/python/py-symtab.c",
      "new_id": "9a343167624c40391eebf91f88c7db3316c4c353",
      "new_mode": 33188,
      "new_path": "gdb/python/py-symtab.c"
    },
    {
      "type": "modify",
      "old_id": "111e0f4c9e3a7516a45c5c4a38287f1de3b16de6",
      "old_mode": 33188,
      "old_path": "gdb/python/py-tui.c",
      "new_id": "ca0fb89ea4986b5b4158c0729fb3be42667e77c6",
      "new_mode": 33188,
      "new_path": "gdb/python/py-tui.c"
    },
    {
      "type": "modify",
      "old_id": "cbb984309eb45cbb16d5cbb3a034f217b9993801",
      "old_mode": 33188,
      "old_path": "gdb/python/py-type.c",
      "new_id": "c002d97d0c6487aa180c7fae82b2e7c3c172a313",
      "new_mode": 33188,
      "new_path": "gdb/python/py-type.c"
    },
    {
      "type": "modify",
      "old_id": "6bff66849dfffb3eb034340dcee390d11c44857f",
      "old_mode": 33188,
      "old_path": "gdb/python/py-unwind.c",
      "new_id": "eef926c6dfa3ae8dae8fb24cb60549348b33a166",
      "new_mode": 33188,
      "new_path": "gdb/python/py-unwind.c"
    },
    {
      "type": "modify",
      "old_id": "04b34758b90f4d34348f037db916b56df5d87cf3",
      "old_mode": 33188,
      "old_path": "gdb/python/py-value.c",
      "new_id": "5b38110396e464a979d0e48d1bef58d08b6ce62d",
      "new_mode": 33188,
      "new_path": "gdb/python/py-value.c"
    },
    {
      "type": "modify",
      "old_id": "693829e920d575ac601a76f0270ad67d9d308fc0",
      "old_mode": 33188,
      "old_path": "gdb/python/python-internal.h",
      "new_id": "82f3262ae07927ad5c73e8290fa0ee12b3f6d4e1",
      "new_mode": 33188,
      "new_path": "gdb/python/python-internal.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d1d3053cc10213ec69212a9a321d9708da587e42",
      "new_mode": 33188,
      "new_path": "gdb/python/python-traits.h"
    }
  ]
}
