)]}'
{
  "commit": "d09eba07ca013e6b95eeafd67d79c32ebf6f28eb",
  "tree": "9cd5e4a6b544bb415e13799b1b5408d43081e71c",
  "parents": [
    "bd21dd6807893c76b94da522b6af14c6b8c745a8"
  ],
  "author": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Thu Sep 11 13:14:16 2025 +0100"
  },
  "committer": {
    "name": "Pedro Alves",
    "email": "pedro@palves.net",
    "time": "Mon Sep 15 19:49:43 2025 +0100"
  },
  "message": "Make get_compiler_info use gdb_caching_proc\n\nWhile running tests on Windows with:\n\n $ make check-parallel RUNTESTFLAGS\u003d\"-v\"\n\nI noticed that get_compiler_info was invoking the compiler over and\nover for each testcase, even though the result is supposed to be\ncached.\n\nThis isn\u0027t normally very visible in gdb.log, because we suppress it\nthere:\n\n    # Run $ifile through the right preprocessor.\n    # Toggle gdb.log to keep the compiler output out of the log.\n    set saved_log [log_file -info]\n    log_file\n    ...\n\nI\u0027m not sure it\u0027s a good idea to do that suppression, BTW.  I was very\nconfused when I couldn\u0027t find the compiler invocation in gdb.log, and\nit took me a while to notice that code.\n\nThe reason get_compiler_info in parallel mode isn\u0027t hitting the cache\nis that in that mode each testcase runs under its own expect/dejagnu\nprocess, and the way get_compiler_info caches results currently\ndoesn\u0027t handle that -- the result is simply cached in a global\nvariable, which is private to each expect.\n\nSo improve this by switching get_compiler_info\u0027s caching mechanism to\ngdb_caching_proc instead, so that results are cached across parallel\ninvocations of dejagnu.\n\nOn an x86-64 GNU/Linux run with \"make check-parallel -j32\", before the\npatch I get 2223 calls to get_compiler_info that result in a compiler\ninvocation.  After the patch, I get 7.\n\nOn GNU/Linux, those compiler invocations don\u0027t cost much, but on\nWindows, they add up.  On my machine each invocation takes around\n500ms to 700ms.  Here is one representative run:\n\n  $ time x86_64-w64-mingw32-gcc  \\\n     /c/msys2/home/alves/gdb/build-testsuite/temp/14826/compiler.c \\\n     -fdiagnostics-color\u003dnever -E\n  ...\n  real    0m0.639s\n  user    0m0.061s\n  sys     0m0.141s\n\nThis reference to a \u0027compiler_info\u0027 global:\n\n # N.B. compiler_info is intended to be local to this file.\n # Call test_compiler_info with no arguments to fetch its value.\n # Yes, this is counterintuitive when there\u0027s get_compiler_info,\n # but that\u0027s the current API.\n if [info exists compiler_info] {\n     unset compiler_info\n }\n\nis outdated, even before this patch, as \"compiler_info\" is a local\nvariable in get_compiler_info.  Remove all that code.\n\nSince test_compiler_info now calls get_compiler_info directly, the\n\"Requires get_compiler_info\" comments in skip_inline_frame_tests and\nskip_inline_var_tests are no longer accurate.  Remove them.\n\ntest_compiler_info\u0027s intro comment is also outdated; improve it.\n\nChanging the return value of get_compiler_info to be the\n\u0027compiler_info\u0027 string directly instead of 0/-1 was simpler.  It would\nbe possible to support the current 0/-1 interface by making\nget_compiler_info_1 still return the \u0027compiler_info\u0027 string, and then\nhaving the get_compiler_info wrapper convert to 0/-1, and I considered\ndoing that.  But the only caller of get_compiler_info outside gdb.exp\nis gdb.python/py-event-load.exp, and it seems that one simply crossed\nwires with:\n\n commit 9704b8b4bc58f4f464961cca97d362fd33740ce8\n gdb/testsuite: remove unneeded calls to get_compiler_info\n\nas the test as added at roughly the same time as that commit.\n\nSo simply remove that call in gdb.python/py-event-load.exp, otherwise\nwe get something like:\n\n ERROR: -------------------------------------------\n ERROR: in testcase src/gdb/testsuite/gdb.python/py-event-load.exp\n ERROR:  expected boolean value but got \"gcc-13-3-0\"\n ERROR:  tcl error code TCL VALUE NUMBER\n ERROR:  tcl error info:\n expected boolean value but got \"gcc-13-3-0\"\n\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\nChange-Id: Ia3d3dc34f7cdcf9a2013f1054128c62a108eabfb\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "a09a946e9a7c95e1fbf8de4060c496c29c3cb9e5",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.python/py-event-load.exp",
      "new_id": "dbb225f945712278a35678880c80a0591d66a9f0",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.python/py-event-load.exp"
    },
    {
      "type": "modify",
      "old_id": "3c19f7110eafbfacc57abf2b3fa80611bfdd7e9f",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/lib/gdb.exp",
      "new_id": "1780e3775360437884835c941886c00990f4c673",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/lib/gdb.exp"
    }
  ]
}
