)]}'
{
  "commit": "60a3da00bd5407f07d64dff82a4dae98230dfaac",
  "tree": "b4a05a973c60abfc9dc5af43aad2a87c547db437",
  "parents": [
    "ea6303b4971b0959329a1ae01648b16a4f4ac154"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sat Jan 22 11:38:18 2022 +0000"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Mon Apr 04 13:10:52 2022 +0100"
  },
  "message": "objdump/opcodes: add syntax highlighting to disassembler output\n\nThis commit adds the _option_ of having disassembler output syntax\nhighlighted in objdump.  This option is _off_ by default.  The new\ncommand line options are:\n\n  --disassembler-color\u003doff\t\t# The default.\n  --disassembler-color\u003dcolor\n  --disassembler-color\u003dextended-color\n\nI have implemented two colour modes, using the same option names as we\nuse of --visualize-jumps, a basic 8-color mode (\"color\"), and an\nextended 8bit color mode (\"extended-color\").\n\nThe syntax highlighting requires that each targets disassembler be\nupdated; each time the disassembler produces some output we now pass\nthrough an additional parameter indicating what style should be\napplied to the text.\n\nAs updating all target disassemblers is a large task, the old API is\nmaintained.  And so, a user of the disassembler (i.e. objdump, gdb)\nmust provide two functions, the current non-styled print function, and\na new, styled print function.\n\nI don\u0027t currently have a plan for converting every single target\ndisassembler, my hope is that interested folk will update the\ndisassemblers they are interested in.  But it is possible some might\nnever get updated.\n\nIn this initial series I intend to convert the RISC-V disassembler\ncompletely, and also do a partial conversion of the x86 disassembler.\nHopefully having the x86 disassembler at least partial converted will\nallow more people to try this out easily and provide feedback.\n\nIn this commit I have focused on objdump.  The changes to GDB at this\npoint are the bare minimum required to get things compiling, GDB makes\nno use of the styling information to provide any colors, that will\ncome later, if this commit is accepted.\n\nThis first commit in the series doesn\u0027t convert any target\ndisassemblers at all (the next two commits will update some targets),\nso after this commit, the only color you will see in the disassembler\noutput, is that produced from objdump itself, e.g. from\nobjdump_print_addr_with_sym, where we print an address and a symbol\nname, these are now printed with styling information, and so will have\ncolors applied (if the option is on).\n\nFinally, my ability to pick \"good\" colors is ... well, terrible.  I\u0027m\nin no way committed to the colors I\u0027ve picked here, so I encourage\npeople to suggest new colors, or wait for this commit to land, and\nthen patch the choice of colors.\n\nI do have an idea about using possibly an environment variable to\nallow the objdump colors to be customised, but I haven\u0027t done anything\nlike that in this commit, the color choices are just fixed in the code\nfor now.\n\nbinutils/ChangeLog:\n\n\t* NEWS: Mention new feature.\n\t* doc/binutils.texi (objdump): Describe --disassembler-color\n\toption.\n\t* objdump.c (disassembler_color): New global.\n\t(disassembler_extended_color): Likewise.\n\t(disassembler_in_comment): Likewise.\n\t(usage): Mention --disassembler-color option.\n\t(long_options): Add --disassembler-color option.\n\t(objdump_print_value): Use fprintf_styled_func instead of\n\tfprintf_func.\n\t(objdump_print_symname): Likewise.\n\t(objdump_print_addr_with_sym): Likewise.\n\t(objdump_color_for_disassembler_style): New function.\n\t(objdump_styled_sprintf): New function.\n\t(fprintf_styled): New function.\n\t(disassemble_jumps): Use disassemble_set_printf, and reset\n\tdisassembler_in_comment.\n\t(null_styled_print): New function.\n\t(disassemble_bytes): Use disassemble_set_printf, and reset\n\tdisassembler_in_comment.\n\t(disassemble_data): Update init_disassemble_info call.\n\t(main): Handle --disassembler-color option.\n\ninclude/ChangeLog:\n\n\t* dis-asm.h (enum disassembler_style): New enum.\n\t(struct disassemble_info): Add fprintf_styled_func field, and\n\tcreated_styled_output field.\n\t(disassemble_set_printf): Declare.\n\t(init_disassemble_info): Add additional parameter.\n\t(INIT_DISASSEMBLE_INFO): Add additional parameter.\n\nopcodes/ChangeLog:\n\n\t* dis-init.c (init_disassemble_info): Take extra parameter,\n\tinitialize the new fprintf_styled_func and created_styled_output\n\tfields.\n\t* disassembler.c (disassemble_set_printf): New function definition.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7e3c005f25c9719252617391cec71a86b3ced6d6",
      "old_mode": 33188,
      "old_path": "binutils/NEWS",
      "new_id": "c266bb9c3de171155a7f62345b596750640737dd",
      "new_mode": 33188,
      "new_path": "binutils/NEWS"
    },
    {
      "type": "modify",
      "old_id": "c73837ee27bda4ec8e4887122ab32c91fed49357",
      "old_mode": 33188,
      "old_path": "binutils/doc/binutils.texi",
      "new_id": "2c234c682aac87e51d7808fbb52440a9b3849781",
      "new_mode": 33188,
      "new_path": "binutils/doc/binutils.texi"
    },
    {
      "type": "modify",
      "old_id": "8e1c9cb0c21932151ee2126e82ed9a7badf2698a",
      "old_mode": 33188,
      "old_path": "binutils/objdump.c",
      "new_id": "54c89a32db2677e57f2de678f1bd7937129fca60",
      "new_mode": 33188,
      "new_path": "binutils/objdump.c"
    },
    {
      "type": "modify",
      "old_id": "24d757aec333d973bf254897a5fcf0c1f9cbccf8",
      "old_mode": 33188,
      "old_path": "gdb/disasm.c",
      "new_id": "8b6d9db7e8436a93558e09ea76024eeb472f756f",
      "new_mode": 33188,
      "new_path": "gdb/disasm.c"
    },
    {
      "type": "modify",
      "old_id": "399afc5ae71606984b9f00a37e81987d131c697b",
      "old_mode": 33188,
      "old_path": "gdb/disasm.h",
      "new_id": "b71cd097a16864627958ccaa28c8f3b0bf96082f",
      "new_mode": 33188,
      "new_path": "gdb/disasm.h"
    },
    {
      "type": "modify",
      "old_id": "317592448a28be7ad669b7b73d692b1e19a0d4e6",
      "old_mode": 33188,
      "old_path": "include/dis-asm.h",
      "new_id": "4f91df1249852f2c6277af33f44a72f92b8b3f98",
      "new_mode": 33188,
      "new_path": "include/dis-asm.h"
    },
    {
      "type": "modify",
      "old_id": "0b171c0f36d355e4e084e1d68ccc5bd3de73ebfe",
      "old_mode": 33188,
      "old_path": "opcodes/dis-init.c",
      "new_id": "59039ef8b111433b4a77b5f5b78a0705746f7545",
      "new_mode": 33188,
      "new_path": "opcodes/dis-init.c"
    },
    {
      "type": "modify",
      "old_id": "1f1fde7ae8fe0a217ca5f44c3bd7af406fde77e5",
      "old_mode": 33188,
      "old_path": "opcodes/disassemble.c",
      "new_id": "7325394d985c502edd47562fbe5183b2cb806317",
      "new_mode": 33188,
      "new_path": "opcodes/disassemble.c"
    }
  ]
}
