)]}'
{
  "commit": "c2b01c87dcc3ab59e7d466cbec795310a3d43fde",
  "tree": "f111bc3698adddee40679a50c70c1c74726ccd8e",
  "parents": [
    "2dbfa8407e7d2f4293add33b5ead3f2d5fcd04e9"
  ],
  "author": {
    "name": "jimingham",
    "email": "jingham@apple.com",
    "time": "Mon Feb 12 15:24:11 2024 -0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Mon Feb 12 15:24:11 2024 -0800"
  },
  "message": "Make ValueObjectPrinter\u0027s handling of its ValueObject pointers more principled (NFC) (#81314)\n\nI get a small but fairly steady stream of crash reports which I can only\r\nexplain by ValueObjectPrinter trying to access its m_valobj field, and\r\nfinding it NULL. I have never been able to reproduce any of these, and\r\nthe reports show a state too long after the fact to know what went\r\nwrong.\r\n\r\nI\u0027ve read through this section of lldb a bunch of times trying to figure\r\nout how this could happen, but haven\u0027t ever found anything actually\r\nwrong that could cause this. OTOH, ValueObjectPrinter is somewhat sloppy\r\nabout how it handles the ValueObject it is printing.\r\n\r\na) lldb allows you to make a ValueObjectPrinter with a Null incoming\r\nValueObject. However, there\u0027s no affordance to set the ValueObject in\r\nthe Printer after the fact, and it doesn\u0027t really make sense to do that.\r\nSo I change the ValueObjectPrinter API\u0027s to take a ValueObject\r\nreference, rather than a pointer. All the places that make\r\nValueObjectPrinters already check the non-null status of their\r\nValueObject\u0027s before making the ValueObjectPrinter, so sadly, I didn\u0027t\r\nfind the bug, but this will enforce the intent.\r\nb) The next step in printing the ValueObject is deciding which of the\r\nassociated DynamicValue/SyntheticValue we are actually printing (based\r\non the use_dynamic and use_synthetic settings in the original\r\nValueObject. This was put in a pointer by GetMostSpecializedValue, but\r\nmost of the printer code just accessed the pointer, and it was hard to\r\nreason out whether we were guaranteed to always call this before using\r\nm_valobj. So far as I could see we always do (sigh, didn\u0027t find the bug\r\nthere either) but this was way too hard to reason about.\r\n\r\nIn fact, we figure out once which ValueObject we\u0027re going to print and\r\ndon\u0027t change that through the life of the printer. So I changed this to\r\nboth set the \"most specialized value\" in the constructor, and then to\r\nalways access it through GetMostSpecializedValue(). That makes it easier\r\nto reason about the use of this ValueObject as well.\r\n\r\nThis is an NFC change, all it does is make the code easier to reason\r\nabout.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2b3936eaa707f26a18a9ef16fbc8af66263979e7",
      "old_mode": 33188,
      "old_path": "lldb/include/lldb/DataFormatters/ValueObjectPrinter.h",
      "new_id": "fe46321c3186cf53f4e8cb70945daa5db4b3cc1e",
      "new_mode": 33188,
      "new_path": "lldb/include/lldb/DataFormatters/ValueObjectPrinter.h"
    },
    {
      "type": "modify",
      "old_id": "17a7e858b24e58054ec0fc3d8e2cbb6fd48c9ccc",
      "old_mode": 33188,
      "old_path": "lldb/source/Commands/CommandObjectFrame.cpp",
      "new_id": "a4d3fb66e8b5529d5a70a77fd70929795caa36a6",
      "new_mode": 33188,
      "new_path": "lldb/source/Commands/CommandObjectFrame.cpp"
    },
    {
      "type": "modify",
      "old_id": "9208047be36668d283b012e9b199240b8524b31c",
      "old_mode": 33188,
      "old_path": "lldb/source/Core/ValueObject.cpp",
      "new_id": "e80042826f7d64705f03fce5a67703f40f60235a",
      "new_mode": 33188,
      "new_path": "lldb/source/Core/ValueObject.cpp"
    },
    {
      "type": "modify",
      "old_id": "c09ed31d0338fdb9bcbdeec014bb21437091bd41",
      "old_mode": 33188,
      "old_path": "lldb/source/DataFormatters/TypeSummary.cpp",
      "new_id": "3707d2d879d33ab7ac633625a748361962fbf259",
      "new_mode": 33188,
      "new_path": "lldb/source/DataFormatters/TypeSummary.cpp"
    },
    {
      "type": "modify",
      "old_id": "074d0b648e6fa9feae7bbd75a894982b4318f77b",
      "old_mode": 33188,
      "old_path": "lldb/source/DataFormatters/ValueObjectPrinter.cpp",
      "new_id": "46e50a8d421a71b8ab8a8fead58c66dc93d8d578",
      "new_mode": 33188,
      "new_path": "lldb/source/DataFormatters/ValueObjectPrinter.cpp"
    }
  ]
}
