)]}'
{
  "commit": "49fa1332a69bc4b09d2cc7db587e27ea30f2a29d",
  "tree": "1bf3c62ec0c6c9a9220221906aeb24c1bc322ce7",
  "parents": [
    "8fee99c3c8e25f2708bddde345c192dd2f3e7e08"
  ],
  "author": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Mon Nov 29 16:19:16 2021 +0100"
  },
  "committer": {
    "name": "Tom de Vries",
    "email": "tdevries@suse.de",
    "time": "Mon Nov 29 16:19:16 2021 +0100"
  },
  "message": "[gdb/symtab] Fix segfault in search_one_symtab\n\nPR28539 describes a segfault in lambda function search_one_symtab due to\npsymbol_functions::expand_symtabs_matching calling expansion_notify with a\nnullptr symtab:\n...\n          struct compunit_symtab *symtab \u003d\n            psymtab_to_symtab (objfile, ps);\n\n          if (expansion_notify !\u003d NULL)\n            if (!expansion_notify (symtab))\n              return false;\n...\n\nThis happens as follows.  The partial symtab ps is a dwarf2_include_psymtab\nfor some header file:\n...\n(gdb) p ps.filename\n$5 \u003d 0x64fcf80 \"/usr/include/c++/11/bits/stl_construct.h\"\n...\n\nThe includer of ps is a shared symtab for a partial unit, with as user:\n...\n(gdb) p ps.includer().user.filename\n$11 \u003d 0x64fc9f0 \\\n  \"/usr/src/debug/llvm13-13.0.0-1.2.x86_64/tools/clang/lib/AST/Decl.cpp\"\n...\n\nThe call to psymtab_to_symtab expands the Decl.cpp symtab (and consequently\nthe shared symtab), but returns nullptr because:\n...\nstruct dwarf2_include_psymtab : public partial_symtab\n{\n  ...\n  compunit_symtab *get_compunit_symtab (struct objfile *objfile) const override\n  {\n    return nullptr;\n  }\n...\n\nFix this by returning the Decl.cpp symtab instead, which fixes the segfault\nin the PR.\n\nTested on x86_64-linux.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d28539\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a513cc493a78786746c8d022947c9449f4b686bc",
      "old_mode": 33188,
      "old_path": "gdb/dwarf2/read.c",
      "new_id": "737d8a4c81b5f912c4e56b9a87cb292a18bc77a0",
      "new_mode": 33188,
      "new_path": "gdb/dwarf2/read.c"
    },
    {
      "type": "modify",
      "old_id": "7ffb7437785a9d7e08dd9e65350c5da532335b35",
      "old_mode": 33188,
      "old_path": "gdb/psymtab.c",
      "new_id": "e09537d8f5efd5084c9afd6c280d1019f4b6889c",
      "new_mode": 33188,
      "new_path": "gdb/psymtab.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ec3371dde43ab0e456c589980090c4cc9427d551",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.dwarf2/dw2-symtab-includes-lookup.exp"
    }
  ]
}
