Bug 31263 - [gdb] ThreadSanitizer: data race extension.c:755 in set_active_ext_lang(extension_language_defn const*)
Summary: [gdb] ThreadSanitizer: data race extension.c:755 in set_active_ext_lang(exten...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: dap (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 15.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-18 09:37 UTC by Tom de Vries
Modified: 2024-02-28 16:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2024-01-18 09:37:02 UTC
When building gdb with O0 fsanitize=thread, and running test-case gdb.dap/pause.exp, I get:
...
Content-Length: 104

{"type": "event", "event": "continued", "body": {"threadId": 1, "allThreadsContinued": true}, "seq": 20}PASS: gdb.dap/pause.exp: continued
>>> {"seq": 9, "type": "request", "command": "cancel", "arguments": {"requestId": 8}}
Content-Length: 113

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "==================\n"}, "seq": 21}Content-Length: 143

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "WARNING: ThreadSanitizer: data race (pid=615372)\n"}, "seq": 22}Content-Length: 144

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Read of size 1 at 0x00000328064c by thread T19:\n"}, "seq": 23}Content-Length: 260

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 set_active_ext_lang(extension_language_defn const*) /home/vries/gdb/src/gdb/extension.c:755 (gdb+0x94f9f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 24}Content-Length: 297

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling() /home/vries/gdb/src/gdb/extension.c:697 (gdb+0x94f884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 25}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #2 gdbpy_interrupt /home/vries/gdb/src/gdb/python/python.c:1106 (gdb+0xd6ad40) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 26}Content-Length: 220

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #3 cfunction_vectorcall_NOARGS <null> (libpython3.12.so.1.0+0x18017c) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 27}Content-Length: 95

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 28}Content-Length: 155

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Previous write of size 1 at 0x00000328064c by main thread:\n"}, "seq": 29}Content-Length: 297

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling() /home/vries/gdb/src/gdb/extension.c:704 (gdb+0x94f8d4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 30}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 fetch_inferior_event() /home/vries/gdb/src/gdb/infrun.c:4591 (gdb+0xa9abc4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 31}Content-Length: 250

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #2 inferior_event_handler(inferior_event_type) /home/vries/gdb/src/gdb/inf-loop.c:42 (gdb+0xa6a734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 32}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #3 handle_target_event /home/vries/gdb/src/gdb/linux-nat.c:4357 (gdb+0xb0cb4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 33}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #4 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 34}Content-Length: 237

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #5 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 35}Content-Length: 240

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #6 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:217 (gdb+0x1cf3ee8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 36}Content-Length: 227

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #7 wait_sync_command_done() /home/vries/gdb/src/gdb/top.c:427 (gdb+0xff6c74) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 37}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #8 maybe_wait_sync_command_done(int) /home/vries/gdb/src/gdb/top.c:444 (gdb+0xff6d6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 38}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #9 execute_command(char const*, int) /home/vries/gdb/src/gdb/top.c:577 (gdb+0xff7494) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 39}Content-Length: 240

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #10 execute_control_command_1 /home/vries/gdb/src/gdb/cli/cli-script.c:529 (gdb+0x6fd9f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 40}Content-Length: 258

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #11 execute_control_command(command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:701 (gdb+0x6fe084) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 41}Content-Length: 259

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #12 execute_control_commands(command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:411 (gdb+0x6fd3d4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 42}Content-Length: 225

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #13 operator() /home/vries/gdb/src/gdb/cli/cli-script.c:432 (gdb+0x6fd4e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 43}Content-Length: 295

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #14 __invoke_impl<void, execute_control_commands_to_string(command_line*, int)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x701bd8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 44}Content-Length: 293

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #15 __invoke_r<void, execute_control_commands_to_string(command_line*, int)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x7019d8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 45}Content-Length: 223

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #16 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x701798) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 46}Content-Length: 256

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #17 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 47}Content-Length: 259

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #18 execute_fn_to_ui_file(ui_file*, std::function<void ()>) /home/vries/gdb/src/gdb/top.c:631 (gdb+0xff78bc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 48}Content-Length: 336

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #19 execute_fn_to_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::function<void ()>, bool) /home/vries/gdb/src/gdb/top.c:645 (gdb+0xff79f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 49}Content-Length: 280

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #20 execute_control_commands_to_string[abi:cxx11](command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:430 (gdb+0x6fd580) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 50}Content-Length: 233

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #21 execute_gdb_command /home/vries/gdb/src/gdb/python/python.c:673 (gdb+0xd697ec) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 51}Content-Length: 208

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #22 cfunction_call <null> (libpython3.12.so.1.0+0x1aced8) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 52}Content-Length: 285

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #23 void std::__invoke_impl<void, gdbpy_event&>(std::__invoke_other, gdbpy_event&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0xd717ec) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 53}Content-Length: 322

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #24 std::enable_if<is_invocable_r_v<void, gdbpy_event&>, void>::type std::__invoke_r<void, gdbpy_event&>(gdbpy_event&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0xd714ac) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 54}Content-Length: 292

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #25 std::_Function_handler<void (), gdbpy_event>::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:290 (gdb+0xd70ef4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 55}Content-Length: 256

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #26 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 56}Content-Length: 228

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #27 run_events /home/vries/gdb/src/gdb/run-on-main-thread.c:76 (gdb+0xe58c4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 57}Content-Length: 237

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #28 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 58}Content-Length: 238

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #29 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 59}Content-Length: 241

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #30 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:264 (gdb+0x1cf4074) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 60}Content-Length: 221

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #31 start_event_loop /home/vries/gdb/src/gdb/main.c:408 (gdb+0xb79354) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 61}Content-Length: 226

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #32 captured_command_loop /home/vries/gdb/src/gdb/main.c:472 (gdb+0xb79584) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 62}Content-Length: 219

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #33 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 63}Content-Length: 235

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #34 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 64}Content-Length: 207

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #35 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 65}Content-Length: 95

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 66}Content-Length: 198

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Location is global 'cooperative_sigint_handling_disabled' of size 1 at 0x00000328064c (gdb+0x328064c)\n"}, "seq": 67}Content-Length: 95

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 68}Content-Length: 155

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Thread T19 (tid=615397, running) created by thread T16 at:\n"}, "seq": 69}Content-Length: 198

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 pthread_create <null> (libtsan.so.2+0x4605c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888)\n"}, "seq": 70}Content-Length: 218

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 PyThread_start_new_thread <null> (libpython3.12.so.1.0+0x291db0) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 71}Content-Length: 95

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 72}Content-Length: 225

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/gdb/extension.c:755 in set_active_ext_lang(extension_language_defn const*)\n"}, "seq": 73}Content-Length: 113

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "==================\n"}, "seq": 74}Content-Length: 113

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "==================\n"}, "seq": 75}Content-Length: 143

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "WARNING: ThreadSanitizer: data race (pid=615372)\n"}, "seq": 76}Content-Length: 144

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Read of size 8 at 0x000002fb5800 by thread T19:\n"}, "seq": 77}Content-Length: 260

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 set_active_ext_lang(extension_language_defn const*) /home/vries/gdb/src/gdb/extension.c:759 (gdb+0x94fa14) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 78}Content-Length: 297

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling() /home/vries/gdb/src/gdb/extension.c:697 (gdb+0x94f884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 79}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #2 gdbpy_interrupt /home/vries/gdb/src/gdb/python/python.c:1106 (gdb+0xd6ad40) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 80}Content-Length: 220

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #3 cfunction_vectorcall_NOARGS <null> (libpython3.12.so.1.0+0x18017c) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 81}Content-Length: 95

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 82}Content-Length: 155

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Previous write of size 8 at 0x000002fb5800 by main thread:\n"}, "seq": 83}Content-Length: 260

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 set_active_ext_lang(extension_language_defn const*) /home/vries/gdb/src/gdb/extension.c:773 (gdb+0x94faf8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 84}Content-Length: 297

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling() /home/vries/gdb/src/gdb/extension.c:697 (gdb+0x94f884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 85}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #2 fetch_inferior_event() /home/vries/gdb/src/gdb/infrun.c:4591 (gdb+0xa9abc4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 86}Content-Length: 250

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #3 inferior_event_handler(inferior_event_type) /home/vries/gdb/src/gdb/inf-loop.c:42 (gdb+0xa6a734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 87}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #4 handle_target_event /home/vries/gdb/src/gdb/linux-nat.c:4357 (gdb+0xb0cb4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 88}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #5 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 89}Content-Length: 237

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #6 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 90}Content-Length: 240

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #7 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:217 (gdb+0x1cf3ee8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 91}Content-Length: 227

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #8 wait_sync_command_done() /home/vries/gdb/src/gdb/top.c:427 (gdb+0xff6c74) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 92}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #9 maybe_wait_sync_command_done(int) /home/vries/gdb/src/gdb/top.c:444 (gdb+0xff6d6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 93}Content-Length: 237

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #10 execute_command(char const*, int) /home/vries/gdb/src/gdb/top.c:577 (gdb+0xff7494) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 94}Content-Length: 240

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #11 execute_control_command_1 /home/vries/gdb/src/gdb/cli/cli-script.c:529 (gdb+0x6fd9f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 95}Content-Length: 258

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #12 execute_control_command(command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:701 (gdb+0x6fe084) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 96}Content-Length: 259

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #13 execute_control_commands(command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:411 (gdb+0x6fd3d4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 97}Content-Length: 225

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #14 operator() /home/vries/gdb/src/gdb/cli/cli-script.c:432 (gdb+0x6fd4e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 98}Content-Length: 295

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #15 __invoke_impl<void, execute_control_commands_to_string(command_line*, int)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x701bd8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 99}Content-Length: 294

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #16 __invoke_r<void, execute_control_commands_to_string(command_line*, int)::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x7019d8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 100}Content-Length: 224

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #17 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x701798) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 101}Content-Length: 257

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #18 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 102}Content-Length: 260

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #19 execute_fn_to_ui_file(ui_file*, std::function<void ()>) /home/vries/gdb/src/gdb/top.c:631 (gdb+0xff78bc) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 103}Content-Length: 337

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #20 execute_fn_to_string(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::function<void ()>, bool) /home/vries/gdb/src/gdb/top.c:645 (gdb+0xff79f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 104}Content-Length: 281

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #21 execute_control_commands_to_string[abi:cxx11](command_line*, int) /home/vries/gdb/src/gdb/cli/cli-script.c:430 (gdb+0x6fd580) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 105}Content-Length: 234

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #22 execute_gdb_command /home/vries/gdb/src/gdb/python/python.c:673 (gdb+0xd697ec) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 106}Content-Length: 209

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #23 cfunction_call <null> (libpython3.12.so.1.0+0x1aced8) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 107}Content-Length: 286

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #24 void std::__invoke_impl<void, gdbpy_event&>(std::__invoke_other, gdbpy_event&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0xd717ec) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 108}Content-Length: 323

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #25 std::enable_if<is_invocable_r_v<void, gdbpy_event&>, void>::type std::__invoke_r<void, gdbpy_event&>(gdbpy_event&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0xd714ac) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 109}Content-Length: 293

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #26 std::_Function_handler<void (), gdbpy_event>::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:290 (gdb+0xd70ef4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 110}Content-Length: 257

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #27 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 111}Content-Length: 229

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #28 run_events /home/vries/gdb/src/gdb/run-on-main-thread.c:76 (gdb+0xe58c4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 112}Content-Length: 238

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #29 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 113}Content-Length: 239

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #30 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 114}Content-Length: 242

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #31 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:264 (gdb+0x1cf4074) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 115}Content-Length: 222

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #32 start_event_loop /home/vries/gdb/src/gdb/main.c:408 (gdb+0xb79354) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 116}Content-Length: 227

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #33 captured_command_loop /home/vries/gdb/src/gdb/main.c:472 (gdb+0xb79584) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 117}Content-Length: 220

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #34 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 118}Content-Length: 236

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #35 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 119}Content-Length: 208

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #36 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)\n"}, "seq": 120}Content-Length: 96

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 121}Content-Length: 178

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Location is global 'active_ext_lang' of size 8 at 0x000002fb5800 (gdb+0x2fb5800)\n"}, "seq": 122}Content-Length: 96

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 123}Content-Length: 156

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "  Thread T19 (tid=615397, running) created by thread T16 at:\n"}, "seq": 124}Content-Length: 199

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #0 pthread_create <null> (libtsan.so.2+0x4605c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888)\n"}, "seq": 125}Content-Length: 219

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "    #1 PyThread_start_new_thread <null> (libpython3.12.so.1.0+0x291db0) (BuildId: e9b415ce55c7933d6ad853dc95e0708f8be06109)\n"}, "seq": 126}Content-Length: 96

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "\n"}, "seq": 127}Content-Length: 226

