)]}'
{
  "commit": "ea4c968ce546d2bca7dfc351529fef15ed074c11",
  "tree": "4fa9da42f7ad492e61ffe4d358c27e490e141c17",
  "parents": [
    "a0780848529d9f820786e231629f43f4801b2f8a"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Wed Jun 12 15:24:46 2024 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Mon Aug 19 15:02:56 2024 +0100"
  },
  "message": "gdb: avoid \u0027//\u0027 in filenames when searching for debuginfo\n\nI spotted that the gdb.base/sysroot-debug-lookup.exp test that I added\nrecently actually had a KPASS when run with the\nnative-extended-gdbserver board.  This was an oversight when adding\nthe test.\n\nThe failures in this test, when using the \u0027unix\u0027 board, are logged as\nbug PR gdb/31804.  The problem appears to be caused by the use of the\nchild_path function in find_separate_debug_file.\n\nWhat happens on the \u0027unix\u0027 board is that the file is specified to GDB\nwith a target: prefix, however GDB spots that the target filesystem is\nlocal to GDB and so opens the file without a target: prefix.  When we\ncall into find_separate_debug_file the DIR and CANON_DIR arguments,\nwhich are computed from the objfile_name() no longer have a target:\nprefix.\n\nHowever, in this test if the file was opened with a target: prefix,\nthen the sysroot also has a target: prefix.  When child_path is called\nit looks for a common prefix between CANON_DIR (from the objfile_name)\nand the sysroot.  However, the sysroot still has the target: prefix,\nwhich means the child_path() call fails and returns nullptr.\n\nWhat happens in the native-extended-gdbserver case is that GDB doesn\u0027t\nsee the target filesystem as local.  Now the filename retains the\ntarget: prefix, which means that in the child_path() call both the\nsysroot and the CANON_DIR have a target: prefix, and so the\nchild_path() call succeeds.  This allows GDB to progress, try some\nadditional paths, and then find the debug information.\n\nSo, this commit changes gdb.base/sysroot-debug-lookup.exp to expect\nthe test to succeed when using the native-extended-gdbserver protocol.\n\nThis leaves one KFAIL when using the native-extended-gdbserver board,\nwe find the debug information but (apparently) find it in the wrong\nfile.  What\u0027s happening is that when GDB builds the filename for the\ndebug information we end up with a \u0027//\u0027 string as a directory\nseparator, the test regexp only expects a single separator.\n\nInstead of just fixing the test regexp, I\u0027ve updated the path_join\nfunction in gdbsupport/pathstuff.{cc,h} to allow for absolute paths to\nappear in the argument list after the first argument.  This means it\u0027s\nnow possible to do this:\n\n  auto result \u003d path_join (\"/a/b/c\", \"/d/e/f\");\n  gdb_assert (result \u003d\u003d \"/a/b/c/d/e/f\");\n\nAdditionally I\u0027ve changed path_join so that it avoids adding\nunnecessary directory separators.  In the above case when the two\npaths were joined GDB only added a single separator between \u0027c\u0027 and\n\u0027d\u0027.  But additionally, if we did this:\n\n  auto result \u003d path_join (\"/a/b/c/\", \"/d/e/f\");\n  gdb_assert (result \u003d\u003d \"/a/b/c/d/e/f\");\n\nWe\u0027d still only get a single separator.\n\nWith these changes to path_join I can now make use of this function in\nfind_separate_debug_file.  With this done I now have no KFAIL when\nusing the native-extended-gdbserver board.\n\nAfter this commit we still have 2 KFAIL when not using the\nnative-gdbserver and unix boards, these will be addressed in the next\ncommit.\n\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id\u003d31804\n\nReviewed-By: Keith Seitz \u003ckeiths@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "49b98459a28a5caffa4661701f674da79d0d1c99",
      "old_mode": 33188,
      "old_path": "gdb/symfile.c",
      "new_id": "11313c858c6cf69870df7e41b28507f0c24ae561",
      "new_mode": 33188,
      "new_path": "gdb/symfile.c"
    },
    {
      "type": "modify",
      "old_id": "36f65192ca3fe49f1ce85fa8e6369a5ba95e9c62",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/sysroot-debug-lookup.exp",
      "new_id": "88be6ff9a7e17581fe90ab4574b4787fffc283e9",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/sysroot-debug-lookup.exp"
    },
    {
      "type": "modify",
      "old_id": "9c3816ccc63057d3aadec5e01b36ba382fe54d33",
      "old_mode": 33188,
      "old_path": "gdbsupport/pathstuff.cc",
      "new_id": "029e3c9a89001688877ea041d414acd41927e349",
      "new_mode": 33188,
      "new_path": "gdbsupport/pathstuff.cc"
    },
    {
      "type": "modify",
      "old_id": "a61ce23efde5c09884396d67337e8126db6be2c8",
      "old_mode": 33188,
      "old_path": "gdbsupport/pathstuff.h",
      "new_id": "22170bbabf2016a7d2118c2dd8c74c4d4a176b6a",
      "new_mode": 33188,
      "new_path": "gdbsupport/pathstuff.h"
    }
  ]
}
