)]}'
{
  "commit": "420d030e88d2c8bbad6044278000fbd9efbf65d9",
  "tree": "195fbc9b4699c4a1317156a179ee07d4afb8fb52",
  "parents": [
    "ee580641bc5fbd5086e02cc94eb2dbc70ebb4b5d"
  ],
  "author": {
    "name": "Tom Tromey",
    "email": "tromey@adacore.com",
    "time": "Fri Apr 18 09:28:13 2025 -0600"
  },
  "committer": {
    "name": "Tom Tromey",
    "email": "tromey@adacore.com",
    "time": "Tue May 06 09:01:55 2025 -0600"
  },
  "message": "Handle field with dynamic bit offset\n\nI discovered that GCC emitted incorrect DWARF for the test case\nincluded in this patch.  Eric wrote a fix for GCC, but then he found\nthat gdb crashed on the resulting file.\n\nThis test has a field that is at a non-constant bit offset from the\nstart of the type.  DWARF 5 does not allow for this situation (I\u0027ve\nsent a report to the DWARF list), but DWARF 3 did allow for this via a\ncombination of an expression for the byte offset and then the use of\nDW_AT_bit_offset.  This looks like:\n\n \u003c5\u003e\u003c117a\u003e: Abbrev Number: 17 (DW_TAG_member)\n    \u003c117b\u003e   DW_AT_name        : (indirect string, offset: 0x1959): another_field\n...\n    \u003c1188\u003e   DW_AT_bit_offset  : 6\n    \u003c1189\u003e   DW_AT_data_member_location: 6 byte block: 99 3d 1 0 0 22 \t(DW_OP_call4: \u003c0x1193\u003e; DW_OP_plus)\n...\n \u003c3\u003e\u003c1193\u003e: Abbrev Number: 2 (DW_TAG_dwarf_procedure)\n    \u003c1194\u003e   DW_AT_location    : 15 byte block: 97 94 1 37 1a 32 1e 23 7 38 1b 31 1c 23 3 \t(DW_OP_push_object_address; DW_OP_deref_size: 1; DW_OP_lit7; DW_OP_and; DW_OP_lit2; DW_OP_mul; DW_OP_plus_uconst: 7; DW_OP_lit8; DW_OP_div; DW_OP_lit1; DW_OP_minus; DW_OP_plus_uconst: 3)\n\nNow, that combination is not fully general, in that the bit offset\nmust be a constant -- only the byte offset may really vary.  However,\nI couldn\u0027t come up with a situation where full generality is needed,\nmainly because GNAT won\u0027t seem to pack fields into the padding of a\nvariable-length array.\n\nMeanwhile, the reason for the gdb crash is that the code handling\nDW_AT_bit_offset assumes that the byte offset is a constant.  This\ncauses an assertion failure.\n\nThis patch arranges for DW_AT_bit_offset to be applied during field\nresolution, when needed.\n\n\n\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "be70704e7d7de738206c865ef4f718871228e37c",
      "old_mode": 33188,
      "old_path": "gdb/dwarf2/loc.h",
      "new_id": "ebe5c31fc5a5f0c452c2d65bf78b69c6987aa2c7",
      "new_mode": 33188,
      "new_path": "gdb/dwarf2/loc.h"
    },
    {
      "type": "modify",
      "old_id": "46639990a5e551fc9c85be22e9d7ad61c63173e3",
      "old_mode": 33188,
      "old_path": "gdb/dwarf2/read.c",
      "new_id": "71fa793315ff66881b2a0282f8e5e46ac26ee305",
      "new_mode": 33188,
      "new_path": "gdb/dwarf2/read.c"
    },
    {
      "type": "modify",
      "old_id": "2535aad2c3cc433d1512dbfd94b961f2a6abaf76",
      "old_mode": 33188,
      "old_path": "gdb/gdbtypes.c",
      "new_id": "a241223a3e6194db847e6736eab3d6dd84c709d0",
      "new_mode": 33188,
      "new_path": "gdb/gdbtypes.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "19d16b17f49f8b2319eb4c9b3603a6bd3cee2a40",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.ada/dyn-bit-offset.exp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a882afd1944518361c7c6f731f0e4648d0f878ec",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.ada/dyn-bit-offset/exam.adb"
    }
  ]
}
