)]}'
{
  "commit": "f0c2e3e020d350b410e1bbe4ed636f2ea228d555",
  "tree": "e27ca17e48a702c63330b2c6e4852d7a594284d8",
  "parents": [
    "8a0b60471a75ce81b8ea067f6e87457b3ed0c7a3"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "andrew.burgess@embecosm.com",
    "time": "Wed Oct 27 10:07:56 2021 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Wed Jun 15 09:44:54 2022 +0100"
  },
  "message": "gdb: add new base class to gdb_disassembler\n\nThe motivation for this change is an upcoming Python disassembler API\nthat I would like to add.  As part of that change I need to create a\nnew disassembler like class that contains a disassemble_info and a\ngdbarch.  The management of these two objects is identical to how we\nmanage these objects within gdb_disassembler, so it might be tempting\nfor my new class to inherit from gdb_disassembler.\n\nThe problem however, is that gdb_disassembler has a tight connection\nbetween its constructor, and its print_insn method.  In the\nconstructor the ui_file* that is passed in is replaced with a member\nvariable string_file*, and then in print_insn, the contents of the\nmember variable string_file are printed to the original ui_file*.\n\nWhat this means is that the gdb_disassembler class has a tight\ncoupling between its constructor and print_insn; the class just isn\u0027t\nintended to be used in a situation where print_insn is not going to be\ncalled, which is how my (upcoming) sub-class would need to operate.\n\nMy solution then, is to separate out the management of the\ndisassemble_info and gdbarch into a new gdb_disassemble_info class,\nand make this class a parent of gdb_disassembler.\n\nIn arm-tdep.c and mips-tdep.c, where we used to cast the\ndisassemble_info-\u003eapplication_data to a gdb_disassembler, we can now\ncast to a gdb_disassemble_info as we only need to access the gdbarch\ninformation.\n\nNow, my new Python disassembler sub-class will still want to print\nthings to an output stream, and so we will want access to the\ndis_asm_fprintf functionality for printing.\n\nHowever, rather than move this printing code into the\ngdb_disassemble_info base class, I have added yet another level of\nhierarchy, a gdb_printing_disassembler, thus the class structure is\nnow:\n\n  struct gdb_disassemble_info {};\n  struct gdb_printing_disassembler : public gdb_disassemble_info {};\n  struct gdb_disassembler : public gdb_printing_disassembler {};\n\nIn a later commit my new Python disassembler will inherit from\ngdb_printing_disassembler.\n\nThe reason for adding the additional layer to the class hierarchy is\nthat in yet another commit I intend to rewrite the function\ngdb_buffered_insn_length, and to do this I will be creating yet more\ndisassembler like classes, however, these will not print anything,\nthus I will add a gdb_non_printing_disassembler class that also\ninherits from gdb_disassemble_info.  Knowing that that change is\ncoming, I\u0027ve gone with the above class hierarchy now.\n\nThere should be no user visible changes after this commit.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "456649afdaab22ae81c33b9e10a3128722646165",
      "old_mode": 33188,
      "old_path": "gdb/arm-tdep.c",
      "new_id": "fe62617d4bf89a4f301faea12cb3f8b1419c7dec",
      "new_mode": 33188,
      "new_path": "gdb/arm-tdep.c"
    },
    {
      "type": "modify",
      "old_id": "f2df5ef7bc5b7c3e07f13cf8eda85c09abbcf4e7",
      "old_mode": 33188,
      "old_path": "gdb/disasm.c",
      "new_id": "6ac84388cc3d9693458abe44be61189dee50c054",
      "new_mode": 33188,
      "new_path": "gdb/disasm.c"
    },
    {
      "type": "modify",
      "old_id": "7efab7db46c4f8b36db9871c07d628df6a95cdad",
      "old_mode": 33188,
      "old_path": "gdb/disasm.h",
      "new_id": "f31ca92b038042981b60efc256bd23608ecb4df6",
      "new_mode": 33188,
      "new_path": "gdb/disasm.h"
    },
    {
      "type": "modify",
      "old_id": "805c5beba594ce8896712e02c8c7359343f32764",
      "old_mode": 33188,
      "old_path": "gdb/mips-tdep.c",
      "new_id": "65aa86dd98df6a286e75e4f7af90da2db9a42ce6",
      "new_mode": 33188,
      "new_path": "gdb/mips-tdep.c"
    }
  ]
}
