)]}'
{
  "commit": "d1c9b20ff9eca75a6bc33105cb2a46cebc67c482",
  "tree": "6ba8a5f75781f4d3bfc4a62366dbbd54585dfbb7",
  "parents": [
    "66708c54e6b49c7fae7f7652f783cac5687fa507"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "andrew.burgess@embecosm.com",
    "time": "Wed Feb 19 01:24:37 2020 +0000"
  },
  "committer": {
    "name": "Maciej W. Rozycki",
    "email": "macro@wdc.com",
    "time": "Wed Feb 19 01:24:37 2020 +0000"
  },
  "message": "gdb/riscv: Update API for looking up target descriptions\n\nIn preparation for adding the RISC-V gdbserver, this commit\nrestructures the API for looking up target descriptions.\n\nThe current API is riscv_create_target_description, which creates a\ntarget description from a riscv_gdbarch_features, but also caches the\ncreated target descriptions so that for a given features object we\nalways get back the same target description object.  This is important\nfor GDB due to the way gdbarch objects are reused.\n\nAs the same target description is always returned to GDB, and can be\nreturned multiple times, it is returned as a const, however, the\ncurrent cache actually stores a non-const target description.  This is\nimproved in this patch so that the cache holds a const target\ndescription.\n\nFor gdbsever, this caching of the target descriptions is not needed,\nthe gdbserver looks up one target description to describe the target\nit is actually running on and that is it.  Further the gdbserver\nactually needs to modify the target description that is looked up, so\nfor the gdbsever, returning a const target description is not\nacceptable.\n\nThis commit aims to address this by creating two parallel target\ndescription APIs, on is the old riscv_create_target_description,\nhowever, this no longer performs any caching, and just creates a new\ntarget description, and returns it as non-const.\n\nThe second API is riscv_lookup_target_description, this one performs\nthe caching, and calls riscv_create_target_description to create a\ntarget description when needed.\n\nIn order to make sure the correct API is used in the correct place I\nhave guarded the code using the GDBSERVER define.  For GDB the\nriscv_create_target_description is static, and not generally usable\nthroughout GDB, only the lookup API is global.  In gdbserver, the\nlookup functions, and the cache are not defined or created at all,\nonly the riscv_create_target_description API is available.\n\nThere should be no user visible changes after this commit.\n\ngdb/ChangeLog:\n\n\t* arch/riscv.c (struct riscv_gdbarch_features_hasher): Only define\n\tif GDBSERVER is not defined.\n\t(riscv_tdesc_cache): Likewise, also store const target_desc.\n\t(STATIC_IN_GDB): Define.\n\t(riscv_create_target_description): Update declaration with\n\tSTATIC_IN_GDB.\n\t(riscv_lookup_target_description): New function, only define if\n\tGDBSERVER is not defined.\n\t* arch/riscv.h (riscv_create_target_description): Declare only\n\twhen GDBSERVER is defined.\n\t(riscv_lookup_target_description): New declaration when GDBSERVER\n\tis not defined.\n\t* nat/riscv-linux-tdesc.c (riscv_linux_read_description): Rename to...\n\t(riscv_linux_read_features): ...this, and return\n\triscv_gdbarch_features instead of target_desc.\n\t* nat/riscv-linux-tdesc.h: Include \u0027arch/riscv.h\u0027.\n\t(riscv_linux_read_description): Rename to...\n\t(riscv_linux_read_features): ...this.\n\t* riscv-linux-nat.c (riscv_linux_nat_target::read_description):\n\tUpdate to use riscv_gdbarch_features and\n\triscv_lookup_target_description.\n\t* riscv-tdep.c (riscv_find_default_target_description): Use\n\triscv_lookup_target_description instead of\n\triscv_create_target_description.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9d295682e8deb0c22df34bf5722758708b224261",
      "old_mode": 33188,
      "old_path": "gdb/ChangeLog",
      "new_id": "144fd4f256af52ee8fc0dbb60f6ace3601738023",
      "new_mode": 33188,
      "new_path": "gdb/ChangeLog"
    },
    {
      "type": "modify",
      "old_id": "a3ab8a92909f082754dfd6eb9a70f19153b8684f",
      "old_mode": 33188,
      "old_path": "gdb/arch/riscv.c",
      "new_id": "a02c18b4c916907f7205ee693c4838e4f21776c6",
      "new_mode": 33188,
      "new_path": "gdb/arch/riscv.c"
    },
    {
      "type": "modify",
      "old_id": "016a5fcd2f0ee31a151e0b3e37e8fe4676608fa2",
      "old_mode": 33188,
      "old_path": "gdb/arch/riscv.h",
      "new_id": "d40862cbd8e2a18e7aa4f684b3c9769c83b3ed9d",
      "new_mode": 33188,
      "new_path": "gdb/arch/riscv.h"
    },
    {
      "type": "modify",
      "old_id": "1b625cf38fc467032290b9462fb23225a0e73a23",
      "old_mode": 33188,
      "old_path": "gdb/nat/riscv-linux-tdesc.c",
      "new_id": "3220725b87590bf7a3488158fb71b8419631a6c6",
      "new_mode": 33188,
      "new_path": "gdb/nat/riscv-linux-tdesc.c"
    },
    {
      "type": "modify",
      "old_id": "9b57a9e99d5f2311f46c8ba1a685a6a5c77f184d",
      "old_mode": 33188,
      "old_path": "gdb/nat/riscv-linux-tdesc.h",
      "new_id": "e9ee64aa5d27fe42cf0423a0bc4016b855efa61c",
      "new_mode": 33188,
      "new_path": "gdb/nat/riscv-linux-tdesc.h"
    },
    {
      "type": "modify",
      "old_id": "2622f1b4399576c54b88da2ad79b693f662d5569",
      "old_mode": 33188,
      "old_path": "gdb/riscv-linux-nat.c",
      "new_id": "4f78dfdc6a20f447863b1821a598c0434afaa5e7",
      "new_mode": 33188,
      "new_path": "gdb/riscv-linux-nat.c"
    },
    {
      "type": "modify",
      "old_id": "a14ef4db0830465e773b8e41a61283d6b9d57ee4",
      "old_mode": 33188,
      "old_path": "gdb/riscv-tdep.c",
      "new_id": "0515729f4e92046f8755a9d07d770719677be76e",
      "new_mode": 33188,
      "new_path": "gdb/riscv-tdep.c"
    }
  ]
}
