)]}'
{
  "commit": "3d38b301bb50f1822e9d07d2aacef1ebe1a97073",
  "tree": "95746bf7b46457396896ada812624039c830c04e",
  "parents": [
    "b09dba5a5fcf061bf93c1e5a5c9fd56928c6340c"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sun Sep 24 12:37:40 2023 +0100"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Thu Oct 05 12:21:46 2023 +0100"
  },
  "message": "gdb: remove print_sys_errmsg\n\nThis started with me running into this comment in symfile.c:\n\n  /* FIXME, should use print_sys_errmsg but it\u0027s not filtered.  */\n  gdb_printf (_(\"`%ps\u0027 has disappeared; keeping its symbols.\\n\"),\n              styled_string (file_name_style.style (), filename));\n\nIn this particular case I think I disagree with the comment; I think\nthe output should be a warning rather than just a message printed to\ngdb_stdout, I think when the executable, or some other objfile that is\ncurrently being debugged, disappears from disk, this is likely an\nunexpected situation, and worth warning the user about.\n\nSo, in theory, I could just call print_sys_errmsg and remove the\ncomment, but that would mean loosing the filename styling in the\noutput... so in the end I remove the comment and updated the code to\ncall warning.\n\nBut that got me looking at print_sys_errmsg and how it\u0027s used.\n\nCurrently the function takes a string and an errno, and prints, to\nstderr, the string followed by the result of calling strerror on the\nerrno.\n\nIn some places the string passed to print_sys_errmsg is just a\nfilename, and this is used when something goes wrong.  In these cases,\nI think calling warning rather than gdb_printf to gdb_stderr, would be\nbetter, and in fact, in a couple of places we manually print a\n\"warning\" prefix, and then call print_sys_errmsg.  And so, for these\nusers I have added a new function warning_filename_and_errno, which\ntakes a filename, which is printed with styling, and an errno, which\nis passed through strerror and the resulting string printed.  This new\nfunction calls warning to print its output.  I then updated some of\nthe print_sys_errmsg users to use this new function.\n\nSome other users of print_sys_errmsg are also emitting what is clearly\na warning, however, the string being passed in is more than just a\nfilename, so the new warning_filename_and_errno function can\u0027t be\nused, it would style the whole string.  For these users I have\nswitched to calling warning directly, this allows me to style the\nwarning message correctly.\n\nFinally, in inflow.c there is one last call to print_sys_errmsg, in\nthis case I just inlined the definition of print_sys_errmsg.  This is\na really weird case, as after printing this message GDB just does a\nhard exit.  This is pretty old code, dating back to the initial GDB\nimport, I guess it should be updated to call error() maybe, but I\u0027m\nreluctant to make this change as part of this commit, just in case\nthere\u0027s some reason why we can\u0027t throw an error at this point.\n\nWith that done there are now no users of print_sys_errmsg, and so the\nold function can be removed.\n\nWhile I was doing all of the above I added some additional filename\nstyling in soure.c, this is in an else block where the if contained\nthe print_sys_errmsg call, so these felt related.\n\nAnd finally, while I was updating the uses of print_sys_errmsg in\nprocfs.c, I noticed that we used a static errmsg buffer to format some\nerror strings.  As the above changes got rid of one of the users of\nerrmsg I also removed the other two users, and the static buffer.\n\nThere were a couple of tests that depended on the existing output\nmessage format that needed updating.  In one case we gained an extra\n\u0027warning: \u0027 prefix, and in the other \u0027Warning: \u0027 becomes \u0027warning: \u0027,\nI think in both cases the new output is an improvement.\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "767cfd02c487a2faff989b2fbcd859d0500c3962",
      "old_mode": 33188,
      "old_path": "gdb/inflow.c",
      "new_id": "095c5f03672242f027245b5098f2b48d7f932dd4",
      "new_mode": 33188,
      "new_path": "gdb/inflow.c"
    },
    {
      "type": "modify",
      "old_id": "97e04f5b5d8edb0218165e5d597c1a375bbab801",
      "old_mode": 33188,
      "old_path": "gdb/main.c",
      "new_id": "8a1c2690100a088dd17787f9fe7dda4f14c5c374",
      "new_mode": 33188,
      "new_path": "gdb/main.c"
    },
    {
      "type": "modify",
      "old_id": "706ccf0965cff4079db4d8ab4f59889bf23b1193",
      "old_mode": 33188,
      "old_path": "gdb/procfs.c",
      "new_id": "48e9f3dd4b5f422d6749672098a5a4bcc59fbc1e",
      "new_mode": 33188,
      "new_path": "gdb/procfs.c"
    },
    {
      "type": "modify",
      "old_id": "5bdd729be8b75853c57f58c2866468159c507dc4",
      "old_mode": 33188,
      "old_path": "gdb/source.c",
      "new_id": "f648adc4520763e807b24f36d337b8f48c6e74ad",
      "new_mode": 33188,
      "new_path": "gdb/source.c"
    },
    {
      "type": "modify",
      "old_id": "ff8a3fd0bc55a5ab21026c084ad86d0639b47a69",
      "old_mode": 33188,
      "old_path": "gdb/symfile.c",
      "new_id": "30147b7c3df2e6765579505b12fac4aef3c62064",
      "new_mode": 33188,
      "new_path": "gdb/symfile.c"
    },
    {
      "type": "modify",
      "old_id": "4a9302fb9b71275570a6d27df5b77a2135d9fcc7",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.base/catch-syscall.exp",
      "new_id": "0588cb35d87e5f130ef0bb1c33915d0a9bcca9e6",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.base/catch-syscall.exp"
    },
    {
      "type": "modify",
      "old_id": "7e28931be22bcd8cbbcd0434a14e2be10eb9d159",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.dwarf2/imported-unit.exp",
      "new_id": "07aa6afbee7093219a130cb3fd371bb009b4b4d5",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.dwarf2/imported-unit.exp"
    },
    {
      "type": "modify",
      "old_id": "2f545337cd4074df7a8a8caae409f3a4bba61971",
      "old_mode": 33188,
      "old_path": "gdb/utils.c",
      "new_id": "a191d26a00701aa8b282792ec751dc6ca7c3bc0c",
      "new_mode": 33188,
      "new_path": "gdb/utils.c"
    },
    {
      "type": "modify",
      "old_id": "c5364fa4b35b17ac0192de0ca23b9230ce8e2374",
      "old_mode": 33188,
      "old_path": "gdb/utils.h",
      "new_id": "f646b300530aed52b7a50479a75c6925bf77ad6b",
      "new_mode": 33188,
      "new_path": "gdb/utils.h"
    },
    {
      "type": "modify",
      "old_id": "5a897dbfe761a31d8c7b2cba14d84b5695baa86c",
      "old_mode": 33188,
      "old_path": "gdb/windows-nat.c",
      "new_id": "7a139c8d36f7cf0667c8d9ace59e90db708c9dee",
      "new_mode": 33188,
      "new_path": "gdb/windows-nat.c"
    }
  ]
}