{"type": "event", "event": "output", "body": {"category": "stdout", "output": "SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/gdb/extension.c:759 in set_active_ext_lang(extension_language_defn const*)\n"}, "seq": 128}Content-Length: 114
...
Comment 1 Tom de Vries 2024-01-18 09:41:08 UTC
Same test-case:
...
"type": "event", "event": "output", "body": {"category": "stdout", "output": "SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/gdb/extension.c:704 in scoped_disable_cooperative_sigint_handling::scoped_disable_cooperative_sigint_handling()\n"}, "seq": 181}Content-Length: 114^M
...
Comment 2 Tom de Vries 2024-01-22 14:52:50 UTC
Bisects to:
...
commit 1c79c8dad90e4382100b51694a2b9ee7e913a04a (HEAD)
Author: Tom Tromey <tromey@adacore.com>
Date:   Tue Nov 7 10:56:07 2023 -0700

    Implement DAP cancellation

...
Comment 3 Tom Tromey 2024-02-23 15:22:51 UTC
This one is kind of ugly because we basically need a mutex
so that set_quit_flag can safely be called off the main thread.
I must have thought this was an atomic operation when I wrote
this patch :(
Anyway the issue is that some hosts don't have threading
support in the c++ compiler, so making a mutex is difficult.

Not sure what to do there.  I'm leaning toward just allowing
the race in this situation, but disabling DAP would be
a possibility as well.
Comment 5 Sourceware Commits 2024-02-28 16:13:27 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8bb8f8346729c35433c961f7f1ed3a801776a362

commit 8bb8f8346729c35433c961f7f1ed3a801776a362
Author: Tom Tromey <tromey@adacore.com>
Date:   Fri Feb 23 08:59:40 2024 -0700

    Fix gdb.interrupt race
    
    gdb.interrupt was introduced to implement DAP request cancellation.
    However, because it can be run from another thread, and because I
    didn't look deeply enough at the implementation, it turns out to be
    racy.
    
    The fix here is to lock accesses to certain globals in extension.c.
    
    Note that this won't work in the case where configure detects that the
    C++ compiler doesn't provide thread support.  This version of the
    patch disables DAP entirely in this situation.
    
    Regression tested on x86-64 Fedora 38.  I also ran gdb.dap/pause.exp
    in a thread-sanitizer build tree to make sure the reported race is
    gone.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31263
Comment 6 Tom Tromey 2024-02-28 16:14:15 UTC
Fixed.