)]}'
{
  "commit": "eb6da944af31dd684be3ab2f93f453a3837a72c6",
  "tree": "a0ef40cba58e926f206b677aa4865bad2f25a1f9",
  "parents": [
    "91b3dbe273be721bdaea58c9f3c1d8309f496034"
  ],
  "author": {
    "name": "tedwoodward",
    "email": "56049650+tedwoodward@users.noreply.github.com",
    "time": "Mon Jul 14 21:50:22 2025 -0500"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Jul 14 21:50:22 2025 -0500"
  },
  "message": "[lldb] Improve disassembly of unknown instructions (#145793)\n\nLLDB uses the LLVM disassembler to determine the size of instructions and\nto do the actual disassembly. Currently, if the LLVM disassembler can\u0027t\ndisassemble an instruction, LLDB will ignore the instruction size, assume\nthe instruction size is the minimum size for that device, print no useful\nopcode, and print nothing for the instruction.\n\nThis patch changes this behavior to separate the instruction size and\n\"can\u0027t disassemble\". If the LLVM disassembler knows the size, but can\u0027t\ndissasemble the instruction, LLDB will use that size. It will print out\nthe opcode, and will print \"\u003cunknown\u003e\" for the instruction. This is much\nmore useful to both a user and a script.\n\nThe impetus behind this change is to clean up RISC-V disassembly when\nthe LLVM disassembler doesn\u0027t understand all of the instructions.\nRISC-V supports proprietary extensions, where the TD files don\u0027t know\nabout certain instructions, and the disassembler can\u0027t disassemble them.\nInternal users want to be able to disassemble these instructions.\n\nWith llvm-objdump, the solution is to pipe the output of the disassembly\nthrough a filter program. This patch modifies LLDB\u0027s disassembly to look\nmore like llvm-objdump\u0027s, and includes an example python script that adds\na command \"fdis\" that will disassemble, then pipe the output through a\nspecified filter program. This has been tested with crustfilt, a sample\nfilter located at https://github.com/quic/crustfilt .\n\nChanges in this PR:\n- Decouple \"can\u0027t disassemble\" with \"instruction size\".\n  DisassemblerLLVMC::MCDisasmInstance::GetMCInst now returns a bool for\n    valid disassembly, and has the size as an out paramter.\n  Use the size even if the disassembly is invalid.\n  Disassemble if disassemby is valid.\n\n- Always print out the opcode when -b is specified.\n  Previously it wouldn\u0027t print out the opcode if it couldn\u0027t disassemble.\n\n- Print out RISC-V opcodes the way llvm-objdump does.\n  Code for the new Opcode Type eType16_32Tuples by Jason Molenda.\n\n- Print \u003cunknown\u003e for instructions that can\u0027t be disassembled, matching\n  llvm-objdump, instead of printing nothing.\n\n- Update max riscv32 and riscv64 instruction size to 8.\n\n- Add example \"fdis\" command script.\n\n- Added disassembly byte test for x86 with known and unknown instructions.\n- Added disassembly byte test for riscv32 with known and unknown instructions,\n  with and without filtering.\n- Added test from Jason Molenda to RISC-V disassembly unit tests.",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "de99d4031a7fdb10bd5e9e08d33baa95b5169f25",
      "new_mode": 33188,
      "new_path": "lldb/examples/python/filter_disasm.py"
    },
    {
      "type": "modify",
      "old_id": "f72f2687b54fe6fa63ab7906a8697d047f991073",
      "old_mode": 33188,
      "old_path": "lldb/include/lldb/Core/Opcode.h",
      "new_id": "91af15c62e6ab9498b16c3f51d49091ef54989e2",
      "new_mode": 33188,
      "new_path": "lldb/include/lldb/Core/Opcode.h"
    },
    {
      "type": "modify",
      "old_id": "833e327579a29a76c78a268e914e008b017ad081",
      "old_mode": 33188,
      "old_path": "lldb/source/Core/Disassembler.cpp",
      "new_id": "925de2a5c836c21ef78278c8ef9b8085e3d06b1a",
      "new_mode": 33188,
      "new_path": "lldb/source/Core/Disassembler.cpp"
    },
    {
      "type": "modify",
      "old_id": "3e30d98975d8a47aa84f11b6cce0ec0483bd71a5",
      "old_mode": 33188,
      "old_path": "lldb/source/Core/Opcode.cpp",
      "new_id": "6c9ced9c11230bc0282e462751c378cf2e57dd48",
      "new_mode": 33188,
      "new_path": "lldb/source/Core/Opcode.cpp"
    },
    {
      "type": "modify",
      "old_id": "644084ba8d57a8cedd06ccff6b668d446ba1743d",
      "old_mode": 33188,
      "old_path": "lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp",
      "new_id": "564b787594f7114a24221fc2604e40ba0c55b705",
      "new_mode": 33188,
      "new_path": "lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp"
    },
    {
      "type": "modify",
      "old_id": "70b9800f4dade5d681ca6d8733a8b0add37d600c",
      "old_mode": 33188,
      "old_path": "lldb/source/Utility/ArchSpec.cpp",
      "new_id": "7c71aaae6bcf28bdb7a434658728bbe86b3673f1",
      "new_mode": 33188,
      "new_path": "lldb/source/Utility/ArchSpec.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "bac5a36be2f3c60b744a3b3f5bba0ecd66590f5c",
      "new_mode": 33261,
      "new_path": "lldb/test/Shell/Commands/Inputs/dis_filt.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "01b9ba261d66029ac307d37e2085692a971018c8",
      "new_mode": 33188,
      "new_path": "lldb/test/Shell/Commands/command-disassemble-riscv32-bytes.s"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "fae08d09a083247afdc80f98a5add495598b5674",
      "new_mode": 33188,
      "new_path": "lldb/test/Shell/Commands/command-disassemble-x86-bytes.s"
    },
    {
      "type": "modify",
      "old_id": "8ec5d62a99ac57f089ce784aa721bb88b54919f9",
      "old_mode": 33188,
      "old_path": "lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp",
      "new_id": "64177a2fac49079b893da28bb4f514b8e17dfbc0",
      "new_mode": 33188,
      "new_path": "lldb/unittests/Disassembler/RISCV/TestMCDisasmInstanceRISCV.cpp"
    },
    {
      "type": "modify",
      "old_id": "43ed85db0315ccaf8c0a98424df63a8375517623",
      "old_mode": 33188,
      "old_path": "llvm/docs/ReleaseNotes.md",
      "new_id": "63a2f5ef9423b49b062d498c84fa5771c6572358",
      "new_mode": 33188,
      "new_path": "llvm/docs/ReleaseNotes.md"
    }
  ]
}
