)]}'
{
  "commit": "4bce7cdaf481901edbc5ee47d953ea7e8efb56ca",
  "tree": "f085df5b718a9438b5d5174b5e3c9be15e2cea7c",
  "parents": [
    "7509b82979550970342a4494d727b3fb06bffd65"
  ],
  "author": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Mon Nov 08 16:06:07 2021 -0500"
  },
  "committer": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Fri Dec 03 16:37:36 2021 -0500"
  },
  "message": "gdbsupport: add array_view copy function\n\nAn assertion was recently added to array_view::operator[] to ensure we\ndon\u0027t do out of bounds accesses.  However, when the array_view is copied\nto or from using memcpy, it bypasses that safety.\n\nTo address this, add a `copy` free function that copies data from an\narray view to another, ensuring that the destination and source array\nviews have the same size.  When copying to or from parts of an\narray_view, we are expected to use gdb::array_view::slice, which does\nits own bounds check.  With all that, any copy operation that goes out\nof bounds should be caught by an assertion at runtime.\n\ncopy is implemented using std::copy and std::copy_backward, which, at\nleast on libstdc++, appears to pick memmove when copying trivial data.\nSo in the end there shouldn\u0027t be much difference vs using a bare memcpy,\nas we do right now.  When copying non-trivial data, std::copy and\nstd::copy_backward assigns each element in a loop.\n\nTo properly support overlapping ranges, we must use std::copy or\nstd::copy_backward, depending on whether the destination is before the\nsource or vice-versa.  std::copy and std::copy_backward don\u0027t support\ncopying exactly overlapping ranges (where the source range is equal to\nthe destination range).  But in this case, no copy is needed anyway, so\nwe do nothing.\n\nThe order of parameters of the new copy function is based on std::copy\nand std::copy_backward, where the source comes before the destination.\n\nChange a few randomly selected spots to use the new function, to show\nhow it can be used.\n\nAdd a test for the new function, testing both with arrays of a trivial\ntype (int) and of a non-trivial type (foo).  Test non-overlapping\nranges as well as three kinds of overlapping ranges: source before dest,\ndest before source, and dest \u003d\u003d source.\n\nChange-Id: Ibeaca04e0028410fd44ce82f72e60058d6230a03\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "b84e10fd029fc6ac27ca9016e72ccb2f7fd38516",
      "old_mode": 33188,
      "old_path": "gdb/ada-lang.c",
      "new_id": "c6cefe9d8e89c89d7bef5fe0332253da9f632405",
      "new_mode": 33188,
      "new_path": "gdb/ada-lang.c"
    },
    {
      "type": "modify",
      "old_id": "652161955d5265ff48922f21606e5b5b9f8de55b",
      "old_mode": 33188,
      "old_path": "gdb/dwarf2/expr.c",
      "new_id": "592dbe19d562c9e71597da0af64c3b5c024a5ef9",
      "new_mode": 33188,
      "new_path": "gdb/dwarf2/expr.c"
    },
    {
      "type": "modify",
      "old_id": "9df48db391292a2785591edcf82527a100406f98",
      "old_mode": 33188,
      "old_path": "gdb/unittests/array-view-selftests.c",
      "new_id": "998bd3a5781238657251e5cdcae905d456721169",
      "new_mode": 33188,
      "new_path": "gdb/unittests/array-view-selftests.c"
    },
    {
      "type": "modify",
      "old_id": "11acec6f1676894c5ea68078c5df01db305ea728",
      "old_mode": 33188,
      "old_path": "gdb/valarith.c",
      "new_id": "32898f9005b8d253a2dc0e1ccb9774623e0b0d0c",
      "new_mode": 33188,
      "new_path": "gdb/valarith.c"
    },
    {
      "type": "modify",
      "old_id": "c552e828a947baa562e910c376aa568fc578b035",
      "old_mode": 33188,
      "old_path": "gdb/valops.c",
      "new_id": "ca71c128de9cf471482381fbfe40033eacd1e528",
      "new_mode": 33188,
      "new_path": "gdb/valops.c"
    },
    {
      "type": "modify",
      "old_id": "7649b029f91b714cb6c7bb00396e7fca09da2d25",
      "old_mode": 33188,
      "old_path": "gdb/value.c",
      "new_id": "4e66329e82c5fa193859a1a668b00796a7d5e9ff",
      "new_mode": 33188,
      "new_path": "gdb/value.c"
    },
    {
      "type": "modify",
      "old_id": "edf66559e2d91800dcc31fd3cbecf15ca349b69e",
      "old_mode": 33188,
      "old_path": "gdbsupport/array-view.h",
      "new_id": "5f1f46b16b920043ececee8808c43289fb7a881c",
      "new_mode": 33188,
      "new_path": "gdbsupport/array-view.h"
    }
  ]
}
