When building gdb with O0 fsanitize=thread, and running test-case fission-relative-dwo, I get: ... (gdb) file /home/vries/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/fission-relative-dwo/fission-relative-dwo Reading symbols from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/fission-relative-dwo/fission-relative-dwo... (gdb) delete breakpoints (gdb) ================== [1m[31mWARNING: ThreadSanitizer: data race (pid=631374) [1m[0m[1m[34m Read of size 4 at 0xffffededf104 by thread T6 (mutexes: write M0): [1m[0m #0 bfd_preserve_save /home/vries/gdb/src/bfd/format.c:132 (gdb+0x146e39c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #1 bfd_check_format_matches /home/vries/gdb/src/bfd/format.c:362 (gdb+0x146f040) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #2 bfd_check_format /home/vries/gdb/src/bfd/format.c:94 (gdb+0x146e2fc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 try_open_dwop_file /home/vries/gdb/src/gdb/dwarf2/read.c:9120 (gdb+0x8ab8d8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 open_dwo_file /home/vries/gdb/src/gdb/dwarf2/read.c:9156 (gdb+0x8aba68) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 open_and_init_dwo_file /home/vries/gdb/src/gdb/dwarf2/read.c:9230 (gdb+0x8abf58) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 lookup_dwo_cutu /home/vries/gdb/src/gdb/dwarf2/read.c:9638 (gdb+0x8ada50) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 lookup_dwo_comp_unit /home/vries/gdb/src/gdb/dwarf2/read.c:9713 (gdb+0x8ade24) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #8 lookup_dwo_unit /home/vries/gdb/src/gdb/dwarf2/read.c:3935 (gdb+0x89b4c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #9 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) /home/vries/gdb/src/gdb/dwarf2/read.c:4176 (gdb+0x89c2b8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #10 process_psymtab_comp_unit /home/vries/gdb/src/gdb/dwarf2/read.c:4574 (gdb+0x89d3e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #11 cooked_index_worker::process_cus(unsigned long, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >) /home/vries/gdb/src/gdb/dwarf2/read.c:4869 (gdb+0x89e6f4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #12 operator() /home/vries/gdb/src/gdb/dwarf2/read.c:4981 (gdb+0x89ebc8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #13 __invoke_impl<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x8dedfc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #14 __invoke_r<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x8de078) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #15 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x8db2c8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #16 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #17 operator() /home/vries/gdb/src/gdbsupport/task-group.cc:69 (gdb+0x1d02680) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #18 __invoke_impl<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x1d0314c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #19 __invoke_r<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x1d02f4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #20 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x1d02c94) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #21 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #22 void std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x810db4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #23 std::enable_if<is_invocable_r_v<void, std::function<void ()>&>, void>::type std::__invoke_r<void, std::function<void ()>&>(std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0x810ad4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #24 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/13/future:1491 (gdb+0x8107a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #25 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const /usr/include/c++/13/future:1432 (gdb+0x811998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #26 std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x811734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #27 std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:116 (gdb+0x811284) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #28 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:291 (gdb+0x810eb8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #29 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x7fd404) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #30 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /usr/include/c++/13/future:589 (gdb+0x7fb8c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #31 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x802ff8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #32 std::__invoke_result<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>::type std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x7fff6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #33 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const <null> (gdb+0x7fcf64) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #34 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::operator()() const /usr/include/c++/13/mutex:836 (gdb+0x7fffe8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #35 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::_FUN() /usr/include/c++/13/mutex:836 (gdb+0x800034) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #36 pthread_once <null> (libtsan.so.2+0x66d3c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #37 __gthread_once /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:700 (gdb+0x7faef0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #38 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) <null> (gdb+0x7fd02c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #39 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/13/future:428 (gdb+0x7fb4f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #40 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run() /usr/include/c++/13/future:1494 (gdb+0x810834) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #41 std::packaged_task<void ()>::operator()() /usr/include/c++/13/future:1628 (gdb+0x1d0f4a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #42 gdb::thread_pool::thread_function() /home/vries/gdb/src/gdbsupport/thread-pool.cc:246 (gdb+0x1d0e820) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #43 void std::__invoke_impl<void, void (gdb::thread_pool::*)(), gdb::thread_pool*>(std::__invoke_memfun_deref, void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x1d12968) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #44 std::__invoke_result<void (gdb::thread_pool::*)(), gdb::thread_pool*>::type std::__invoke<void (gdb::thread_pool::*)(), gdb::thread_pool*>(void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x1d12804) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #45 void std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/13/bits/std_thread.h:292 (gdb+0x1d126e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #46 std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::operator()() /usr/include/c++/13/bits/std_thread.h:299 (gdb+0x1d1266c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #47 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> > >::_M_run() /usr/include/c++/13/bits/std_thread.h:244 (gdb+0x1d12618) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #48 execute_native_thread_routine <null> (libstdc++.so.6+0xdda9c) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4) [1m[34m Previous write of size 4 at 0xffffededf104 by main thread (mutexes: write M1): [1m[0m #0 bfd_cache_delete /home/vries/gdb/src/bfd/cache.c:183 (gdb+0x1467020) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #1 _bfd_cache_close_unlocked /home/vries/gdb/src/bfd/cache.c:594 (gdb+0x1468120) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #2 bfd_cache_close_all /home/vries/gdb/src/bfd/cache.c:651 (gdb+0x146824c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 notify_before_prompt /home/vries/gdb/src/gdb/event-top.c:478 (gdb+0x942058) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 top_level_prompt /home/vries/gdb/src/gdb/event-top.c:488 (gdb+0x9420ac) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 display_gdb_prompt(char const*) /home/vries/gdb/src/gdb/event-top.c:441 (gdb+0x941f30) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /home/vries/gdb/src/gdb/event-top.c:805 (gdb+0x942be4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 tui_command_line_handler /home/vries/gdb/src/gdb/tui/tui-interp.c:104 (gdb+0x10365f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #8 gdb_rl_callback_handler /home/vries/gdb/src/gdb/event-top.c:259 (gdb+0x941884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #9 rl_callback_read_char /home/vries/gdb/src/readline/readline/callback.c:290 (gdb+0x11a2c7c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #10 gdb_rl_callback_read_char_wrapper_noexcept /home/vries/gdb/src/gdb/event-top.c:195 (gdb+0x9415f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #11 gdb_rl_callback_read_char_wrapper /home/vries/gdb/src/gdb/event-top.c:234 (gdb+0x941720) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #12 stdin_event_handler /home/vries/gdb/src/gdb/ui.c:155 (gdb+0x1079320) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #13 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #14 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #15 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:264 (gdb+0x1cf4074) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #16 start_event_loop /home/vries/gdb/src/gdb/main.c:408 (gdb+0xb79354) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #17 captured_command_loop /home/vries/gdb/src/gdb/main.c:472 (gdb+0xb79584) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #18 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #19 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #20 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) [1m[32m Location is heap block of size 304 at 0xffffededf0c0 allocated by thread T6: [1m[0m #0 malloc <null> (libtsan.so.2+0x4538c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #1 bfd_malloc /home/vries/gdb/src/bfd/libbfd.c:290 (gdb+0x1472218) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #2 bfd_zmalloc /home/vries/gdb/src/bfd/libbfd.c:412 (gdb+0x14723c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 _bfd_new_bfd /home/vries/gdb/src/bfd/opncls.c:80 (gdb+0x14746f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 bfd_fopen /home/vries/gdb/src/bfd/opncls.c:272 (gdb+0x1474df4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 gdb_bfd_open(char const*, char const*, int, bool) /home/vries/gdb/src/gdb/gdb_bfd.c:580 (gdb+0x9a7950) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 try_open_dwop_file /home/vries/gdb/src/gdb/dwarf2/read.c:9116 (gdb+0x8ab89c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 open_dwo_file /home/vries/gdb/src/gdb/dwarf2/read.c:9156 (gdb+0x8aba68) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #8 open_and_init_dwo_file /home/vries/gdb/src/gdb/dwarf2/read.c:9230 (gdb+0x8abf58) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #9 lookup_dwo_cutu /home/vries/gdb/src/gdb/dwarf2/read.c:9638 (gdb+0x8ada50) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #10 lookup_dwo_comp_unit /home/vries/gdb/src/gdb/dwarf2/read.c:9713 (gdb+0x8ade24) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #11 lookup_dwo_unit /home/vries/gdb/src/gdb/dwarf2/read.c:3935 (gdb+0x89b4c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #12 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) /home/vries/gdb/src/gdb/dwarf2/read.c:4176 (gdb+0x89c2b8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #13 process_psymtab_comp_unit /home/vries/gdb/src/gdb/dwarf2/read.c:4574 (gdb+0x89d3e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #14 cooked_index_worker::process_cus(unsigned long, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >) /home/vries/gdb/src/gdb/dwarf2/read.c:4869 (gdb+0x89e6f4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #15 operator() /home/vries/gdb/src/gdb/dwarf2/read.c:4981 (gdb+0x89ebc8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #16 __invoke_impl<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x8dedfc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #17 __invoke_r<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x8de078) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #18 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x8db2c8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #19 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #20 operator() /home/vries/gdb/src/gdbsupport/task-group.cc:69 (gdb+0x1d02680) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #21 __invoke_impl<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x1d0314c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #22 __invoke_r<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x1d02f4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #23 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x1d02c94) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #24 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #25 void std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x810db4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #26 std::enable_if<is_invocable_r_v<void, std::function<void ()>&>, void>::type std::__invoke_r<void, std::function<void ()>&>(std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0x810ad4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #27 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/13/future:1491 (gdb+0x8107a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #28 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const /usr/include/c++/13/future:1432 (gdb+0x811998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #29 std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x811734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #30 std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:116 (gdb+0x811284) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #31 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:291 (gdb+0x810eb8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #32 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x7fd404) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #33 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /usr/include/c++/13/future:589 (gdb+0x7fb8c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #34 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x802ff8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #35 std::__invoke_result<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>::type std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x7fff6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #36 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const <null> (gdb+0x7fcf64) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #37 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::operator()() const /usr/include/c++/13/mutex:836 (gdb+0x7fffe8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #38 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::_FUN() /usr/include/c++/13/mutex:836 (gdb+0x800034) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #39 pthread_once <null> (libtsan.so.2+0x66d3c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #40 __gthread_once /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:700 (gdb+0x7faef0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #41 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) <null> (gdb+0x7fd02c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #42 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/13/future:428 (gdb+0x7fb4f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #43 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run() /usr/include/c++/13/future:1494 (gdb+0x810834) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #44 std::packaged_task<void ()>::operator()() /usr/include/c++/13/future:1628 (gdb+0x1d0f4a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #45 gdb::thread_pool::thread_function() /home/vries/gdb/src/gdbsupport/thread-pool.cc:246 (gdb+0x1d0e820) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #46 void std::__invoke_impl<void, void (gdb::thread_pool::*)(), gdb::thread_pool*>(std::__invoke_memfun_deref, void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x1d12968) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #47 std::__invoke_result<void (gdb::thread_pool::*)(), gdb::thread_pool*>::type std::__invoke<void (gdb::thread_pool::*)(), gdb::thread_pool*>(void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x1d12804) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #48 void std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/13/bits/std_thread.h:292 (gdb+0x1d126e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #49 std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::operator()() /usr/include/c++/13/bits/std_thread.h:299 (gdb+0x1d1266c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #50 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> > >::_M_run() /usr/include/c++/13/bits/std_thread.h:244 (gdb+0x1d12618) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #51 execute_native_thread_routine <null> (libstdc++.so.6+0xdda9c) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4) [1m[35m Mutex M0 (0x000003280560) created at: [1m[0m #0 pthread_mutex_lock <null> (libtsan.so.2+0x56b28) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #1 __gthread_mutex_lock /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:749 (gdb+0x74cc34) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #2 std::mutex::lock() /usr/include/c++/13/bits/std_mutex.h:113 (gdb+0x74cce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 std::lock_guard<std::mutex>::lock_guard(std::mutex&) /usr/include/c++/13/bits/std_mutex.h:249 (gdb+0x74d428) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 lookup_dwo_unit /home/vries/gdb/src/gdb/dwarf2/read.c:3911 (gdb+0x89b368) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 cutu_reader::cutu_reader(dwarf2_per_cu_data*, dwarf2_per_objfile*, abbrev_table*, dwarf2_cu*, bool, abbrev_cache*) /home/vries/gdb/src/gdb/dwarf2/read.c:4176 (gdb+0x89c2b8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 process_psymtab_comp_unit /home/vries/gdb/src/gdb/dwarf2/read.c:4574 (gdb+0x89d3e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 cooked_index_worker::process_cus(unsigned long, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >, __gnu_cxx::__normal_iterator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>*, std::vector<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter>, std::allocator<std::unique_ptr<dwarf2_per_cu_data, dwarf2_per_cu_data_deleter> > > >) /home/vries/gdb/src/gdb/dwarf2/read.c:4869 (gdb+0x89e6f4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #8 operator() /home/vries/gdb/src/gdb/dwarf2/read.c:4981 (gdb+0x89ebc8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #9 __invoke_impl<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x8dedfc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #10 __invoke_r<void, cooked_index_worker::do_reading()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x8de078) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #11 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x8db2c8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #12 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #13 operator() /home/vries/gdb/src/gdbsupport/task-group.cc:69 (gdb+0x1d02680) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #14 __invoke_impl<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x1d0314c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #15 __invoke_r<void, gdb::task_group::impl::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x1d02f4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #16 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x1d02c94) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #17 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #18 void std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x810db4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #19 std::enable_if<is_invocable_r_v<void, std::function<void ()>&>, void>::type std::__invoke_r<void, std::function<void ()>&>(std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0x810ad4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #20 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/13/future:1491 (gdb+0x8107a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #21 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const /usr/include/c++/13/future:1432 (gdb+0x811998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #22 std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x811734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #23 std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:116 (gdb+0x811284) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #24 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:291 (gdb+0x810eb8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #25 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x7fd404) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #26 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /usr/include/c++/13/future:589 (gdb+0x7fb8c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #27 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x802ff8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #28 std::__invoke_result<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>::type std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x7fff6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #29 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const <null> (gdb+0x7fcf64) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #30 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::operator()() const /usr/include/c++/13/mutex:836 (gdb+0x7fffe8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #31 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::_FUN() /usr/include/c++/13/mutex:836 (gdb+0x800034) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #32 pthread_once <null> (libtsan.so.2+0x66d3c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #33 __gthread_once /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:700 (gdb+0x7faef0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #34 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) <null> (gdb+0x7fd02c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #35 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/13/future:428 (gdb+0x7fb4f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #36 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run() /usr/include/c++/13/future:1494 (gdb+0x810834) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #37 std::packaged_task<void ()>::operator()() /usr/include/c++/13/future:1628 (gdb+0x1d0f4a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #38 gdb::thread_pool::thread_function() /home/vries/gdb/src/gdbsupport/thread-pool.cc:246 (gdb+0x1d0e820) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #39 void std::__invoke_impl<void, void (gdb::thread_pool::*)(), gdb::thread_pool*>(std::__invoke_memfun_deref, void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x1d12968) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #40 std::__invoke_result<void (gdb::thread_pool::*)(), gdb::thread_pool*>::type std::__invoke<void (gdb::thread_pool::*)(), gdb::thread_pool*>(void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x1d12804) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #41 void std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/13/bits/std_thread.h:292 (gdb+0x1d126e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #42 std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::operator()() /usr/include/c++/13/bits/std_thread.h:299 (gdb+0x1d1266c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #43 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> > >::_M_run() /usr/include/c++/13/bits/std_thread.h:244 (gdb+0x1d12618) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #44 execute_native_thread_routine <null> (libstdc++.so.6+0xdda9c) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4) [1m[35m Mutex M1 (0x000002fb5838) created at: [1m[0m #0 pthread_mutex_lock <null> (libtsan.so.2+0x56b28) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #1 __gthread_mutex_lock /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:749 (gdb+0x9aa654) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #2 __gthread_recursive_mutex_lock /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:811 (gdb+0x9aa708) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 std::recursive_mutex::lock() /usr/include/c++/13/mutex:120 (gdb+0x9aa798) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 gdb_bfd_lock /home/vries/gdb/src/gdb/gdb_bfd.c:53 (gdb+0x9a67e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 bfd_lock /home/vries/gdb/src/bfd/bfd.c:1854 (gdb+0x146390c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 bfd_cache_close_all /home/vries/gdb/src/bfd/cache.c:645 (gdb+0x14681f4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 notify_before_prompt /home/vries/gdb/src/gdb/event-top.c:478 (gdb+0x942058) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #8 top_level_prompt /home/vries/gdb/src/gdb/event-top.c:488 (gdb+0x9420ac) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #9 display_gdb_prompt(char const*) /home/vries/gdb/src/gdb/event-top.c:441 (gdb+0x941f30) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #10 cli_interp_base::pre_command_loop() /home/vries/gdb/src/gdb/cli/cli-interp.c:180 (gdb+0x6f2dd8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #11 captured_command_loop /home/vries/gdb/src/gdb/main.c:469 (gdb+0xb79580) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #12 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #13 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #14 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) [1m[36m Thread T6 'gdb worker' (tid=631386, running) created by main thread at: [1m[0m #0 pthread_create <null> (libtsan.so.2+0x4605c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xddbe4) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4) #2 gdb::thread_pool::set_thread_count(unsigned long) /home/vries/gdb/src/gdbsupport/thread-pool.cc:169 (gdb+0x1d0e4b4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #3 update_thread_pool_size() /home/vries/gdb/src/gdb/maint.c:866 (gdb+0xb87c70) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #4 captured_main_1 /home/vries/gdb/src/gdb/main.c:1062 (gdb+0xb7a8a4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #5 captured_main /home/vries/gdb/src/gdb/main.c:1332 (gdb+0xb7b998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #6 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) #7 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3) SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/bfd/format.c:132 in bfd_preserve_save ================== ... There are in fact 3: ... SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/bfd/format.c:132 in bfd_preserve_save SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/bfd/format.c:134 in bfd_preserve_save SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/bfd/cache.c:183 in bfd_cache_delete ... but that got me over the comment character limit.
Bisects to: ... Commit 0a008773c59bd80f80c02220537317c865546aca Author: Tom Tromey <tom@tromey.com> Date: Wed Mar 29 10:55:13 2023 -0600 Lazy language setting ...
I couldn't reproduce this on Fedora 38. I do think the BFD preserve stuff probably has a race though. Also bfd_check_format_matches calls bfd_set_error_handler, which sets a global.
(In reply to Tom Tromey from comment #2) > I couldn't reproduce this on Fedora 38. I ran into this on Fedora 39, aarch64, in a full test run. I tried reproducing in a loop like so running only the test-case: ... $ for n in $(seq 1 25); do \ ./test.sh 2>&1 | grep "# of " | sort -u; \ grep -ac ThreadSan gdb.log; \ done ... There's grepping in gdb.log because there's no FAIL when ThreadSanitizer triggers. It reproduced only once out of 25 times.
(In reply to Tom de Vries from comment #3) > I tried reproducing in a loop like so running only the test-case: On openSUSE Leap 15.4 x86_64, reproduced 15 out of 25 times.
There's also gdb_bfd_error_handler to deal with :(
And bfd's error_handler_sprintf stores any messages in the target xvec, not the bfd...
Some work here: https://sourceware.org/pipermail/binutils/2024-January/132224.html If that goes in, I'll change gdb's BFD error handler. I'll probably have it call warning (we can already intercept those in workers), not sure yet though. Still haven't investigated the clash with bfd_cache_close_all.
I sent the error handler rewrite and I have another patch nearly ready (just need to figure out how to test it) that deals with the xvec issue. Still haven't looked at the bfd_cache_close_all race though. I suspect some locking in format-checking or maybe in the one spot that changes the iovec during classification.
https://sourceware.org/pipermail/binutils/2024-March/133155.html
Hey Tom, IIUC, the latest status is that these changes are still pending. - Wed Apr 10: Alan Modra sent a reply with some comments; - Fri Apr 12: Nick approved, but I'm not sure he saw Alan's comments. Are there updates you would be able to share on this PR? Thank you!
I'll be sending a new patch today, hopefully.
The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bacc61fd3e6fd61a59fb59bcc657be17a381520d commit bacc61fd3e6fd61a59fb59bcc657be17a381520d Author: Tom Tromey <tom@tromey.com> Date: Mon Feb 12 18:06:56 2024 -0700 Thread-safety improvements for bfd_check_format_matches A gdb bug found that bfd_check_format_matches has some data races when called from multiple threads. In particular, it changes the BFD error handler, which is a global. It also has a local static variable ("in_check_format") that is used for recursion detection. And, finally, it may emit warnings to the per-xvec warning array, which is a global. This patch removes all the races here. The first part of patch is to change _bfd_error_handler to directly handle the needs of bfd_check_format_matches. This way, the error handler does not need to be changed. This change lets us use the new per-thread global (error_handler_messages, replacing error_handler_bfd) to also remove the need for in_check_format -- a single variable suffices. Finally, the global per-xvec array is replaced with a new type that holds the error messages. The outermost such type is stack-allocated in bfd_check_format_matches. I tested this using the binutils test suite. I also built gdb with thread sanitizer and ran the test case that was noted as failing. Finally, Alan sent me the test file that caused the addition of the xvec warning code in the first place, and I confirmed that "nm-new" has the same behavior on this file both before and after this patch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264 Co-Authored-By: Alan Modra <amodra@gmail.com>
The master branch has been updated by Tom Tromey <tromey@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=20bf7711bce2188c1af985a87df23c4653c2cc7a commit 20bf7711bce2188c1af985a87df23c4653c2cc7a Author: Tom Tromey <tom@tromey.com> Date: Sat Mar 23 15:19:20 2024 -0600 Avoid cache race in bfd_check_format_matches Running the gdb test suite with the thread sanitizer enabled shows a race when bfd_check_format_matches and bfd_cache_close_all are called simultaneously on different threads. This patch fixes this race by having bfd_check_format_matches temporarily remove the BFD from the file descriptor cache -- leaving it open while format-checking proceeds. In this setup, the BFD client is responsible for closing the BFD again on the "checking" thread, should that be desired. gdb does this by calling bfd_cache_close in the relevant worker thread. An earlier version of this patch omitted the "possibly_cached" helper function. However, this ran into crashes in the binutils test suite involving the archive-checking abort in bfd_cache_lookup_worker. I do not understand the purpose of this check, so I've simply had the new function work around it. I couldn't find any comments explaining this situation, either. I suspect that there may still be races related to this case, but I don't think I have access to the platforms where gdb deals with archives. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31264
Fixed.