)]}'
{
  "commit": "7ae086a3da45baec8d11f917ce00deeccf61c2d3",
  "tree": "9840fb1a89d8d427d28ffb081cad805da2582b60",
  "parents": [
    "ba6740ebdae0a30fb5d24970ae3b41d3b114a9a7"
  ],
  "author": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Thu May 21 00:00:48 2026 -0400"
  },
  "committer": {
    "name": "Simon Marchi",
    "email": "simon.marchi@efficios.com",
    "time": "Thu May 21 13:48:59 2026 -0400"
  },
  "message": "gdb: lock complaint_mutex in clear_complaints\n\nIf I add a dummy complaint like\n\n    complaint (_(\"I am a complaint\"));\n\nin cooked_index_worker_debug_info::process_unit, and then load a file\nunder a GDB built with ThreadSanitizer, I get this (trimmed for\nreadability):\n\n    WARNING: ThreadSanitizer: data race (pid\u003d497507)\n      Read of size 4 at 0x7208000004c8 by thread T4 (mutexes: write M0):\n        #0 std::pair\u003c__gnu_debug::_Safe_iterator\u003c__gnu_cxx::__normal_iterator\u003cstd::pair\u003cchar const*, int\u003e*, std::__cxx1998::vector\u003cstd::pair\u003cchar const*, int\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e \u003e \u003e, std::__debug::vector\u003cstd::pair\u003cchar const*, int\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e \u003e, std::random_access_iterator_tag\u003e, bool\u003e ankerl::unordered_dense::v4_8_0::detail::table\u003cchar const*, int, ankerl::unordered_dense::v4_8_0::hash\u003cchar const*, void\u003e, std::equal_to\u003cchar const*\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false\u003e::do_try_emplace\u003cchar const* const\u0026\u003e(char const* const\u0026) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1227 (gdb+0xf0fd75) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #1 std::pair\u003c__gnu_debug::_Safe_iterator\u003c__gnu_cxx::__normal_iterator\u003cstd::pair\u003cchar const*, int\u003e*, std::__cxx1998::vector\u003cstd::pair\u003cchar const*, int\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e \u003e \u003e, std::__debug::vector\u003cstd::pair\u003cchar const*, int\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e \u003e, std::random_access_iterator_tag\u003e, bool\u003e ankerl::unordered_dense::v4_8_0::detail::table\u003cchar const*, int, ankerl::unordered_dense::v4_8_0::hash\u003cchar const*, void\u003e, std::equal_to\u003cchar const*\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false\u003e::try_emplace\u003c, int, true\u003e(char const* const\u0026) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1701 (gdb+0xf0ec50) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #2 int\u0026 ankerl::unordered_dense::v4_8_0::detail::table\u003cchar const*, int, ankerl::unordered_dense::v4_8_0::hash\u003cchar const*, void\u003e, std::equal_to\u003cchar const*\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false\u003e::operator[]\u003cint, true\u003e(char const* const\u0026) /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1926 (gdb+0xf0e3e2) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #3 complaint_internal(char const*, ...) /home/simark/src/binutils-gdb/gdb/complaints.c:50 (gdb+0xf0abc6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #4 cooked_index_worker_debug_info::process_unit(dwarf2_per_cu*, dwarf2_per_objfile*, cooked_index_worker_result*) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3162 (gdb+0x11d741c) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #5 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}::operator()() const /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3068 (gdb+0x122b195) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #6 void cooked_index_worker_result::catch_error\u003ccooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}\u003e(cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}\u0026\u0026) /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index-worker.h:122 (gdb+0x1236454) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #7 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3066 (gdb+0x122b22d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #8 cooked_index_worker_debug_info::parallel_indexing_worker::operator()(iterator_range\u003cstd::unique_ptr\u003cdwarf2_per_cu, dwarf2_per_cu_deleter\u003e*\u003e) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3060 (gdb+0x122b0a3) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        ...\n\n      Previous write of size 8 at 0x7208000004c8 by main thread:\n        #0 __tsan_memset \u003cnull\u003e (libtsan.so.2+0x95e66) (BuildId: b5c99e8ceaf9098eb9a01fcfcc35ece8603116df)\n        #1 ankerl::unordered_dense::v4_8_0::detail::table\u003cchar const*, int, ankerl::unordered_dense::v4_8_0::hash\u003cchar const*, void\u003e, std::equal_to\u003cchar const*\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false\u003e::clear_buckets() /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1116 (gdb+0xf0edd6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #2 ankerl::unordered_dense::v4_8_0::detail::table\u003cchar const*, int, ankerl::unordered_dense::v4_8_0::hash\u003cchar const*, void\u003e, std::equal_to\u003cchar const*\u003e, std::allocator\u003cstd::pair\u003cchar const*, int\u003e \u003e, ankerl::unordered_dense::v4_8_0::bucket_type::standard, ankerl::unordered_dense::v4_8_0::detail::default_container_t, false\u003e::clear() /home/simark/src/binutils-gdb/gdb/../gdbsupport/unordered_dense/unordered_dense.h:1494 (gdb+0xf0e479) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #3 clear_complaints() /home/simark/src/binutils-gdb/gdb/complaints.c:74 (gdb+0xf0adbf) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #4 finish_new_objfile /home/simark/src/binutils-gdb/gdb/symfile.c:986 (gdb+0x1a2c65d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #5 symbol_file_add_with_addrs /home/simark/src/binutils-gdb/gdb/symfile.c:1111 (gdb+0x1a2cdde) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #6 symbol_file_add_from_bfd(gdb::ref_ptr\u003cbfd, gdb_bfd_ref_policy\u003e const\u0026, char const*, enum_flags\u003csymfile_add_flag\u003e, std::__debug::vector\u003cother_sections, std::allocator\u003cother_sections\u003e \u003e*, enum_flags\u003cobjfile_flag\u003e, objfile*) /home/simark/src/binutils-gdb/gdb/symfile.c:1148 (gdb+0x1a2cfab) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #7 symbol_file_add(char const*, enum_flags\u003csymfile_add_flag\u003e, std::__debug::vector\u003cother_sections, std::allocator\u003cother_sections\u003e \u003e*, enum_flags\u003cobjfile_flag\u003e) /home/simark/src/binutils-gdb/gdb/symfile.c:1161 (gdb+0x1a2d03a) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #8 symbol_file_add_main_1 /home/simark/src/binutils-gdb/gdb/symfile.c:1185 (gdb+0x1a2d1a5) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #9 symbol_file_command(char const*, int) /home/simark/src/binutils-gdb/gdb/symfile.c:1615 (gdb+0x1a2ed10) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #10 file_command /home/simark/src/binutils-gdb/gdb/exec.c:580 (gdb+0x1305356) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        ...\n\n      Location is heap block of size 32 at 0x7208000004c0 allocated by main thread:\n        ...\n        #11 __static_initialization_and_destruction_0 /home/simark/src/binutils-gdb/gdb/complaints.c:31 (gdb+0xf0df04) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        ...\n\n      Mutex M0 (0x558908cdbc20) created at:\n        #0 pthread_mutex_lock \u003cnull\u003e (libtsan.so.2+0x60b5a) (BuildId: b5c99e8ceaf9098eb9a01fcfcc35ece8603116df)\n        #1 __gthread_mutex_lock(pthread_mutex_t*) /usr/include/c++/16.1.1/x86_64-pc-linux-gnu/bits/gthr-default.h:795 (gdb+0xf0dfa6) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #2 std::mutex::lock() /usr/include/c++/16.1.1/bits/std_mutex.h:116 (gdb+0xf0dfa6)\n        #3 std::lock_guard\u003cstd::mutex\u003e::lock_guard(std::mutex\u0026) /usr/include/c++/16.1.1/bits/std_mutex.h:276 (gdb+0xf0e1f0) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #4 complaint_internal(char const*, ...) /home/simark/src/binutils-gdb/gdb/complaints.c:49 (gdb+0xf0abad) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #5 cooked_index_worker_debug_info::process_unit(dwarf2_per_cu*, dwarf2_per_objfile*, cooked_index_worker_result*) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3162 (gdb+0x11d741c) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #6 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}::operator()() const /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3068 (gdb+0x122b195) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #7 void cooked_index_worker_result::catch_error\u003ccooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}\u003e(cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026)::{lambda()#1}\u0026\u0026) /home/simark/src/binutils-gdb/gdb/dwarf2/cooked-index-worker.h:122 (gdb+0x1236454) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #8 cooked_index_worker_debug_info::parallel_indexing_worker::process_one(dwarf2_per_cu\u0026) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3066 (gdb+0x122b22d) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        #9 cooked_index_worker_debug_info::parallel_indexing_worker::operator()(iterator_range\u003cstd::unique_ptr\u003cdwarf2_per_cu, dwarf2_per_cu_deleter\u003e*\u003e) /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:3060 (gdb+0x122b0a3) (BuildId: 5d682ab96882c738940aae3c2c67270d969f113f)\n        ...\n\nThis points to clear_complaints touching the global counters map in the\nmain thread without holding a lock, while a background thread touched\nthe map in a worker thread while holding the lock complaint_mutex.\n\nFix this by holding the complaint_mutex lock in clear_complaints.\n\nChange-Id: Id2fe442486bcdf57156aacdc9253055702c07600\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4a2318a7f8051bfe17237d356c58f3216e04adb9",
      "old_mode": 33188,
      "old_path": "gdb/complaints.c",
      "new_id": "ab6e2049685c25e26da6842fb4ec45eae6765dc3",
      "new_mode": 33188,
      "new_path": "gdb/complaints.c"
    }
  ]
}
